我正在使用 fluttervideo_player包来播放视频列表。
List sourceList;
sourceList = [
{
"size": 69742504,
"name": "lucky-roulette.mp4",
"mimetype": "video/mp4",
},
{
"size": 69742504,
"name": "BigBuckBunny.mp4",
"mimetype": "video/mp4",
}
];
Run Code Online (Sandbox Code Playgroud)
我已经检查了这个问题,并在上面做了一些自定义代码。
void play() {
log.fine("Now playing: $_nowPlayingUrl");
_adController = VideoPlayerController.network(_nowPlayingUrl);
_adController.initialize().then((_) => setState(() {}));
_adController.play();
_adController.addListener(checkIfVideoFinished);
}
void checkIfVideoFinished() {
if (_adController == null ||
_adController.value == null ||
_adController.value.position == null ||
_adController.value.duration == null) return;
if (_adController.value.position.inSeconds ==
_adController.value.duration.inSeconds) {
_adController.removeListener(checkIfVideoFinished);
_adController.dispose();
// Change _nowPlayingIndex
setState(() {
_nowPlayingIndex = (_nowPlayingIndex …Run Code Online (Sandbox Code Playgroud)