Android中的MediaPlayer和VideoView有什么区别 [英] What is the difference between MediaPlayer and VideoView in Android
问题描述
我想知道流媒体视频之间是否存在差异.
I was wondering if there's a difference between them when it comes to streaming videos.
我知道VideoView
可用于流式传输,Mediaplayer
的作用是什么?据我所知,MediaPlayer
可以做与VideoView
相同的事情,对吗?
I know VideoView
can be used for streaming and what is Mediaplayer
for? As far as I know, MediaPlayer
can do the same thing as VideoView
right?
有人可以给我答案吗?
如果我想使用RTSP将视频从服务器流式传输到Android,应该从哪一个开始? VideoView
或MediaPlayer
?
And if I want to stream video from the server by using RTSP to Android, which one should I start with? VideoView
or MediaPlayer
?
有什么建议吗?
推荐答案
问的是同样的问题,据我从Mark(CommonsWare)了解到的内容
Was asking the same question and as I understood from what Mark (CommonsWare) advised on numerous threads here, VideoView is a wrapper (200 hundred lines of code) for MediaPlayer and SurfaceView to provide embedded controls.
他也很好地分享了一些例子:
He also kindly shared some examples:
https://github .com/commonsguy/vidtry/blob/master/src/com/commonsware/android/vidtry/Player.java
和android sdk中的示例 http://developer. android.com/resources/samples/ApiDemos/src/com/example/android/apis/media/MediaPlayerDemo.html
and example from android sdk http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/media/MediaPlayerDemo.html
还有一些人在模拟器上播放视频时遇到问题,因此,如果遇到问题,请确保在实际设备上对其进行测试
Also some people had issues playing video on emulator, so make sure to test it on actual device if you have issues
这篇关于Android中的MediaPlayer和VideoView有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!