[英]How to notify the user when exo player is buffering the video in Android?
[英]Exo player hangs and crashes when played with URL
有時 Exo 播放器掛起並在我的應用程序中發生崩潰。 我想我在播放器中使用了實時 URL,因此存在一些超時問題。
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();
此處顯示的錯誤確實是套接字讀取超時 - 為了驗證沒有其他潛在問題,您可以通過將您的 url(和任何 DRM 許可證 URL)添加到那里的測試 json 數據文件中來在演示資源管理器中測試。
如果您在本地有相同的源或類似的源,您也可以在本地網絡上進行測試。
視頻服務器也可能是瓶頸——即網絡正常但視頻服務器工作過度或出現故障。 如果您可以訪問視頻服務器,那么檢查日志可能是最好的起點。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.