我有一个VideoView,我流媒体视频从远程服务器。很多时候它会播放视频非常流畅。但有时,它会显示抱歉,该视频无法播放的错误消息。我有一种预感,这更多的是对所支持的视频格式。但是,我不知道这是所支持的格式。我的问题是我怎样才能赶上这个错误(如prevent的错误消息显示)?我使用的是Android 2.2在这个项目上。任何意见将大大AP preciated。 :)
I have a VideoView and I am streaming videos from a remote server. Most of the times It would play the videos very smoothly. But sometimes, it displays an error message "Sorry, This video cannot be played". I have a hunch that this is more on the supported video formats. However, I don't know which are the supported formats. My question is "How can I catch this error (e.g. Prevent the error message from appearing)"? I am using Android 2.2 on this project. Any advice would be greatly appreciated. :)
推荐答案尝试使用setOnErrorListener:该文件说的如果没有指定侦听器,或者监听器返回false,VideoView将告知任何错误的用户。的,所以我假设,如果你设置一个,返回true,将不显示用户错误。
Try using setOnErrorListener: the documentation says If no listener is specified, or if the listener returned false, VideoView will inform the user of any errors., so I'm assuming if you set one and return true it will not show the user error.
更多推荐
如何捕捉"对不起,此视频无法播放"在VideoView错误
发布评论