OSMF Hello World in 17 lines of code

This is the most basic way to get a video playing through the Open Source Media Framwork.

Add OSMF FC1 to your class path and the class below is your document root.

 
package {
	import flash.display.Sprite;
	import org.osmf.elements.VideoElement;
	import org.osmf.media.MediaPlayer;
	import org.osmf.media.URLResource;
	public class SMILSample extends Sprite
	{
		public function SMILSample()
		{
			var mediaPlayer:MediaPlayer = new MediaPlayer();
			var resource:URLResource 	= new URLResource(FLV);
			mediaPlayer.media 			= new VideoElement(resource);
			addChild(mediaPlayer.displayObject);
		}
		public static const FLV:String = "http://mediapm.edgesuite.net/strobe/content/test/AFaerysTale_sylviaApostol_640_500_short.flv"; 
	}
}
 

Leave a Reply

You must be logged in to post a comment.