What is the difference between MediaPlayer and VideoView in Android

前端 未结 4 1847
说谎
说谎 2020-12-07 15:36

I was wondering if there\'s a difference between them when it comes to streaming videos.

I know VideoView can be used for streaming and what is Me

4条回答
  •  -上瘾入骨i
    2020-12-07 15:59

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

    That said, you can also pass the RTSP link off to the system to use the most appropriate app for playing 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 should be tested on a device, since emulator playback is poor, and you should also be aware that RTSP requires an extra port to be open, which is blocked by some firewalls.

提交回复
热议问题