如何捕捉"对不起,此视频无法播放"在VideoView错误

编程入门 行业动态 更新时间:2024-10-09 10:20:05
本文介绍了如何捕捉"对不起,此视频无法播放"在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. :)

推荐答案

尝试使用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错误

本文发布于:2023-11-27 18:45:50,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1639169.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:无法播放   错误   视频   QUOT   VideoView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!