Move video NetStream creation to publish method

The NetStream is not used until the client start publishing video,
therefore the NetStream creation may be delayed.

Also, removed redundant code on NetConnection closed handler. The
StopBroadcastEvent triggers the execution of stopBroadcasting(),
that does exactly the same thing.
This commit is contained in:
Mateus Dalepiane 2015-03-19 12:30:20 -03:00
parent a06efd5490
commit 9ea7b3a7cb

View File

@ -107,17 +107,11 @@ package org.bigbluebutton.modules.videoconf.business
"Video connection has been reestablished successfully")); "Video connection has been reestablished successfully"));
reconnecting = false; reconnecting = false;
} }
ns = new NetStream(nc);
onConnectedToVideoApp(); onConnectedToVideoApp();
break; break;
case "NetConnection.Connect.Closed": case "NetConnection.Connect.Closed":
if (!logoutOnUserCommand) { if (!logoutOnUserCommand) {
if (ns != null) {
ns.attachCamera(null);
ns.close();
ns = null;
}
dispatcher.dispatchEvent(new StopBroadcastEvent()); dispatcher.dispatchEvent(new StopBroadcastEvent());
dispatcher.dispatchEvent(new ClientStatusEvent(ClientStatusEvent.WARNING_MESSAGE_EVENT, dispatcher.dispatchEvent(new ClientStatusEvent(ClientStatusEvent.WARNING_MESSAGE_EVENT,
@ -144,6 +138,7 @@ package org.bigbluebutton.modules.videoconf.business
} }
public function startPublishing(e:StartBroadcastEvent):void{ public function startPublishing(e:StartBroadcastEvent):void{
ns = new NetStream(nc);
ns.addEventListener( NetStatusEvent.NET_STATUS, onNetStatus ); ns.addEventListener( NetStatusEvent.NET_STATUS, onNetStatus );
ns.addEventListener( IOErrorEvent.IO_ERROR, onIOError ); ns.addEventListener( IOErrorEvent.IO_ERROR, onIOError );
ns.addEventListener( AsyncErrorEvent.ASYNC_ERROR, onAsyncError ); ns.addEventListener( AsyncErrorEvent.ASYNC_ERROR, onAsyncError );
@ -210,7 +205,6 @@ package org.bigbluebutton.modules.videoconf.business
ns.attachCamera(null); ns.attachCamera(null);
ns.close(); ns.close();
ns = null; ns = null;
ns = new NetStream(nc);
} }
} }