Videojs-swf - rtmp connect without publishing stream or disconnect

201 views Asked by At

How can I set waiting when the stream is not published. When unpublish (NetStream.Play.UnpublishNotify) set to waiting, and on publish (NetStream.Play.PublishNotify) continue play

1

There are 1 answers

0
VC.One On

I don't use Video-JS so I don't know what their code setup is doing.

Normally (without Video-JS) it's done something like this.

yourNS.addEventListener(NetStatusEvent.NET_STATUS, streamEventsHandler);

private function streamEventsHandler(evt:NetStatusEvent):void
{
    //trace(evt.info.code); //if you need to check event status as text
    if (evt.info.code == "NetStream.Play.UnpublishNotify") { yourNS.pause(); }
    if (evt.info.code == "NetStream.Play.PublishNotify") { yourNS.resume(); }
}

So now in the Video-JS code, find the part that handles NetStream events, and edit the function to pause(); or resume();.

If unsure of the real NetStream name (I just called it yourNS for example) you can try :

Instead of : yourNS.pause(); try as evt.target.pause(); or evt.target.pause();

(PS: I use evt because of the name in function parameter is (evt:NetStatusEvent):void... Check your own Video-JS function)