For the More Curious: Playing Video
When it comes to playing video, you have a couple more options. One way to do it is to use MediaPlayer, just like you have been. All you need to do is hook up a place to display the video.
Imagery that updates quickly (like video) is displayed in a SurfaceView on Android. Actually, it is displayed on a Surface, which the SurfaceView hosts. You can get at the Surface by obtaining the SurfaceView’s SurfaceHolder. You will learn about these things in detail in Chapter 19. For now, all you need to know is that you can hook up a SurfaceHolder to a MediaPlayer by calling MediaPlayer.setDisplay(SurfaceHolder).
Often, it is easier to play video using an instance of the VideoView class. VideoView does not interface ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access