瀏覽代碼

Update README and CHANGELOG

Ben Hagen 6 年之前
父節點
當前提交
b41d83d51f
共有 2 個文件被更改,包括 50 次插入5 次删除
  1. 5 0
      CHANGELOG.md
  2. 45 5
      README.md

+ 5 - 0
CHANGELOG.md

@@ -1,5 +1,10 @@
 # Changelog
 # Changelog
 
 
+## 1.0.0
+
+  * **Breaking changes**: Add a `ChewieController` to make customizations and control from outside of the player easier.
+    Refer to the [README](README.md) for details on how to upgrade from previous versions.
+
 ## 0.8.0
 ## 0.8.0
 
 
   * Update to work with `video_player: ">=0.7.0 <0.8.0` - Thanks @Sub6Resources 
   * Update to work with `video_player: ">=0.7.0 <0.8.0` - Thanks @Sub6Resources 

+ 45 - 5
README.md

@@ -21,23 +21,63 @@ dependencies:
 
 
 ```dart
 ```dart
 import 'package:chewie/chewie.dart';
 import 'package:chewie/chewie.dart';
+final videoPlayerController = VideoPlayerController.network(
+    'https://flutter.github.io/assets-for-api-docs/videos/butterfly.mp4');
 
 
-final playerWidget = new Chewie(
-  new VideoPlayerController.network(
-    'https://flutter.github.io/assets-for-api-docs/videos/butterfly.mp4'
-  ),
+final chewieController = ChewieController(
+  videoPlayerController: videoPlayerController,
   aspectRatio: 3 / 2,
   aspectRatio: 3 / 2,
   autoPlay: true,
   autoPlay: true,
   looping: true,
   looping: true,
 );
 );
+
+final playerWidget = Chewie(
+  controller: chewieController,
+);
+```
+
+Please make sure to dispose both controller widgets after use. For example by overriding the dispose method of the a `StatefulWidget`:
+```dart
+@override
+void dispose() {
+videoPlayerController.dispose();
+chewieController.dispose();
+super.dispose();
+}
 ```
 ```
 
 
 ## Example
 ## Example
 
 
 Please run the app in the [`example/`](https://github.com/brianegan/chewie/tree/master/example) folder to start playing!
 Please run the app in the [`example/`](https://github.com/brianegan/chewie/tree/master/example) folder to start playing!
 
 
+## Migrating from Chewie < 1.0.0
+Instead of passing the `VideoPlayerController` and your options to the `Chewie` widget you now pass them to the `ChewieController` and pass that latter to the `Chewie` widget.
+
+```dart
+final playerWidget = Chewie(
+  videoPlayerController,
+  aspectRatio: 3 / 2,
+  autoPlay: true,
+  looping: true,
+);
+```
+
+becomes
+
+```dart
+final chewieController = ChewieController(
+  videoPlayerController: videoPlayerController,
+  aspectRatio: 3 / 2,
+  autoPlay: true,
+  looping: true,
+);
+
+final playerWidget = Chewie(
+  controller: chewieController,
+);
+```
 
 
-## iOS Warning
+## iOS warning
 
 
 The video player plugin used by chewie is not functional on iOS simulators. An iOS device must be used during development/testing. Please refer to this [issue](https://github.com/flutter/flutter/issues/14647).
 The video player plugin used by chewie is not functional on iOS simulators. An iOS device must be used during development/testing. Please refer to this [issue](https://github.com/flutter/flutter/issues/14647).