Browse Source

add screen shot method

cjl_macbook 6 years ago
parent
commit
a439056e23
3 changed files with 29 additions and 0 deletions
  1. 12 0
      README-EN.md
  2. 12 0
      README.md
  3. 5 0
      lib/src/controller.dart

+ 12 - 0
README-EN.md

@@ -196,6 +196,18 @@ await controller.seekTo(0); // double value , such as : 1.1 = 1s100ms, 60 = 1min
   VideoInfo info = await controller.getVideoInfo();
 ```
 
+#### screen shot
+
+Intercept the current video frame
+This video frame comes from the video frame currently decoded by ffmpeg and does not contain the contents of the controller, etc.
+The format in dart is Uint8List.
+
+```dart
+var uint8List = await controller.screenShot();
+var provider = MemoryImage(uint8List);
+Widget image = Image(image:provider);
+```
+
 #### Observer for resource
 
 Broadcasting changes in information outward in the form of streams, in principle the attributes ending with streams are monitorable.

+ 12 - 0
README.md

@@ -220,6 +220,18 @@ await controller.setSystemVolume(100); // 范围0~100
   VideoInfo info = await controller.getVideoInfo();
 ```
 
+#### 截取视频帧
+
+视频帧的截图
+
+以`Uint8List`的格式导出,可以使用`Image`控件查看
+
+```dart
+var uint8List = await controller.screenShot();
+var provider = MemoryImage(uint8List);
+Widget image = Image(image:provider);
+```
+
 #### 资源监听
 
 使用 stream 的形式向外广播一些信息的变化,原则上以 stream 结尾的属性都是可监听的

+ 5 - 0
lib/src/controller.dart

@@ -328,6 +328,7 @@ class IjkMediaController with IjkMediaControllerMixin {
     await IjkManager.setSystemVolume(volume);
   }
 
+  /// Pause all other players.
   Future<void> pauseOtherController() async {
     await IjkMediaPlayerManager().pauseOther(this);
   }
@@ -347,6 +348,9 @@ class IjkMediaController with IjkMediaControllerMixin {
     _playFinishController?.add(this);
   }
 
+  /// Intercept the video frame image and get the `Uint8List` format.
+  /// 
+  /// Player UI is not included. If you need the effect of the player, use the screenshot of the system.
   Future<Uint8List> screenShot(){
     return _plugin.screenShot();
   }
@@ -429,6 +433,7 @@ class _IjkPlugin {
     });
   }
 
+  /// 
   Future<void> setVolume(int volume) async {
     await channel.invokeMethod("setVolume", <String, dynamic>{
       "volume": volume,