mercredi 15 juin 2016

How to find when live RTMP stream stops in ActionScript?

I've currently got the following code, where streamVideo is an FLVPlayBack component:

streamVideo.addEventListener( VideoEvent.STATE_CHANGE, onVideoStateChange );

streamVideo.isLive = true;
streamVideo.source = "rtmp://mystreamurl";

function onVideoStateChange(evt:VideoEvent):void {
  var streamVideo:FLVPlayback = evt.target as FLVPlayback;
  switch (evt.state) {
    case VideoState.CONNECTION_ERROR:
      trace( 'Connection error' );
      break;
    default:
    trace( 'Player is: ' + evt.state );
  }
}

This gives me Player is: playing when my stream comes on, but when my stream goes off, I don't get any sort of notification.

Aucun commentaire:

Enregistrer un commentaire