HTTP Streaming in OSMF

转载:http://blog.csdn.net/lxh2808/article/details/6002603


package	
{	
	//flash imports	
	import flash.display.Sprite;
	
	//osmf imports	
	import 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 stage			
			addChild(container);					
			
			// Create the resource to play and point it to the FLV			
			var resource:URLResource = new URLResource( MEDIA_URL );
			
			// Create the MediaElement			
			var videoElement:VideoElement =  new VideoElement( resource , new HTTPStreamingNetLoader ( ) );
			
			//add the VideoElement to our container class			
			container.addMediaElement(videoElement);		
			
			
			//create the MediaPlayer instance			
			var mediaPlayer:MediaPlayer = new MediaPlayer();
			
			// Set the MediaElement on a MediaPlayer. 			
			//Because autoPlay defaults to true, playback begins immediately			
			mediaPlayer.media = videoElement;			
		}		
	}	
}


你可能感兴趣的:(HTTP Streaming in OSMF)