
Adobe
mobilenation.wordpress.com
Note: This article is reprinted from a previous post on mobilenation.
In this article I'll cover two scenarios for streaming Flash video from the Flash Media Server to Flash Lite 3. The first is the simplest possible example. In the second example, I'll use script-based bandwidth detection to determine the bandwidth available to the device, and then stream the appropriate video based on that information.
Flash Lite 3 has support for streaming content from Flash Media Server. If you are assuming that it cannot offer the same level of support that is available in the desktop Flash Player, you are right. For example, you can stream content to a device with the Flash Lite 3.0 player, but not from a device with the Flash Lite 3 player to the Flash Media Server. I hope that someday soon we will be able to stream video from a cell phone to a Flash Media Server and broadcast to the world. But for now, we'll have to settle for consuming that streaming content on our Flash Lite 3-enabled devices.
The approach for creating a Flash Lite 3 application that receives streaming content from a Flash Media Server is very similar to creating that content and targeting the desktop Flash Player. I should also say that for now, you cannot create Flash Lite applications using Flex. In the future that might change, but at the time of this writing the Flex component foot print is too large for devices. For these reasons, I'll use Flash CS3 Professional and Device Central CS3 for the examples in this article.
The example we are about to create should be familiar to you if you have previously created an application that connects to the Adobe Flash Media Server. We'll use NetConnection and NetStream to create the connection and video.attachVideo() and NetStream.play() to attach and play the stream. Two notable exceptions to mobile functionality as compared to the desktop Flash Player are the lack of support for Remote SharedObjects and one-way streaming, as I mentioned earlier. For the purposes of this article, I'll focus on streaming video.
To make the most of this article, you'll need the following software and files:
You should have a basic understanding of developing applications with Flash CS3 Professional. Prior experience working with Flash Media Server and Device Central is also helpful, but not required.
Note: After downloading this example file (simpleStreamingExample.fla) in the sample files linked above, you'll need to substitute your FMS servers name or IP address in the ActionScript where it references yourserver.com. If you have installed the Flash Media Server locally, you would use either localhost or 127.0.0.1.
In addition, you'll need to substitute the name of a video file that you created and placed in the _definst_ directory under your FMS applications folder for the video file referenced as melissaInterview in the ActionScript of the simpleStreamingExample.fla file.
If you'd rather not work with your own video files, feel free to download and use the FLV files provided with the sample files. These FLV files can be found in the sample files linked above.
Nick Hippe is a Solutions Engineer in the Mobile and Devices organization for Adobe. Nick worked as a Product Specialist, Software Evangelist and Partner Enablement Engineer for Macromedia for nearly eight years. He started with Macromedia as a Generator specialist (for those who remember that product). He came to Macromedia from Golive where he worked as a demo dude (i.e. male conterpart to demo dolly).