Android - Different ways of playing video
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 th开发者_开发问答ese 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
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).
精彩评论