Skip navigation
Currently Being Moderated

Cannot get OSMF to play AkamaiHD stream from SMIL file

Oct 12, 2011 12:14 PM

Tags: #video #player #osmf #smil #akamai

I have built a player that can play using this smil file fine using the akamaiHDCore library, but I cannot get OSMF to work with it.  You can see the video with the test player below. .smil


I am using the sample app SimplePlugin that has been modified to load the smil, and akamaibasicstreaming plugin.


Can someone elighten me as to what might be wrong?  It loads the smil file fine as well as the plugins, but then just does nothing.  No debug output at all.  Code Below:





public class WT08_SimplePlugin extends MovieClip






        // Plugin path

        private static const SMIL_PLUGIN:String = "org.osmf.smil.SMILPluginInfo";

        private static const BASIC_STREAMING_PLUGIN:String = "com.akamai.osmf.AkamaiBasicStreamingPluginInfo";



        // Media paths

        public static const MEDIA_PATH:String = "";


        public var player:MediaPlayer;

        public var container:MediaContainer;

        public var mediaFactory:MediaFactory;


        private var t:int = 0;






        public function WT08_SimplePlugin()


            stage.scaleMode = StageScaleMode.NO_SCALE;

            stage.align = StageAlign.TOP_LEFT;








        protected function initPlayer():void


            // Create a mediafactory instance

            mediaFactory = new MediaFactory();


            //Marker 1: Add the listeners for the plugin load call

            mediaFactory.addEventListener( MediaFactoryEvent.PLUGIN_LOAD, onPluginLoaded );

            mediaFactory.addEventListener( MediaFactoryEvent.PLUGIN_LOAD_ERROR, onPluginLoadFailed );


            //the simplified api controller for media

            player = new MediaPlayer();

            player.autoDynamicStreamSwitch = true;

            //the container (sprite) for managing display and layout

            container = new MediaContainer();           


            //Adds the container to the stage

            this.addChild( container );


            //Marker 2: Load the plugin

            loadPlugin( BASIC_STREAMING_PLUGIN );

            loadPlugin( SMIL_PLUGIN );





        private function loadPlugin( source:String ):void


            //Marker 3: Create the plugin resource using a static plugin

            var pluginResource:MediaResourceBase;

            var pluginInfoClass:Class = getDefinitionByName( source ) as Class;

            pluginResource = new PluginInfoResource( new pluginInfoClass() );



            //Marker 4: Load the plugin

            mediaFactory.loadPlugin( pluginResource );



        protected function onPluginLoaded( event:MediaFactoryEvent ):void


            trace( "onPluginLoaded()" );


            if(this.t == 1){



                this.t = 1;




        protected function onPluginLoadFailed( event:MediaFactoryEvent ):void{

            trace( "onPluginFailedLoad()" );



        protected function removeMediaFactoryEventListeners():void


            mediaFactory.removeEventListener( MediaFactoryEvent.PLUGIN_LOAD, onPluginLoaded );

            mediaFactory.removeEventListener( MediaFactoryEvent.PLUGIN_LOAD_ERROR, onPluginLoadFailed );



        protected function loadMedia():void


            //Marker 6: The pointer to the media

            var resource:URLResource = new URLResource( MEDIA_PATH );

            var element:MediaElement = mediaFactory.createMediaElement( resource );


            // Add the media element

   = element;

            container.addMediaElement( element );



  • Currently Being Moderated
    Oct 13, 2011 3:41 AM   in reply to BoozyMondango



    Please set player.autoPlay=true before adding the element to start playback.

    Can you test with another smil? Like il .



    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points