轉載:http://blog.csdn.net/lxh2808/article/details/6002603
package{//flash importsimport flash.display.Sprite;//osmf importsimport org.osmf.containers.MediaContainer;import org.osmf.elements.VideoElement;import org.osmf.media.MediaPlayer;import org.osmf.media.URLResource;import org.osmf.net.httpstreaming.HTTPStreamingNetLoader;public class test extends Sprite{private const MEDIA_URL : String = "http://192.168.10.36:8080/video/FlashRuntimes.mp4" ;public function test(){// Create the container class that displays the media.var container:MediaContainer = new MediaContainer();//add the MediaContainer instance to the stageaddChild(container);// Create the resource to play and point it to the FLVvar resource:URLResource = new URLResource( MEDIA_URL );// Create the MediaElementvar videoElement:VideoElement = new VideoElement( resource , new HTTPStreamingNetLoader ( ) );//add the VideoElement to our container classcontainer.addMediaElement(videoElement);//create the MediaPlayer instancevar mediaPlayer:MediaPlayer = new MediaPlayer();// Set the MediaElement on a MediaPlayer. //Because autoPlay defaults to true, playback begins immediatelymediaPlayer.media = videoElement;}}}