使用URL播放时,Exo播放器悬挂并撞车
有时,Exo播放器会挂起,并且在我的应用中发生崩溃。我认为我在玩家中使用了现场网址,因此存在一些超时问题。
Uri assetSrtUri = Uri.parse(vvtFilePath);
MediaItem.SubtitleConfiguration subtitle = new MediaItem.SubtitleConfiguration.Builder(assetSrtUri)
.setMimeType(MimeTypes.TEXT_VTT)
.setLanguage("en")
.setSelectionFlags(C.SELECTION_FLAG_DEFAULT)
.build();
MediaItem mediaItem = new MediaItem.Builder()
.setUri(uri)
.setSubtitleConfigurations(ImmutableList.of(subtitle))
.build();
player.setMediaItem(mediaItem);
player.prepare();
Sometimes Exo player hangs and crashes happen in my app. I think I used a live URL in the player so there is some time-out issue.
Uri assetSrtUri = Uri.parse(vvtFilePath);
MediaItem.SubtitleConfiguration subtitle = new MediaItem.SubtitleConfiguration.Builder(assetSrtUri)
.setMimeType(MimeTypes.TEXT_VTT)
.setLanguage("en")
.setSelectionFlags(C.SELECTION_FLAG_DEFAULT)
.build();
MediaItem mediaItem = new MediaItem.Builder()
.setUri(uri)
.setSubtitleConfigurations(ImmutableList.of(subtitle))
.build();
player.setMediaItem(mediaItem);
player.prepare();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此处显示的错误确实是套接字读取超时 - 要验证,您可以通过将您的URL(和任何DRM许可URL)添加到其中的测试JSON数据文件中,可以在演示资源管理器中测试其他潜在问题。
如果您在本地网络上具有相同的可用源或类似的来源,则可以在本地网络上进行测试。
视频服务器也可能是瓶颈 - 即网络还可以,但是视频服务器过度劳累或有一些故障。如果您可以访问视频服务器,那么检查日志可能是最佳起点。
The error showing here is indeed a socket read timeout - to verify there is not other underlying issues you could test in the demo explorer by adding your url (and any DRM license URL) to the test json data file there.
You could also test on a local network if you have the same source available locally, or a similar source.
It is possible the video server is the bottle neck also - i.e. the network is ok but the video server is overworked or has some fault. If you have access to the video server then checking the logs would likely be the best place to start.