416 CHAPTER 11: Digital Video: Streaming Video, MediaPlayer, and MediaController classes
- Before loading the Uri object using the .parse( ) method, you’ll need to create
a /res/raw folder, which is used in Android to contain new media assets such
as digital video and digital audio which are already optimized and simply
need to be played back in their raw (unaltered) data format. Right-click on
the /res folder, select the New ➤ Folder menu sequence to open the dialog
shown on the left in Figure 11-12, and name this folder /raw.
Figure 11-12. Use a New ➤ Folder menu sequence to create a /res/raw folder, then copy the flyover asset into it
- Once you have created the folder, copy the flyover.mp4 file from the book
repository into the folder. Later on in this chapter, I will show you how I
created this digital video asset using the Terragen 3 Virtual World Creation
software package. For now, we’ll use the 480 by 800 resolution version of the
Planet Fly Over, so we can get right into our Java code! - Now you are ready to configure the planetFlyOverUri object using the
Uri.parse( ) method call and a URI reference to the flyover.mp4 digital video
asset, using the following line of Java code shown in Figure 11-13:
planetFlyOverUri = Uri.parse( "android.resource://" + getPackage() + "/" + R.raw.flyover );