Android的 - 播放视频的不同方法 [英] Android - Different ways of playing video
问题描述
我刚刚碰到VideoView的不能够播放MP4视频文件宽于320像素的限制。我想知道我们如何克服这些限制。我试图让我的应用程序的宽容越好,这样比使用VideoViews另一种是有另一种方式来播放这些MP4的视频?
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?
克里斯
推荐答案
我不知道对 VideoView
A 320px的宽限度,虽然我还没有尝试过。
I am not aware of a 320px wide limit on VideoView
, though I haven't tried it.
您可以使用的MediaPlayer
和 SurfaceView
来播放视频。事实上,这是pretty的多少均 VideoView
是。最后我看了看 VideoView
源$ C $ C,这是只有约200线。
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.
下面是一个示例项目,使用实现了视频播放器的MediaPlayer
和 SurfaceView
,用点击屏幕带来了一些弹出的面板(例如,时间轴)。
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).
这篇关于Android的 - 播放视频的不同方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!