androidvideoavi

Android VideoView cant play .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.


Solution

  • 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..