Skip navigation
Currently Being Moderated

OSMF autoPlay = false, what event does it trigger?

Sep 26, 2011 11:26 AM

Tags: #autoplay #osmf #mediaplayer #check_state

Hello,

 

I have enabled autoPlay=false in my player but I can't find what event is triggered so I can enable some other actions, I have listeners for:

 

playerInstance.mediaPlayer.addEventListener(PlayEvent.PLAY_STATE_CHANG E,checkState,false,0,true);

playerInstance.mediaPlayer.addEventListener(MediaPlayerStateChangeEven t.MEDIA_PLAYER_STATE_CHANGE,checkState,false,0,true);

 

but neither of them fire when the autoPlay is set to false, they fire normaly if I press play.

 

Thanks in advance.

 

Message was edited by: Mike_Dobs

 
Replies
  • Currently Being Moderated
    Sep 27, 2011 2:12 AM   in reply to Mike_Dobs

    Hi Mike,

     

    autoPlay=false will trigger the load and ready events.

     

    You can use something like this:

     

    player = new MediaPlayer();

    player.addEventListener(MediaPlayerStateChangeEvent.MEDIA_PLAYER_STATE _CHANGE, onPlayerStateChange);

     

    private function onPlayerStateChange(event:MediaPlayerStateChangeEvent):void

            {

                switch (event.state)

                {

                    case MediaPlayerState.READY:

                        {   

                             //do something when finished loading the video

                        }

                        break;

                    case MediaPlayerState.PLAYING:

                        break;

                }

            }

     

     

    Does this help?

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 27, 2011 5:41 AM   in reply to Mike_Dobs

    First and last events will not be triggered until playback starts.

     

    autoplay=true will just trigger the playback when the asset has been loaded. setting it to false is ok before adding the medialelement.

     

    Weren't you able to use my snippet of code to get the MediaPlayerState.READY?

     

    And more important: what are you trying to accomplish?

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 27, 2011 6:26 AM   in reply to Mike_Dobs

    Hi Mike,

     

    the buffering event indicates that the playback is stopped and it has switched into buffering-only mode. This is used to allow a player to show a visual indicator that the playback is stalled due to buffering

     

    Your movie is still buffering behind the scenes - take a look at the StrobeMediaPlayback buffering progress indicator for progressive media.

     

    You could take the same approach: use a small inital buffer to speed up the loading of the movie and then to increase the buffer size after your own rules. SMP sets a value large enough to prevent playback interruption for normal network conditions, but you could use your own approach - e.g, when you reach the desired buffertime level and you still have memory and you still have bytes to download, you could increase the buffer again.

     
    |
    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