[ACCEPTED]-What is the difference between MediaPlayer and VideoView in Android-android-videoview

Accepted answer
Score: 40

Was asking the same question and as I understood 9 from what Mark (CommonsWare) advised on numerous 8 threads here, VideoView is a wrapper (200 7 hundred lines of code) for MediaPlayer and 6 SurfaceView to provide embedded controls.

He 5 also kindly shared some examples:

https://github.com/commonsguy/cw-advandroid/blob/master/Media/Video/src/com/commonsware/android/video/VideoDemo.java

https://github.com/commonsguy/vidtry/blob/master/src/com/commonsware/android/vidtry/Player.java

and example 4 from android sdk http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/media/MediaPlayerDemo.html

Also some people had issues 3 playing video on emulator, so make sure 2 to test it on actual device if you have 1 issues

Score: 16

VideoView is essentially a View that is 11 tied to a MediaPlayer to make it a lot easier 10 to implement videos in your app. If you 9 aren't doing much custom work, VideoView 8 is the way to go.

That said, you can also 7 pass the RTSP link off to the system to 6 use the most appropriate app for playing 5 the video, which is even easier to do:

String url = "rtsp://yourrtsplink.com/blah";
Uri uri = Uri.parse(url);
startActivity(new Intent(Intent.ACTION_VIEW, uri));

Video 4 should be tested on a device, since emulator 3 playback is poor, and you should also be 2 aware that RTSP requires an extra port to 1 be open, which is blocked by some firewalls.

Score: 3
Score: 0

The VideoAdView is a wrapper for MediaPlayer 6 and SurfaceView, it's more easy to implement 5 video player with VideoView than with a 4 MediaPlayer, if the video files are stored 3 in the internal storage of the app use content 2 provider or store them as world readable, otherwise 1 it will not work

More Related questions