0 Replies Latest reply on Oct 27, 2009 8:04 AM by artdepoo

    Add player.view after VIEWABLE_CHANGE event!




      I just did the BasicPlayback example from the following tutorial, http://www.adobe.com/devnet/flash/articles/video_osmf.html.


      When I tested the example with an RTMP url only the sound of the movie was playing. After testing all possible URLs and settings I noticed that the view property was empty at the moment it was added to the stage by addChild(player.view).


      So you need to listen for the VIEWABLE_CHANGE event before adding the view.


      The good thing is that the example works on both the Wowza and Red5 Streaming server! Wich is great because the FLVPlayback Component still doesn't work with the Red5 server.


      player.addEventListener( MediaPlayerCapabilityChangeEvent.VIEWABLE_CHANGE, onViewable );
      var newURL : URL = new URL("rtmp://applicationName/folder/flv:file");
      player.source = new VideoElement( new NetLoader(), new URLResource( newURL ) );
      function onViewable( e:MediaPlayerCapabilityChangeEvent ) :void {
          if( e.enabled ) {
              addChild( player.view );
              trace('player view');
              addChild( player.view );