views:

328

answers:

1

Hi All,

I just came across the limitation of VideoView of not being able to play mp4 video files that are wider than 320 pixels. I was wondering how can we overcome these limitations. I am trying to make my app as forgiving as possible, so other than using VideoViews is there another way to play these mp4 videos?

Chris

A: 

I am not aware of a 320px wide limit on VideoView, though I haven't tried it.

You can use MediaPlayer and a SurfaceView to play back videos. In fact, that's pretty much all VideoView is. Last I looked at the VideoView source code, it was only ~200 lines.

Here is a sample project that implements a video player using MediaPlayer and SurfaceView, with screen taps to bring up some pop-up panels (e.g., timeline).

CommonsWare
I tried playing the video with MediaPlayer and SurfaceView, still no luck! Also, if VideoView is just an abstraction of MediaPlayer and SurfaceView, then wouldn't the limitation have come from there?
Chris
I have played videos wider than 320px using `MediaPlayer` and `SurfaceView`. So have millions of other people with Android devices, using the Gallery (which uses `VideoView`, as it turns out) or third-party video players. I suspect that you are having some other problem than a built-in "limitation of VideoView of not being able to play mp4 video files that are wider than 320 pixels".
CommonsWare