Skip to content

Commit

Permalink
[1.0.0+1]🔧Fix: 修正了加载顺序导致播放顺序错误的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJialun committed Jun 17, 2021
1 parent b4b2be7 commit 00faa02
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/views/tikTokVideoPlayer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:video_player/video_player.dart';
// VideoInfo(this.url, this.title);
// }

// TODO: 实现无限往下播视频
class VideoListController extends ChangeNotifier {
/// 构造方法
VideoListController();
Expand Down Expand Up @@ -39,16 +40,16 @@ class VideoListController extends ChangeNotifier {
/// 视频总数目
int get videoCount => playerList.length;

/// 在当前的list后面继续增加视频,并预加载封面
/// 添加视频
addVideoInfo(List<UserVideo> list) async {
await Future.wait(list.map(
playerList.addAll(await Future.wait(list.map(
(info) async {
var player = VideoPlayerController.network(info.url);
player.setLooping(true);
await player.initialize();
playerList.add(player);
return player;
},
));
)));
}

/// 初始化
Expand Down

0 comments on commit 00faa02

Please sign in to comment.