A (175)

(Tuis.) #1
CHAPTER 11: Digital Video: Streaming Video, MediaPlayer, and MediaController classes 443

Test the streaming video using Run As ➤ Android Application, and watch the video stream! It is
important to note that once the video streams over the network the first time, it will loop out of the
system memory thereafter.


Add a Video Transport UI Using MediaController


Finally, let’s implement your MediaController UI transport controller, the buttons used to control the
video.



  1. The first step is to use a new keyword in conjunction with the
    MediaController( ) constructor method with a passed parameter containing
    a standard Java Context object, which in this case is passed using the Java
    keyword this. This powerful code will construct a MediaController object
    we will name videoTransport.This is accomplished using the following Java
    programming construct, as shown in Figure 11-37:


videoTransport = new MediaController(this);

Figure 11-36. Streaming digital video into your Android application using an HTTP URL in the Uri.parse( ) method

Free download pdf