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

视频加载完后为什么背景是黑的? #118

Closed
ivan5151 opened this issue Nov 27, 2019 · 6 comments
Closed

视频加载完后为什么背景是黑的? #118

ivan5151 opened this issue Nov 27, 2019 · 6 comments
Labels
ijkplayer ijkplayer related

Comments

@ivan5151
Copy link

视频加载完后为什么背景是黑的?而且也看不到时长,需要播放后才有。

@befovy
Copy link
Owner

befovy commented Nov 27, 2019

你描述的加载完成后具体是指调用什么接口后? 你认为应该是什么样子,请描述一下

@ivan5151
Copy link
Author

ivan5151 commented Nov 27, 2019

FijkPlayer player = FijkPlayer();
player.setDataSource(url, autoPlay: false);

就是调用完setDataSource,希望是可以出现视频的画面,和时长。但是现在调用完setDataSource如果不设置自动播放,就是一个黑色的背景,时间也是00:00,我是否还需要调用什么接口来完成这一步?

@befovy
Copy link
Owner

befovy commented Nov 27, 2019

player.setDataSource(url, autoPlay: false);
这一行仅仅是传递 url 参数到C层播放器内部,没有启动任何线程,没有网络访问。

await player.setDataSource(url, autoPlay: true);
差别就大了,相当于

await player.setDataSource(url);
await player.setOption(FijkOption.playerCategory, "start-on-prepared", 1);
await player.prepareAsync();

我明白你的需求,但是现在对这个没有很好地支持。
以 fijkplayer 目前的功能实现你的需求,你需要先设置静音,再开始播放,然后在第一帧视频渲染之后调用暂停。

我会在 ijkplayer 中真正实现你所说的这个需求,不过得等段时间了。

@ivan5151

@ivan5151
Copy link
Author

好的,谢谢。

@befovy befovy added the ijkplayer ijkplayer related label Dec 6, 2019
befovy added a commit to befovy/ijkplayer that referenced this issue Jan 6, 2020
befovy added a commit that referenced this issue Jan 6, 2020
@befovy befovy closed this as completed in 9cacfe9 Jan 6, 2020
@befovy
Copy link
Owner

befovy commented Jan 6, 2020

@ivan5151 更新支持了,可以试试。

文档见 https://fijkplayer.befovy.com/docs/zh/fijkplayer-api.html 中 setDataSource 部分。

@ivan5151
Copy link
Author

ivan5151 commented Jan 8, 2020

好的,感谢。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ijkplayer ijkplayer related
Projects
None yet
Development

No branches or pull requests

2 participants