442 CHAPTER 11: Digital Video: Streaming Video, MediaPlayer, and MediaController classes
Next, I’m going to show you how easy it is to stream video, instead of using captive video assets in
Android. All you have to do is change your Uri object to reference an HTTP:// instead of an
android.resource:// in your URI data path referencing string.
Streaming Digital Video: Using HTTP URL in URI
Since Android handles all of the logistics regarding streaming video from the Internet into the
hardware device, all we as developers really have to do is to provide a correct HTTP:// URL, or
Uniform Resource Locator, in the place of the R.raw.flyover resource locator, which we have been
using up until now.
Do this by replacing the android.resource://absolute.beginners.hellouniverse/R.raw.flyover
URI path with an HTTP://www.e-bookclub/flyover.mp4 reference to an external server. This is a
gridserver that I happen to own, in this particular case. As you can see in Figure 1 1-3 6 , the Uri.parse( )
method call will accommodate an HTTP:// URL reference as easily as an android.resource:// URI
reference. That makes it easy for us to switch our URI path references!
Figure 11-35. Non-uniform scaled (and looping) video (left) and MediaController transport control (right)