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

长期循环播放一个视频 音频不同步问题 #204

Closed
nuoyan2 opened this issue Nov 5, 2018 · 0 comments
Closed

长期循环播放一个视频 音频不同步问题 #204

nuoyan2 opened this issue Nov 5, 2018 · 0 comments

Comments

@nuoyan2
Copy link

nuoyan2 commented Nov 5, 2018

感谢作者的分享和无私的奉献帮我解决BUG

问题描述:在大于8个小时的单视频循环播放会出现音频不同步问题
解决办法 :(1)这个是ExoPlayer的bug 设置FLAG_WORKAROUND_IGNORE_EDIT_LISTS可解决bug
参考:google/ExoPlayer#4559
(2)作者更新了代码 需要继承MediaSourceBuilder重写initMediaSource方法
代码如下:
@OverRide
public MediaSource initMediaSource(Uri uri) {
DefaultExtractorsFactory mDefaultExtractorsFactory= new DefaultExtractorsFactory();
mDefaultExtractorsFactory.setMp4ExtractorFlags(Mp4Extractor.FLAG_WORKAROUND_IGNORE_EDIT_LISTS);
int streamType = VideoPlayUtils.inferContentType(uri);
switch (streamType) {
case C.TYPE_OTHER:
return new ExtractorMediaSource.Factory(getDataSource())
.setExtractorsFactory(mDefaultExtractorsFactory)
.setMinLoadableRetryCount(5)
.setCustomCacheKey(customCacheKey == null ? uri.toString() : customCacheKey)
.createMediaSource(uri);
default:
throw new IllegalStateException(context.getString(R.string.media_error));
}
}

在初始化wholeMediaSource的时候使用您定义的MediaSourceBuilder
此贴是为了以后遇到此BUG的人提供参考
再次感谢作者的分享和贡献

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

No branches or pull requests

1 participant