From 9d660bb4b547e724b439a2bac98e36d4ad5cbdb4 Mon Sep 17 00:00:00 2001 From: Richard Alam <ritzalam@gmail.com> Date: Fri, 19 Jan 2018 08:47:21 -0800 Subject: [PATCH] - determine video connection type --- bigbluebutton-client/src/VideoconfModule.mxml | 27 ------------ .../modules/videoconf/business/VideoProxy.as | 44 +++++++++++++++---- .../videoconf/events/VideoModuleStartEvent.as | 2 - .../modules/videoconf/maps/VideoEventMap.mxml | 2 +- .../videoconf/maps/VideoEventMapDelegate.as | 6 +-- 5 files changed, 38 insertions(+), 43 deletions(-) mode change 100644 => 100755 bigbluebutton-client/src/VideoconfModule.mxml diff --git a/bigbluebutton-client/src/VideoconfModule.mxml b/bigbluebutton-client/src/VideoconfModule.mxml old mode 100644 new mode 100755 index c7367b841a..84db72a268 --- a/bigbluebutton-client/src/VideoconfModule.mxml +++ b/bigbluebutton-client/src/VideoconfModule.mxml @@ -44,38 +44,11 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. return _moduleName; } - public function get uri():String { - return _attributes.uri + "/" + _attributes.room; - } - - public function get username():String { - return _attributes.username; - } - - public function get mode():String { - if (_attributes.mode == null) { - //_attributes.mode = "PLAYBACK" - _attributes.mode = "LIVE" - LOGGER.debug('Setting NotesModule mode: {0}', [_attributes.mode]); - } - LOGGER.debug('VideoconfVModule mode: {0}', [_attributes.mode]); - return _attributes.mode; - } - - public function get userid():String { - return _attributes.userid as String; - } - - public function get role():String { - return _attributes.userrole as String; - } - public function start(attributes:Object):void { LOGGER.debug("Starting Video Module"); _attributes = attributes; var globalDispatcher:Dispatcher = new Dispatcher(); var event:VideoModuleStartEvent = new VideoModuleStartEvent(VideoModuleStartEvent.START); - event.uri = uri; globalDispatcher.dispatchEvent(event); } diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/business/VideoProxy.as b/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/business/VideoProxy.as index c634e8a9d6..32564b27f6 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/business/VideoProxy.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/business/VideoProxy.as @@ -43,6 +43,7 @@ package org.bigbluebutton.modules.videoconf.business import org.bigbluebutton.modules.videoconf.events.StartBroadcastEvent; import org.bigbluebutton.modules.videoconf.events.StopBroadcastEvent; import org.bigbluebutton.modules.videoconf.model.VideoConfOptions; + import org.bigbluebutton.util.ConnUtil; public class VideoProxy @@ -50,14 +51,12 @@ package org.bigbluebutton.modules.videoconf.business private static const LOGGER:ILogger = getClassLogger(VideoProxy); public var videoOptions:VideoConfOptions; - private var nc:NetConnection; - private var _url:String; private var camerasPublishing:Object = new Object(); private var reconnect:Boolean = false; private var reconnecting:Boolean = false; private var dispatcher:Dispatcher = new Dispatcher(); - + private var vidoeConnUrl: String; private var numNetworkChangeCount:int = 0; private function parseOptions():void { @@ -65,13 +64,11 @@ package org.bigbluebutton.modules.videoconf.business videoOptions.parseOptions(); } - public function VideoProxy(url:String) + public function VideoProxy() { - _url = url; parseOptions(); nc = new NetConnection(); nc.objectEncoding = ObjectEncoding.AMF3; - nc.proxyType = "best"; nc.client = this; nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, onAsyncError); nc.addEventListener(IOErrorEvent.IO_ERROR, onIOError); @@ -84,7 +81,36 @@ package org.bigbluebutton.modules.videoconf.business } public function connect():void { - nc.connect(_url, UsersUtil.getInternalMeetingID(), + var options: VideoConfOptions = Options.getOptions(VideoConfOptions) as VideoConfOptions; + var pattern:RegExp = /(?P<protocol>.+):\/\/(?P<server>.+)\/(?P<app>.+)/; + var result:Array = pattern.exec(options.uri); + + + var useRTMPS: Boolean = result.protocol == ConnUtil.RTMPS; + if (BBB.initConnectionManager().isTunnelling) { + var tunnelProtocol: String = ConnUtil.RTMPT; + + if (useRTMPS) { + nc.proxyType = ConnUtil.PROXY_NONE; + tunnelProtocol = ConnUtil.RTMPS; + } + + + vidoeConnUrl = tunnelProtocol + "://" + result.server + "/" + result.app; + trace("******* VIDEO CONNECT tunnel = TRUE " + "url=" + vidoeConnUrl); + } else { + var nativeProtocol: String = ConnUtil.RTMP; + if (useRTMPS) { + nc.proxyType = ConnUtil.PROXY_BEST; + nativeProtocol = ConnUtil.RTMPS; + } + + vidoeConnUrl = nativeProtocol + "://" + result.server + "/" + result.app; + trace("******* VIDEO CONNECT tunnel = FALSE " + "url=" + vidoeConnUrl); + } + + + nc.connect(vidoeConnUrl, UsersUtil.getInternalMeetingID(), UsersUtil.getMyUserID(), LiveMeeting.inst().me.authToken); } @@ -115,7 +141,7 @@ package org.bigbluebutton.modules.videoconf.business private function onNetStatus(event:NetStatusEvent):void{ - LOGGER.debug("[{0}] for [{1}]", [event.info.code, _url]); + LOGGER.debug("[{0}] for [{1}]", [event.info.code, vidoeConnUrl]); var logData:Object = UsersUtil.initLogData(); logData.tags = ["webcam"]; logData.user.eventCode = event.info.code + "[reconnecting=" + reconnecting + ",reconnect=" + reconnect + "]"; @@ -179,7 +205,7 @@ package org.bigbluebutton.modules.videoconf.business } break; default: - LOGGER.debug("[{0}] for [{1}]", [event.info.code, _url]); + LOGGER.debug("[{0}] for [{1}]", [event.info.code, vidoeConnUrl]); break; } } diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/events/VideoModuleStartEvent.as b/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/events/VideoModuleStartEvent.as index 6f394e3c08..f82f2a746c 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/events/VideoModuleStartEvent.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/events/VideoModuleStartEvent.as @@ -24,8 +24,6 @@ package org.bigbluebutton.modules.videoconf.events { public static const START:String = "video module start event"; - public var uri:String; - public function VideoModuleStartEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false) { super(type, bubbles, cancelable); diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/maps/VideoEventMap.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/maps/VideoEventMap.mxml index 2ec35ab8d5..c681c1888a 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/maps/VideoEventMap.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/maps/VideoEventMap.mxml @@ -46,7 +46,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. <fx:Declarations> <EventHandlers type="{VideoModuleStartEvent.START}"> <ObjectBuilder generator="{VideoEventMapDelegate}" cache="global" constructorArguments="{scope.dispatcher}"/> - <MethodInvoker generator="{VideoEventMapDelegate}" method="start" arguments="{event.uri}"/> + <MethodInvoker generator="{VideoEventMapDelegate}" method="start"/> <EventAnnouncer generator="{ConnectAppEvent}" type="{ConnectAppEvent.CONNECT_VIDEO_APP}" /> </EventHandlers> diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/maps/VideoEventMapDelegate.as b/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/maps/VideoEventMapDelegate.as index 47f2d520d0..80e50ca148 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/maps/VideoEventMapDelegate.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/maps/VideoEventMapDelegate.as @@ -66,7 +66,6 @@ package org.bigbluebutton.modules.videoconf.maps private static var PERMISSION_DENIED_ERROR:String = "PermissionDeniedError"; private var options:VideoConfOptions; - private var uri:String; private var button:ToolbarPopupButton = new ToolbarPopupButton(); private var proxy:VideoProxy; @@ -98,9 +97,8 @@ package org.bigbluebutton.modules.videoconf.maps return UsersUtil.getMyUsername(); } - public function start(uri:String):void { + public function start():void { LOGGER.debug("VideoEventMapDelegate:: [{0}] Video Module Started.", [me]); - this.uri = uri; _videoDock = new VideoDock(); var windowEvent:OpenWindowEvent = new OpenWindowEvent(OpenWindowEvent.OPEN_WINDOW_EVENT); @@ -303,7 +301,7 @@ package org.bigbluebutton.modules.videoconf.maps } public function connectToVideoApp():void { - proxy = new VideoProxy(uri); + proxy = new VideoProxy(); proxy.reconnectWhenDisconnected(true); proxy.connect(); } -- GitLab