Android - Different ways of playing video

故事扮演 提交于 2019-12-05 04:21:14

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/2923317/android-different-ways-of-playing-video

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!