我有一个 NetStream 对象,基于以下代码:
streamID = "mystreamkey";
videoURL = "rtmp://mystreamurl";
vid = new Video();
nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, onConnectionStatus);
nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
nc.client = { onBWDone: function():void{}, streamConnected: streamConnected, streamDisconnected: streamDisconnected };
nc.connect(videoURL);
...
metaListener = new Object();
metaListener.onMetaData = received_Meta;
netStreamObj.client = metaListener;
netStreamObj.play(streamID);
vid.attachNetStream(netStreamObj);
addChild(vid);
这一切都很好,我也可以netStreamObj.pause()
用来暂停直播。
但是我该如何重新启动它呢?netStreamObj.play()
不起作用 - 它需要一个参数,所以我写了这个:
netStreamObj.play(streamID);
vid.attachNetStream(netStreamObj);
但这也不起作用。
如何重新启动流,以便它连接到之前连接的实时流?