如何捕捉"对不起,此视频无法播放"在VideoView错误 [英] How to catch "Sorry, This video cannot be played" error on VideoView

查看:617
本文介绍了如何捕捉"对不起,此视频无法播放"在VideoView错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个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. :)

推荐答案

尝试使用<一个href="http://developer.android.com/reference/android/widget/VideoView.html#setOnErrorListener%28android.media.MediaPlayer.OnErrorListener%29">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.

这篇关于如何捕捉&QUOT;对不起,此视频无法播放&QUOT;在VideoView错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆