Android VideoView无法播放.avi
我写了这样的简单代码:
VideoView v = (VideoView) findViewById(R.id.videoView);
MediaController mc = new MediaController(this);
mc.setAnchorView(v);
mc.setMediaPlayer(v);
v.setMediaController(mc);
v.setVideoPath("/sdcard/media/video/1.avi");
v.start();
我的问题是这个代码.avi 文件根本无法播放。 Logcat 显示这些字符串: AudioFlinger:写入阻塞 209 毫秒,11 次延迟写入,线程 0x15440 MP3Extractor:无法重新同步。发出流结束信号。
如果 avi 文件不正确,请告诉我如何播放。
PS 是的,我知道,android 默认情况下不支持 avi,但我也知道很多播放器可以播放它。
I have written simple code like this:
VideoView v = (VideoView) findViewById(R.id.videoView);
MediaController mc = new MediaController(this);
mc.setAnchorView(v);
mc.setMediaPlayer(v);
v.setMediaController(mc);
v.setVideoPath("/sdcard/media/video/1.avi");
v.start();
My problem is with this code .avi files cant be played at all. Logcat show me those strings:
AudioFlinger: write blocked for 209 msecs, 11 delayed writes, thread 0x15440
MP3Extractor: Unable to resync. Signalling end of stream.
Tell me please how can i play avi files if it is not a correct.
P.S. Yes, i know, that avi is not supported on android by default, but i also know a lot of players which can play it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果底层硬件具有 AVI 解复用器并且设备能够使用硬件提供的默认播放器播放 .avi 文件,则您的代码应该可以工作。
但是,如果您想构建一个独立且能够播放 avi 文件的应用程序,您将无法使用上述代码。
基本上,您必须构建自己的媒体播放器,它有自己的媒体解复用器和 AV 编解码器。例如,android 上的“moboplayer”使用开源编解码器 ffmpeg。
希望这能回答你的问题..
Your code should work if the underlying hardware has AVI demuxer and the device is capable of playing .avi files using the default player provided by the hardware.
But if you want to build an application which is self contained and capable of playing avi files you will not be able to do with the above code.
Basically you will have to build your own media player which has its own media demuxer and AV codecs.. for example the "moboplayer" on android uses an opensource codec ffmpeg.
Hope this answers your question..