play method

Future<void> play({
  1. required String path,
  2. required VapSourceType sourceType,
  3. int repeatCount = 0,
  4. bool deleteOnEnd = true,
})

播放视频,必传 path/sourceType 循环播放repeatCount参数只在Android管用 deleteOnEnd 决定资源播放完毕后是否应删除该文件。

Implementation

Future<void> play({
  required String path,
  required VapSourceType sourceType,
  int repeatCount = 0,
  bool deleteOnEnd = true,
}) async {
  _lastPath = path;
  _lastSourceType = sourceType;
  if (Platform.isAndroid) {
    await _channel?.invokeMethod('play', {
      'path': path,
      'sourceType': sourceType.type,
      'repeatCount': repeatCount,
      'deleteOnEnd': deleteOnEnd,
    });
  }
  if (Platform.isIOS) {
    await _channel?.invokeMethod('play', {
      'path': path,
      'sourceType': sourceType.type,
    });
  }
}