Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

优化资源初始化 #290

Open
yangxuy opened this issue May 15, 2021 · 0 comments
Open

优化资源初始化 #290

yangxuy opened this issue May 15, 2021 · 0 comments
Labels
wait confirm Waiting for developer confirmation

Comments

@yangxuy
Copy link

yangxuy commented May 15, 2021

现象:flutter官方的video_player在占位图和视频播放切换的时候没有黑屏,flutter_ijkplayer在网络稍差点都会出现黑屏
原因:官方video_player使用Completer (isolate)这个来初始化

 final Completer<void> initializingCompleter = Completer<void>();
 /// 逻辑
  return initializingCompleter.future;

flutter_ijkplayer使用的是Future来初始化的

     var d1 = new DateTime.now();
      await _initDataSource(autoPlay);
      await _plugin?.setNetworkDataSource(
        uri: url,
        headers: headers,
      );
      var d2 = new DateTime.now();
      var difference = d2.difference(d1);
      print('duration = ${difference.inMilliseconds.toString()} ms');
      _ijkStatus = IjkStatus.prepared;

在初始化时间过长的时候,黑屏会显示的特别明显,加载资源的速度也明显比官方的慢很多

希望能够在初始化资源的时候 使用Completer (isolate) 来处理

@yangxuy yangxuy added the wait confirm Waiting for developer confirmation label May 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wait confirm Waiting for developer confirmation
Projects
None yet
Development

No branches or pull requests

1 participant