我有一个使用HlsRendererBuilder设置的ExoPlayer 。 到目前为止,我已经将Uri传递给服务器上的m3u8流文件。 它工作得很好。 现在我可以选择将视频下载到手机上并从存储中播放。 我已成功从给定链接下载文件,将其存储在app私人文件夹中。 请求和批准访问外部存储的所有权限。 在这种情况下,我从我下载的文件传递一个Uri。 Uri看起来像这样: file:///storage/emulated/0/video/file.mp4 。 当我开始播放时,永远不会加载文件。 我在日志中没有任何异常或错误。 任何人都可以帮我建议一种方法吗? 如果需要,我将提供代码片段,但不确定哪个部分有用。
我有ExoPlayer.Listener ,它记录了播放器状态。
当我正在流媒体时,我得到各种状态,从IDLE - > BUFFERING - > READY - > BUFFERING ......等等基于互联网连接或媒体结束ec。 当我播放存储文件时,我只获得状态IDLE,没有其他任何事情发生。 我永远得到黑屏,直到我finish()活动。当我尝试从本地存储中播放流文件时,我确实遇到了一个FileNotFound异常,它无法找到该文件,这是流文件中列出的下一部分媒体。 我认为问题出在玩家设置中? 不确定...
I have a ExoPlayer set up with HlsRendererBuilder. So far I have been passing it an Uri to a m3u8 stream file on the server. It is working great. Now I have an option to download the video to your phone and play it from storage. I have successfully downloaded the file from the given link, stored it in the app private folder. All permissions to access external storage requested and approved. In this case I am passing an Uri from file which I have downloaded. Uri looks like this: file:///storage/emulated/0/video/file.mp4. When I start the playback the file is never loaded. I do not get any exception or error in the log. Can anyone help me to suggest an approach? I will provide snippet of codes if needed, but not sure which part would be useful.
I have ExoPlayer.Listener which logs me of the player state.
When I am streaming I get various states starting from IDLE -> BUFFERING -> READY -> BUFFERING ... so on based on the internet connection or if the media ended ec. When I am playing stored file I only get state IDLE and nothing else happens. I got black screen forever until I finish() the activity.When I tried to play stream file from local storage I did got an FileNotFound exception that it cannot find the file, next part of media listed in the stream file. I assume the problem would be in the player setup? Not sure...
最满意答案
您需要为本地(视频/音频)文件使用不同的RendererBuilder 。
ExtractorRendererBuilder是你应该看的东西。
You need to use a different RendererBuilder for a local (video/audio) file.
ExtractorRendererBuilder is the thing you should be looking at.
更多推荐
发布评论