playAssetFile method
播放远端视频
Implementation
Future<bool?> playAssetFile(String path) async {
try {
final filePath = await VideoDownloadManager.getInstance().getAssetsPathAfterData(path);
if (filePath != null) {
if (mode == VideoPlayMode.onQueue) {
_queue.add(VideoModel(filePath, VideoSource.asset));
if (isPlaying == false) {
playNext();
}
} else {
if (isPlaying) {
stop();
}
Future.delayed(const Duration(milliseconds: 200), () {
if (disposed) {return;}
_queue.add(VideoModel(filePath, VideoSource.asset));
playNext();
});
}
}
return true;
} on PlatformException catch (e) {
debugPrint('Failed to play url: ${e.message}');
return false;
}
}