diff --git a/bigbluebutton-client/.actionScriptProperties b/bigbluebutton-client/.actionScriptProperties index 6b0e582f0394154c48b718868898acd503cf8d4e..4b034d5e4d2a2e3a779a5844c25e5da989e2a001 100755 --- a/bigbluebutton-client/.actionScriptProperties +++ b/bigbluebutton-client/.actionScriptProperties @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <actionScriptProperties mainApplicationPath="BigBlueButton.mxml" projectUUID="e8fd7907-0b65-485d-86b8-842c32a4fc48" version="6"> - <compiler additionalCompilerArguments="-locale=" autoRSLOrdering="true" copyDependentFiles="true" fteInMXComponents="false" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin" sourceFolderPath="src" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="false" useDebugRSLSwfs="true" verifyDigests="true" warn="true"> + <compiler additionalCompilerArguments="-locale=" autoRSLOrdering="false" copyDependentFiles="true" fteInMXComponents="false" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin" sourceFolderPath="src" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="false" useDebugRSLSwfs="true" verifyDigests="true" warn="true"> <compilerSourcePath> <compilerSourcePathEntry kind="1" linkType="1" path="tests/integration"/> <compilerSourcePathEntry kind="1" linkType="1" path="tests/unit"/> @@ -31,16 +31,15 @@ <application path="DeskshareStandalone.mxml"/> </applications> <modules> - <module application="src/BigBlueButton.mxml" destPath="ListenersModule.swf" optimize="true" sourcePath="src/ListenersModule.mxml"/> - <module application="src/BigBlueButton.mxml" destPath="WhiteboardModule.swf" optimize="true" sourcePath="src/WhiteboardModule.mxml"/> + <module application="src/BigBlueButton.mxml" destPath="ChatModule.swf" optimize="true" sourcePath="src/ChatModule.mxml"/> <module application="src/BigBlueButton.mxml" destPath="DeskShareModule.swf" optimize="true" sourcePath="src/DeskShareModule.mxml"/> - <module application="src/BigBlueButton.mxml" destPath="VideoconfModule.swf" optimize="true" sourcePath="src/VideoconfModule.mxml"/> + <module application="src/BigBlueButton.mxml" destPath="PhoneModule.swf" optimize="true" sourcePath="src/PhoneModule.mxml"/> <module application="src/BigBlueButton.mxml" destPath="PresentModule.swf" optimize="true" sourcePath="src/PresentModule.mxml"/> - <module application="src/BigBlueButton.mxml" destPath="ChatModule.swf" optimize="true" sourcePath="src/ChatModule.mxml"/> <module application="src/BigBlueButton.mxml" destPath="ViewersModule.swf" optimize="true" sourcePath="src/ViewersModule.mxml"/> + <module application="src/BigBlueButton.mxml" destPath="WhiteboardModule.swf" optimize="true" sourcePath="src/WhiteboardModule.mxml"/> + <module application="src/BigBlueButton.mxml" destPath="VideoconfModule.swf" optimize="true" sourcePath="src/VideoconfModule.mxml"/> <module application="src/BigBlueButton.mxml" destPath="DynamicInfoModule.swf" optimize="true" sourcePath="src/DynamicInfoModule.mxml"/> - <module application="src/BigBlueButton.mxml" destPath="PhoneModule.swf" optimize="true" sourcePath="src/PhoneModule.mxml"/> + <module application="src/BigBlueButton.mxml" destPath="ListenersModule.swf" optimize="true" sourcePath="src/ListenersModule.mxml"/> </modules> <buildCSSFiles/> </actionScriptProperties> - diff --git a/bigbluebutton-client/.flexProperties b/bigbluebutton-client/.flexProperties index a86bbec4db4884bccc329bf912709c25ee2f4a11..afb930671bcf77c496834ff0e190ffdebf61e78a 100755 --- a/bigbluebutton-client/.flexProperties +++ b/bigbluebutton-client/.flexProperties @@ -1,3 +1,2 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" toolCompile="true" useServerFlexSDK="false" version="1"/> - diff --git a/bigbluebutton-client/resources/config.xml.template b/bigbluebutton-client/resources/config.xml.template index 9528c1b9b8d7d8f26b7590d2c77545e15060cf16..801d0509e9007e4f94fa2d901a31337f669cc441 100755 --- a/bigbluebutton-client/resources/config.xml.template +++ b/bigbluebutton-client/resources/config.xml.template @@ -14,8 +14,8 @@ <module name="ViewersModule" url="ViewersModule.swf?v=VERSION" uri="rtmp://HOST/bigbluebutton" host="http://HOST/bigbluebutton/api/enter" - onAppInitEvent="LOAD" /> + <module name="ListenersModule" url="ListenersModule.swf?v=VERSION" uri="rtmp://HOST/bigbluebutton" recordingHost="http://HOST" diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/events/LoadModulesCommand.as b/bigbluebutton-client/src/org/bigbluebutton/main/events/LoadModulesCommand.as deleted file mode 100755 index f424300679e6f0b6f38a354dbb76b6c423db15a5..0000000000000000000000000000000000000000 --- a/bigbluebutton-client/src/org/bigbluebutton/main/events/LoadModulesCommand.as +++ /dev/null @@ -1,18 +0,0 @@ -package org.bigbluebutton.main.events -{ - import flash.events.Event; - - import org.bigbluebutton.main.model.ConferenceParameters; - - public class LoadModulesCommand extends Event - { - public static const LOAD_MODULES:String = "LoadAllModules"; - - public var conferenceParameters:ConferenceParameters; - - public function LoadModulesCommand(type:String) - { - super(type, true, false); - } - } -} \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/events/SuccessfulLoginEvent.as b/bigbluebutton-client/src/org/bigbluebutton/main/events/SuccessfulLoginEvent.as new file mode 100755 index 0000000000000000000000000000000000000000..7c1a3dbd4058c0e7fd38308b87f5e80890171e4b --- /dev/null +++ b/bigbluebutton-client/src/org/bigbluebutton/main/events/SuccessfulLoginEvent.as @@ -0,0 +1,19 @@ +package org.bigbluebutton.main.events +{ + import flash.events.Event; + + import org.bigbluebutton.main.model.ConferenceParameters; + import org.bigbluebutton.main.model.users.BBBUser; + + public class SuccessfulLoginEvent extends Event + { + public static const USER_LOGGED_IN:String = "SuccessfullyLoggedIn"; + + public var conferenceParameters:ConferenceParameters; + + public function SuccessfulLoginEvent(type:String) + { + super(type, true, false); + } + } +} \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/managers/ModuleManager.as b/bigbluebutton-client/src/org/bigbluebutton/main/managers/ModuleManager.as index 5d2907478fbe71da8b3956b4d2140d80a78eb335..6b2091e96f8f050cc5c6f5f94da14cdf562e4cc3 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/managers/ModuleManager.as +++ b/bigbluebutton-client/src/org/bigbluebutton/main/managers/ModuleManager.as @@ -35,6 +35,7 @@ package org.bigbluebutton.main.managers import org.bigbluebutton.main.events.ConfigurationEvent; import org.bigbluebutton.main.events.ModuleLoadEvent; import org.bigbluebutton.main.events.UserServicesEvent; + import org.bigbluebutton.main.model.ConferenceParameters; import org.bigbluebutton.main.model.ModuleDescriptor; public class ModuleManager @@ -51,7 +52,7 @@ package org.bigbluebutton.main.managers private var _modules:Dictionary = new Dictionary(); private var sorted:ArrayCollection; //The array of modules sorted by dependencies, with least dependent first - private var _user:Object; + private var _parameters:ConferenceParameters; private var _version:String; private var _localeVersion:String; private var _protocol:String; @@ -131,33 +132,6 @@ package org.bigbluebutton.main.managers _protocol = protocol; } - /** - * Set the properties of the local user who logged in. - * @param user - The properties object for the user that just logged in - * - */ - public function loggedInUser(user:Object):void { - LogUtil.debug('loggedin user ' + user.webvoiceconf); - _user = new Object(); - _user.conference = user.conference; - _user.username = user.username; - _user.userrole = user.userrole; - _user.room = user.room; - _user.authToken = user.authToken; - _user.userid = user.userid; - _user.mode = user.mode; - _user.voicebridge = user.voicebridge; - _user.webvoiceconf = user.webvoiceconf; - _user.connection = user.connection; - _user.playbackRoom = user.playbackRoom; - _user.record = user.record; - _user.welcome = user.welcome; - _user.meetingID = user.meetingID; - _user.externUserID = user.externUserID; - - Role.setRole(user.userrole); - } - public function get portTestHost():String { return _portTestHost; } @@ -192,22 +166,21 @@ package org.bigbluebutton.main.managers if (m != null) { LogUtil.debug('Starting ' + name); var bbb:IBigBlueButtonModule = m.module as IBigBlueButtonModule; - if (_user != null) { - m.addAttribute("conference", _user.conference); - m.addAttribute("username", _user.username); - m.addAttribute("userrole", _user.userrole); - m.addAttribute("room", _user.room); - m.addAttribute("authToken", _user.authToken); - m.addAttribute("userid", _user.userid); - m.addAttribute("mode", _user.mode); - m.addAttribute("connection", _user.connection); - m.addAttribute("voicebridge", _user.voicebridge); - m.addAttribute("webvoiceconf", _user.webvoiceconf); - m.addAttribute("playbackRoom", _user.playbackRoom); - m.addAttribute("record", _user.record); - m.addAttribute("welcome", _user.welcome); - m.addAttribute("meetingID", _user.meetingID); - m.addAttribute("externUserID", _user.externUserID); + if (_parameters != null) { + LogUtil.debug("LOADING_ATTRIBUTES"); + m.addAttribute("conference", _parameters.conference); + m.addAttribute("username", _parameters.username); + m.addAttribute("userrole", _parameters.role); + m.addAttribute("room", _parameters.room); + m.addAttribute("authToken", _parameters.authToken); + m.addAttribute("userid", _parameters.userid); + m.addAttribute("mode", _parameters.mode); + m.addAttribute("connection", _parameters.connection); + m.addAttribute("voicebridge", _parameters.voicebridge); + m.addAttribute("webvoiceconf", _parameters.webvoiceconf); + m.addAttribute("welcome", _parameters.welcome); + m.addAttribute("meetingID", _parameters.meetingID); + m.addAttribute("externUserID", _parameters.externUserID); } else { // Pass the mode that we got from the URL query string. @@ -238,7 +211,7 @@ package org.bigbluebutton.main.managers var m:ModuleDescriptor = getModule(name); if (m != null) { if (m.loaded) { - loadModuleResultHandler(MODULE_LOAD_READY, name); + //loadModuleResultHandler(MODULE_LOAD_READY, name); } else { LogUtil.debug('Found module ' + m.attributes.name); m.load(loadModuleResultHandler); @@ -265,7 +238,7 @@ package org.bigbluebutton.main.managers loadReadyEvent.moduleName = name; globalDispatcher.dispatchEvent(loadReadyEvent); - if (allModulesLoaded()) handleAppStart(); + if (allModulesLoaded()) startAllModules(); break; } } else { @@ -304,35 +277,16 @@ package org.bigbluebutton.main.managers globalDispatcher.dispatchEvent(e); } - public function loadAllModules():void{ + public function loadAllModules(parameters:ConferenceParameters):void{ + _parameters = parameters; + Role.setRole(parameters.role); + for (var i:int = 0; i<sorted.length; i++){ var m:ModuleDescriptor = sorted.getItemAt(i) as ModuleDescriptor; loadModule(m.getAttribute("name") as String); } } - //Start the first module (ViewersModule - still need to make this a bit more robust) - public function handleAppStart():void { - for (var i:int = 0; i<sorted.length; i++){ - var m:ModuleDescriptor = sorted.getItemAt(i) as ModuleDescriptor; - if ((m.getAttribute("name") as String) == "ViewersModule") { - startModule(m.getAttribute("name") as String); - sorted.removeItemAt(i); - } - } - } - - public function handleUserJoined():void { - var event:ConfigurationEvent = new ConfigurationEvent(ConfigurationEvent.CONFIG_EVENT); - event.helpURL = _helpURL; - LogUtil.debug("Dispatching helpURL " + _helpURL); - - globalDispatcher.dispatchEvent(event); - - startAllModules(); - - } - public function startAllModules():void{ for (var i:int = 0; i<sorted.length; i++){ var m:ModuleDescriptor = sorted.getItemAt(i) as ModuleDescriptor; @@ -396,7 +350,10 @@ package org.bigbluebutton.main.managers private function allModulesLoaded():Boolean{ for (var i:int = 0; i<sorted.length; i++){ var m:ModuleDescriptor = sorted.getItemAt(i) as ModuleDescriptor; - if (!m.loaded) return false; + if (!m.loaded){ + LogUtil.debug("Module " + (m.getAttribute("name") as String) + " has not yet been loaded"); + return false; + } } return true; } diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/maps/ApplicationEventMap.mxml b/bigbluebutton-client/src/org/bigbluebutton/main/maps/ApplicationEventMap.mxml index 13728cb4824de93e0d0ea501c229a97f65e65e63..a2a9b13e4720cbb9891654dff485e436e56518cc 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/maps/ApplicationEventMap.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/main/maps/ApplicationEventMap.mxml @@ -94,9 +94,27 @@ <MethodInvoker generator="{UserService}" method="userLoggedIn" arguments="{event}" /> </EventHandlers> - <EventHandlers type="{LoadModulesCommand.LOAD_MODULES}" > - <MethodInvoker generator="{ModulesProxy}" method="startModulesLoading" arguments="{event}" /> + <EventHandlers type="{SuccessfulLoginEvent.USER_LOGGED_IN}" > + <MethodInvoker generator="{ModulesProxy}" method="loadAllModules" arguments="{event}" /> </EventHandlers> + + <!-- Viewers Stuff --> + <EventHandlers type="{RaiseHandEvent.RAISE_HAND}" > + <MethodInvoker generator="{UserService}" method="raiseHand" arguments="{event}" /> + </EventHandlers> + + <EventHandlers type="{LowerHandEvent.LOWER_HAND_EVENT}" > + <MethodInvoker generator="{UserService}" method="lowerHand" arguments="{event}" /> + </EventHandlers> + + <EventHandlers type="{BroadcastStartedEvent.BROADCAST_STARTED_EVENT}" > + <MethodInvoker generator="{UserService}" method="addStream" arguments="{event}" /> + </EventHandlers> + + <EventHandlers type="{BroadcastStoppedEvent.BROADCAST_STOPPED}" > + <MethodInvoker generator="{UserService}" method="removeStream" arguments="{event}" /> + </EventHandlers> + <!-- End Viewers Stuff --> <mx:Script> <![CDATA[ @@ -104,7 +122,7 @@ import org.bigbluebutton.main.events.ConfigEvent; import org.bigbluebutton.main.events.ConnectedEvent; - import org.bigbluebutton.main.events.LoadModulesCommand; + import org.bigbluebutton.main.events.SuccessfulLoginEvent; import org.bigbluebutton.main.events.LogoutEvent; import org.bigbluebutton.main.events.ModeEvent; import org.bigbluebutton.main.events.ModuleEvent; @@ -115,6 +133,10 @@ import org.bigbluebutton.main.model.ModulesProxy; import org.bigbluebutton.main.model.PortTestProxy; import org.bigbluebutton.main.model.users.UserService; + import org.bigbluebutton.main.model.users.events.BroadcastStartedEvent; + import org.bigbluebutton.main.model.users.events.BroadcastStoppedEvent; + import org.bigbluebutton.main.model.users.events.LowerHandEvent; + import org.bigbluebutton.main.model.users.events.RaiseHandEvent; import org.bigbluebutton.main.model.users.events.UsersConnectionEvent; import org.bigbluebutton.modules.viewers.events.LoginSuccessEvent; ]]> diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/maps/CrossModuleEventMap.mxml b/bigbluebutton-client/src/org/bigbluebutton/main/maps/CrossModuleEventMap.mxml index 92ffaddf276644845e31b1ffb5005cee7fd6989f..5a9cfef499631e1709810cdeb5d3da44d2924ef9 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/maps/CrossModuleEventMap.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/main/maps/CrossModuleEventMap.mxml @@ -40,16 +40,11 @@ TypeError: Error #1034: Type Coercion failed: cannot convert org.bigbluebutton.m import org.bigbluebutton.modules.present.events.NavigationEvent; import org.bigbluebutton.modules.present.events.PresentationEvent; import org.bigbluebutton.modules.present.events.WindowResizedEvent; - import org.bigbluebutton.modules.videoconf.events.BroadcastStartedEvent; - import org.bigbluebutton.modules.videoconf.events.BroadcastStoppedEvent; - import org.bigbluebutton.modules.viewers.events.RoleChangeEvent; import org.bigbluebutton.modules.viewers.events.StreamStartedEvent; import org.bigbluebutton.modules.viewers.events.ViewCameraEvent; ]]> </mx:Script> - <Listener type="{BroadcastStartedEvent.BROADCAST_STARTED_EVENT}" /> - <Listener type="{BroadcastStoppedEvent.BROADCAST_STOPPED}" /> <Listener type="{AddOverlayCanvasEvent}" /> <Listener type="{WindowResizedEvent}" /> <Listener type="{MadePresenterEvent}" /> @@ -57,7 +52,6 @@ TypeError: Error #1034: Type Coercion failed: cannot convert org.bigbluebutton.m <Listener type="{NavigationEvent}" /> <Listener type="{PresentationEvent}" /> <Listener type="{AddButtonToPresentationEvent}" /> - <Listener type="{RoleChangeEvent}" /> <Listener type="{StreamStartedEvent}" /> <Listener type="{ViewCameraEvent}" /> diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/model/ConferenceParameters.as b/bigbluebutton-client/src/org/bigbluebutton/main/model/ConferenceParameters.as index 011f9e2c9ed8aef67cfc9dd0c64f1f8520c69daf..4cc79b3ec46a9679275bebd7daf62906719d9999 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/model/ConferenceParameters.as +++ b/bigbluebutton-client/src/org/bigbluebutton/main/model/ConferenceParameters.as @@ -17,5 +17,6 @@ package org.bigbluebutton.main.model public var meetingID:String; public var externUserID:String; public var connection:NetConnection; + public var userid:Number; } } \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/model/ModuleDescriptor.as b/bigbluebutton-client/src/org/bigbluebutton/main/model/ModuleDescriptor.as index 295af86ba90573648fb1d298190a9346cbd373ee..ba08478a14b0220bc3465e24b71cb45f1629f17e 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/model/ModuleDescriptor.as +++ b/bigbluebutton-client/src/org/bigbluebutton/main/model/ModuleDescriptor.as @@ -21,9 +21,12 @@ package org.bigbluebutton.main.model { import flash.events.Event; import flash.events.ProgressEvent; + import flash.utils.Dictionary; import mx.collections.ArrayCollection; import mx.controls.Alert; + import mx.core.IFlexModuleFactory; + import mx.events.ModuleEvent; import mx.modules.ModuleLoader; import org.bigbluebutton.common.IBigBlueButtonModule; @@ -94,11 +97,11 @@ package org.bigbluebutton.main.model public function load(resultHandler:Function):void { callbackHandler = resultHandler; // loader.addEventListener("urlChanged", resultHandler); -// loader.addEventListener("loading", resultHandler); + _loader.addEventListener("loading", onLoading); _loader.addEventListener("progress", onLoadProgress); -// loader.addEventListener("setup", resultHandler); + _loader.addEventListener("setup", onSetupInfo); _loader.addEventListener("ready", onReady); -// loader.addEventListener("error", resultHandler); + _loader.addEventListener("error", onErrorLoading); // loader.addEventListener("unload", resultHandler); _loader.url = _attributes.url; LogUtil.debug("Loading " + _attributes.url); @@ -110,7 +113,7 @@ package org.bigbluebutton.main.model } private function onReady(event:Event):void { - LogUtil.debug("Module onReady Event"); + LogUtil.debug((getAttribute("name") as String) + "finished loading"); var modLoader:ModuleLoader = event.target as ModuleLoader; _module = modLoader.child as IBigBlueButtonModule; if (_module != null) { @@ -124,10 +127,23 @@ package org.bigbluebutton.main.model } private function onLoadProgress(e:ProgressEvent):void { + if ((getAttribute("name") as String) == "PresentModule") LogUtil.debug("PresentModule " + Math.round((e.bytesLoaded/e.bytesTotal) * 100) + " loaded"); callbackHandler(ModuleManager.MODULE_LOAD_PROGRESS, _attributes.name, Math.round((e.bytesLoaded/e.bytesTotal) * 100)); } + private function onErrorLoading(e:ModuleEvent):void{ + LogUtil.error("Error loading " + (getAttribute("name") as String) + e.errorText); + } + + private function onSetupInfo(e:ModuleEvent):void{ + //var info:Object = _loader.moduleFactory.info(); + } + + private function onLoading(e:Event):void{ + LogUtil.debug((getAttribute("name") as String) + " is loading"); + } + public function useProtocol(protocol:String):void { _attributes.uri = _attributes.uri.replace(/rtmp:/gi, protocol + ":"); LogUtil.debug(_attributes.name + " uri = " + _attributes.uri); diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/model/ModulesProxy.as b/bigbluebutton-client/src/org/bigbluebutton/main/model/ModulesProxy.as index 45aee06742326aafda302bf0482fc6b867d7ecda..25fbbac99bb9c85c6876f10e2ecdab077a9a8069 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/model/ModulesProxy.as +++ b/bigbluebutton-client/src/org/bigbluebutton/main/model/ModulesProxy.as @@ -25,7 +25,7 @@ package org.bigbluebutton.main.model import mx.modules.ModuleManager; import org.bigbluebutton.common.LogUtil; - import org.bigbluebutton.main.events.LoadModulesCommand; + import org.bigbluebutton.main.events.SuccessfulLoginEvent; import org.bigbluebutton.main.events.PortTestEvent; import org.bigbluebutton.main.managers.ModuleManager; import org.bigbluebutton.modules.viewers.events.LoginSuccessEvent; @@ -93,16 +93,6 @@ package org.bigbluebutton.main.model return modulesManager.portTestApplication; } - public function handleLogin(e:LoginSuccessEvent):void{ - user = e.user; - modulesManager.handleUserJoined(); - } - - public function set user(loggedInUser:Object):void { - _user = loggedInUser; - modulesManager.loggedInUser(_user); - } - public function testRTMP(e:PortTestEvent):void{ portTestProxy.connect("RTMP", getPortTestHost(), "1935", getPortTestApplication()); } @@ -112,8 +102,8 @@ package org.bigbluebutton.main.model else dispatcher.dispatchEvent(new PortTestEvent(PortTestEvent.TUNNELING_FAILED)); } - public function startModulesLoading(e:LoadModulesCommand):void{ - modulesManager.loadAllModules(); + public function loadAllModules(e:SuccessfulLoginEvent):void{ + modulesManager.loadAllModules(e.conferenceParameters); } } } \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/model/users/UserService.as b/bigbluebutton-client/src/org/bigbluebutton/main/model/users/UserService.as index b6987f9941b80706be901aecf5a6d156cb6ff26b..f0ad1184d24f0479f89e4e8053aee8c86371ddaa 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/model/users/UserService.as +++ b/bigbluebutton-client/src/org/bigbluebutton/main/model/users/UserService.as @@ -4,18 +4,23 @@ package org.bigbluebutton.main.model.users import flash.net.NetConnection; + import mx.collections.ArrayCollection; import mx.controls.Alert; - import org.bigbluebutton.main.events.LoadModulesCommand; + import org.bigbluebutton.main.events.SuccessfulLoginEvent; import org.bigbluebutton.main.events.UserServicesEvent; import org.bigbluebutton.main.model.ConferenceParameters; + import org.bigbluebutton.main.model.users.events.BroadcastStartedEvent; + import org.bigbluebutton.main.model.users.events.BroadcastStoppedEvent; import org.bigbluebutton.main.model.users.events.ConferenceCreatedEvent; + import org.bigbluebutton.main.model.users.events.LowerHandEvent; + import org.bigbluebutton.main.model.users.events.RaiseHandEvent; import org.bigbluebutton.main.model.users.events.UsersConnectionEvent; public class UserService { private var joinService:JoinService; - private var _participants:Conference; + private var _conference:Conference; private var _userSOService:UsersSOService; private var _conferenceParameters:ConferenceParameters; @@ -43,18 +48,18 @@ package org.bigbluebutton.main.model.users private function joinListener(success:Boolean, result:Object):void{ if (success) { - _participants = new Conference(); - _participants.me.name = result.username; - _participants.me.role = result.role; - _participants.me.room = result.room; - _participants.me.authToken = result.authToken; + _conference = new Conference(); + _conference.me.name = result.username; + _conference.me.role = result.role; + _conference.me.room = result.room; + _conference.me.authToken = result.authToken; _conferenceParameters = new ConferenceParameters(); _conferenceParameters.conference = result.conference; - _conferenceParameters.username = _participants.me.name; - _conferenceParameters.role = _participants.me.role; - _conferenceParameters.room = _participants.me.room; - _conferenceParameters.authToken = _participants.me.authToken; + _conferenceParameters.username = _conference.me.name; + _conferenceParameters.role = _conference.me.role; + _conferenceParameters.room = _conference.me.room; + _conferenceParameters.authToken = _conference.me.authToken; _conferenceParameters.mode = result.mode; _conferenceParameters.webvoiceconf = result.webvoiceconf; _conferenceParameters.voicebridge = result.voicebridge; @@ -64,7 +69,7 @@ package org.bigbluebutton.main.model.users _conferenceParameters.externUserID = result.externUserID; var e:ConferenceCreatedEvent = new ConferenceCreatedEvent(ConferenceCreatedEvent.CONFERENCE_CREATED_EVENT); - e.conference = _participants; + e.conference = _conference; dispatcher.dispatchEvent(e); connect(); @@ -72,17 +77,61 @@ package org.bigbluebutton.main.model.users } private function connect():void{ - _userSOService = new UsersSOService(applicationURI, _participants); + _userSOService = new UsersSOService(applicationURI, _conference); _userSOService.connect(_conferenceParameters); } public function userLoggedIn(e:UsersConnectionEvent):void{ - _participants.me.userid = e.userid; + _conference.me.userid = e.userid; _conferenceParameters.connection = e.connection; + _conferenceParameters.userid = e.userid; - var loadCommand:LoadModulesCommand = new LoadModulesCommand(LoadModulesCommand.LOAD_MODULES); + _userSOService.join(e.userid, _conferenceParameters.room); + + var loadCommand:SuccessfulLoginEvent = new SuccessfulLoginEvent(SuccessfulLoginEvent.USER_LOGGED_IN); loadCommand.conferenceParameters = _conferenceParameters; - dispatcher.dispatchEvent(loadCommand); + dispatcher.dispatchEvent(loadCommand); + } + + public function stop():void { + _userSOService.disconnect(); + } + + public function get me():BBBUser { + return _conference.me; + } + + public function isModerator():Boolean { + if (me.role == "MODERATOR") { + return true; + } + + return false; + } + + public function get participants():ArrayCollection { + return _conference.users; + } + + public function assignPresenter(assignTo:Number):void { + _userSOService.assignPresenter(assignTo, me.userid); + } + + public function addStream(e:BroadcastStartedEvent):void { + _userSOService.addStream(e.userid, e.stream); + } + + public function removeStream(e:BroadcastStoppedEvent):void { + _userSOService.removeStream(e.userid, e.stream); + } + + public function raiseHand(e:RaiseHandEvent):void { + var userid:Number = _conference.me.userid; + _userSOService.raiseHand(userid, e.raised); + } + + public function lowerHand(e:LowerHandEvent):void { + if (this.isModerator()) _userSOService.raiseHand(e.userid, false); } } } \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/model/users/UsersSOService.as b/bigbluebutton-client/src/org/bigbluebutton/main/model/users/UsersSOService.as index 5af1f37af50fbe8dd2838efdafa49f12a56b0ed2..de53bed30bf9c2b4a09e73c18040263a6b1ac338 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/model/users/UsersSOService.as +++ b/bigbluebutton-client/src/org/bigbluebutton/main/model/users/UsersSOService.as @@ -76,9 +76,9 @@ package org.bigbluebutton.main.model.users netConnectionDelegate.disconnect(); } - public function join(userid:Number) : void + public function join(userid:Number, room:String) : void { - _participantsSO = SharedObject.getRemote(SO_NAME, _applicationURI, false); + _participantsSO = SharedObject.getRemote(SO_NAME, _applicationURI + "/" + room, false); _participantsSO.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); _participantsSO.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler); _participantsSO.client = this; @@ -234,15 +234,6 @@ package org.bigbluebutton.main.model.users assignedBy ); //_netConnection.call } -/* - public function assignPresenterCallback(userid:Number, assignedBy:Number):void { - sendMessage(ViewersModuleConstants.ASSIGN_PRESENTER, {assignedTo:userid, assignedBy:assignedBy}); - } - - public function queryPresenter():void { - - } -*/ public function raiseHand(userid:Number, raise:Boolean):void { var nc:NetConnection = netConnectionDelegate.connection; diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/events/BroadcastStartedEvent.as b/bigbluebutton-client/src/org/bigbluebutton/main/model/users/events/BroadcastStartedEvent.as old mode 100644 new mode 100755 similarity index 93% rename from bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/events/BroadcastStartedEvent.as rename to bigbluebutton-client/src/org/bigbluebutton/main/model/users/events/BroadcastStartedEvent.as index 63d522d2e8eb2b75031e044b49ebbc96c27d471e..1e82674e6f345ea80c0f4d80a396fa97dace64c0 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/events/BroadcastStartedEvent.as +++ b/bigbluebutton-client/src/org/bigbluebutton/main/model/users/events/BroadcastStartedEvent.as @@ -17,7 +17,7 @@ * * $Id: $ */ - package org.bigbluebutton.modules.videoconf.events + package org.bigbluebutton.main.model.users.events { import flash.events.Event; diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/events/BroadcastStoppedEvent.as b/bigbluebutton-client/src/org/bigbluebutton/main/model/users/events/BroadcastStoppedEvent.as old mode 100644 new mode 100755 similarity index 93% rename from bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/events/BroadcastStoppedEvent.as rename to bigbluebutton-client/src/org/bigbluebutton/main/model/users/events/BroadcastStoppedEvent.as index 09a4daf5284705daa42642f2df9e1a377b37ab7c..a46db8fa5bdd6a98610913b6b18d6bbb584d17a0 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/events/BroadcastStoppedEvent.as +++ b/bigbluebutton-client/src/org/bigbluebutton/main/model/users/events/BroadcastStoppedEvent.as @@ -17,7 +17,7 @@ * * $Id: $ */ -package org.bigbluebutton.modules.videoconf.events +package org.bigbluebutton.main.model.users.events { import flash.events.Event; diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/events/LowerHandEvent.as b/bigbluebutton-client/src/org/bigbluebutton/main/model/users/events/LowerHandEvent.as similarity index 95% rename from bigbluebutton-client/src/org/bigbluebutton/modules/viewers/events/LowerHandEvent.as rename to bigbluebutton-client/src/org/bigbluebutton/main/model/users/events/LowerHandEvent.as index 6cf9f8cb0a2e9a37a704debfaf5f7a42249f2dbb..272483ceba41e82aadfe8c405e4c342f0ef88a12 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/events/LowerHandEvent.as +++ b/bigbluebutton-client/src/org/bigbluebutton/main/model/users/events/LowerHandEvent.as @@ -17,7 +17,7 @@ * * $Id: $ */ -package org.bigbluebutton.modules.viewers.events +package org.bigbluebutton.main.model.users.events { import flash.events.Event; diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/events/RaiseHandEvent.as b/bigbluebutton-client/src/org/bigbluebutton/main/model/users/events/RaiseHandEvent.as similarity index 80% rename from bigbluebutton-client/src/org/bigbluebutton/modules/viewers/events/RaiseHandEvent.as rename to bigbluebutton-client/src/org/bigbluebutton/main/model/users/events/RaiseHandEvent.as index 2891a5782414666f4dd42dcc986fcc01443a239e..55540fc9aa8a97b1d6f7bb4cbc6eb6d6e9dfe370 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/events/RaiseHandEvent.as +++ b/bigbluebutton-client/src/org/bigbluebutton/main/model/users/events/RaiseHandEvent.as @@ -1,4 +1,4 @@ -package org.bigbluebutton.modules.viewers.events +package org.bigbluebutton.main.model.users.events { import flash.events.Event; diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/view/components/MainToolbar.mxml b/bigbluebutton-client/src/org/bigbluebutton/main/view/components/MainToolbar.mxml index bb7a8a44896f826b33370fcff043e783b5c03849..d4a885671f6032740050d4d0abc0d2ac11eaf514 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/view/components/MainToolbar.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/main/view/components/MainToolbar.mxml @@ -29,7 +29,7 @@ <mate:Listener type="EndMeetingKickAllEvent" method="handleEndMeetingEvent"/> <mate:Listener type="{ConfigurationEvent.CONFIG_EVENT}" method="handleConfigurationEvent"/> - <mate:Listener type="{LoginSuccessEvent.LOGIN_SUCCESS}" method="loginSuccess" /> + <mate:Listener type="{SuccessfulLoginEvent.USER_LOGGED_IN}" method="loginSuccess" /> <mx:Script> <![CDATA[ @@ -39,8 +39,8 @@ import org.bigbluebutton.main.events.CloseWindowEvent; import org.bigbluebutton.main.events.ConfigurationEvent; import org.bigbluebutton.main.events.LogoutEvent; + import org.bigbluebutton.main.events.SuccessfulLoginEvent; import org.bigbluebutton.main.events.ToolbarButtonEvent; - import org.bigbluebutton.modules.viewers.events.LoginSuccessEvent; import org.bigbluebutton.util.i18n.ResourceUtil; private var DEFAULT_HELP_URL:String = "http://www.bigbluebutton.org/content/videos"; @@ -86,8 +86,8 @@ addedBtns.removeChild(event.button); } - private function loginSuccess(e:LoginSuccessEvent):void{ - loggedIn(e.user.username, e.user.conferenceName, e.user.userrole); + private function loginSuccess(e:SuccessfulLoginEvent):void{ + loggedIn(e.conferenceParameters.username, e.conferenceParameters.room, e.conferenceParameters.role); visible = true; } diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/business/PresentProxy.as b/bigbluebutton-client/src/org/bigbluebutton/modules/present/business/PresentProxy.as index 903042c94b4e0151a82b8cae054433bc19aec355..e3f135171936cfe2144a2edd82e02df1fdc8acd0 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/present/business/PresentProxy.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/business/PresentProxy.as @@ -25,14 +25,14 @@ package org.bigbluebutton.modules.present.business import mx.controls.Alert; + import org.bigbluebutton.common.LogUtil; + import org.bigbluebutton.main.model.users.events.RoleChangeEvent; import org.bigbluebutton.modules.present.events.PresentModuleEvent; import org.bigbluebutton.modules.present.events.PresenterCommands; import org.bigbluebutton.modules.present.events.RemovePresentationEvent; import org.bigbluebutton.modules.present.events.SlideEvent; import org.bigbluebutton.modules.present.events.UploadEvent; import org.bigbluebutton.modules.present.managers.PresentationSlides; - import org.bigbluebutton.modules.viewers.events.RoleChangeEvent; - import org.bigbluebutton.common.LogUtil; public class PresentProxy { diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/maps/PresentEventMap.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/present/maps/PresentEventMap.mxml index 7667a4a05847ce150364da97bb8b7269fb2a8884..ef1570377b335c8a3b9da497936c76c0f93e265b 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/present/maps/PresentEventMap.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/maps/PresentEventMap.mxml @@ -26,6 +26,7 @@ <![CDATA[ import mx.events.FlexEvent; + import org.bigbluebutton.main.model.users.events.RoleChangeEvent; import org.bigbluebutton.modules.present.business.PresentProxy; import org.bigbluebutton.modules.present.events.PresentModuleEvent; import org.bigbluebutton.modules.present.events.PresentationEvent; @@ -35,7 +36,6 @@ import org.bigbluebutton.modules.present.events.UploadEvent; import org.bigbluebutton.modules.present.managers.PresentManager; import org.bigbluebutton.modules.present.views.PresentationWindow; - import org.bigbluebutton.modules.viewers.events.RoleChangeEvent; ]]> </mx:Script> 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 56fda34b391d2651c962c0de8889b79dd1b9da2c..a2aea15804d21bd2899feeecfc6a139493413de7 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/maps/VideoEventMap.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/maps/VideoEventMap.mxml @@ -27,9 +27,9 @@ import org.bigbluebutton.main.events.BBBEvent; import org.bigbluebutton.main.events.OpenWindowEvent; import org.bigbluebutton.main.events.ToolbarButtonEvent; + import org.bigbluebutton.main.model.users.events.BroadcastStartedEvent; + import org.bigbluebutton.main.model.users.events.BroadcastStoppedEvent; import org.bigbluebutton.modules.videoconf.business.VideoProxy; - import org.bigbluebutton.modules.videoconf.events.BroadcastStartedEvent; - import org.bigbluebutton.modules.videoconf.events.BroadcastStoppedEvent; import org.bigbluebutton.modules.videoconf.events.CloseAllWindowsEvent; import org.bigbluebutton.modules.videoconf.events.OpenPublishWindowEvent; import org.bigbluebutton.modules.videoconf.events.StartBroadcastEvent; diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/BBBUser.as b/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/BBBUser.as deleted file mode 100755 index 812fd7be87f4998958d3b139dd4e7d0f68b3363b..0000000000000000000000000000000000000000 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/BBBUser.as +++ /dev/null @@ -1,108 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2008 by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 2.1 of the License, or (at your option) any later -* version. -* -* This program is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -*/ -package org.bigbluebutton.modules.viewers.business -{ - import com.asfusion.mate.events.Dispatcher; - - import mx.collections.ArrayCollection; - import mx.controls.Alert; - - import org.bigbluebutton.common.Role; - import org.bigbluebutton.modules.viewers.events.StreamStartedEvent; - - public class BBBUser - { - [Bindable] public var me:Boolean = false; - [Bindable] public var userid:Number; - [Bindable] public var name:String; - [Bindable] public var hasStream:Boolean = false; - [Bindable] public var streamName:String = ""; - [Bindable] public var presenter:Boolean = false; - [Bindable] public var raiseHand:Boolean = false; - [Bindable] public var role:String = Role.VIEWER; - [Bindable] public var room:String = ""; - [Bindable] public var authToken:String = ""; - - private var _status:StatusCollection = new StatusCollection(); - - public function get status():ArrayCollection { - return _status.getAll(); - } - - public function set status(s:ArrayCollection):void { - _status.status = s; - } - - public function addStatus(status:Status):void { - _status.addStatus(status); - } - - public function changeStatus(status:Status):void { - //_status.changeStatus(status); - if (status.name == "presenter") { - presenter = status.value - } - switch (status.name) { - case "presenter": - presenter = status.value; - break; - case "hasStream": - hasStream = status.value; - if (hasStream) sendStreamStartedEvent(); - break; - case "streamName": - streamName = status.value as String; - break; - case "raiseHand": - raiseHand = status.value as Boolean; - break; - } - } - - public function removeStatus(name:String):void { - _status.removeStatus(name); - } - - public function getStatus(name:String):Status { - return _status.getStatus(name); - } - - public static function copy(user:BBBUser):BBBUser { - var n:BBBUser = new BBBUser(); - n.authToken = user.authToken; - n.me = user.me; - n.userid = user.userid; - n.name = user.name; - n.hasStream = user.hasStream; - n.streamName = user.streamName; - n.presenter = user.presenter; - n.raiseHand = user.raiseHand; - n.role = user.role; - n.room = user.room; - - return n; - } - - private function sendStreamStartedEvent():void{ - var dispatcher:Dispatcher = new Dispatcher(); - dispatcher.dispatchEvent(new StreamStartedEvent(this.name, this.streamName)); - } - } -} \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/Conference.as b/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/Conference.as deleted file mode 100755 index a9828e5c6bca1351e6de1fd16357a802764dac23..0000000000000000000000000000000000000000 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/Conference.as +++ /dev/null @@ -1,188 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2008 by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 2.1 of the License, or (at your option) any later -* version. -* -* This program is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -*/ -package org.bigbluebutton.modules.viewers.business -{ - import mx.collections.ArrayCollection; - - import org.bigbluebutton.common.Role; - import org.bigbluebutton.common.LogUtil; - - public class Conference - { - private var _myUserid : Number; - - [Bindable] public var me:BBBUser = null; - [Bindable] public var users:ArrayCollection = null; - - public function Conference() : void - { - me = new BBBUser(); - users = new ArrayCollection(); - } - - /** - * Adds a user to this conference - * @param newuser - * - */ - public function addUser(newuser:BBBUser) : void - { - if (! hasParticipant(newuser.userid)) { - - if (newuser.userid == me.userid) { - newuser.me = true; - } - - users.addItem(newuser); - sort(); - } - } - - /** - * Check if the user with the specified id exists - * @param id - * @return - * - */ - public function hasParticipant(userid:Number) : Boolean - { - var p:Object = getParticipantIndex(userid); - if (p != null) { - return true; - } - - return false; - } - - public function hasOnlyOneModerator():Boolean { - var p:BBBUser; - var moderatorCount:int = 0; - - for (var i:int = 0; i < users.length; i++) - { - p = users.getItemAt(i) as BBBUser; - if (p.role == Role.MODERATOR) { - moderatorCount++; - } - } - - if (moderatorCount == 1) return true; - return false; - } - - public function getTheOnlyModerator():BBBUser { - var p:BBBUser; - for (var i:int = 0; i < users.length; i++) - { - p = users.getItemAt(i) as BBBUser; - if (p.role == Role.MODERATOR) { - return BBBUser.copy(p); - } - } - - return null; - } - - /** - * Get the user with the specific id - * @param id - * @return - * - */ - public function getParticipant(userid:Number) : BBBUser - { - var p:Object = getParticipantIndex(userid); - if (p != null) { - return p.participant as BBBUser; - } - - return null; - } - - /** - * Remove participant with the specified id number - * @param userid - * - */ - public function removeParticipant(userid:Number) : void - { - var p:Object = getParticipantIndex(userid); - if (p != null) { - LogUtil.debug("removing user[" + p.participant.name + "," + p.participant.userid + "]"); - users.removeItemAt(p.index); - sort(); - } - } - - /** - * Get the index number of the participant with the specific userid - * @param userid - * @return -1 if participant not found - * - */ - private function getParticipantIndex(userid:Number):Object - { - var aUser : BBBUser; - - for (var i:int = 0; i < users.length; i++) - { - aUser = users.getItemAt(i) as BBBUser; - - if (aUser.userid == userid) { - return {index:i, participant:aUser}; - } - } - - // Participant not found. - return null; - } - - /** - * Removes all the participants from the conference - * - */ - public function removeAllParticipants() : void - { - users.removeAll(); - } - - public function newUserStatus(id:Number, status:String, value:Object):void - { - var aUser:BBBUser = getParticipant(id); - - if (aUser != null) { - var s:Status = new Status(status, value); - aUser.changeStatus(s); - } - - sort(); - } - - /** - * Sorts the users by name - * - */ - private function sort():void - { - users.source.sortOn("name", Array.CASEINSENSITIVE); - users.refresh(); - } - } -} \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/JoinService.as b/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/JoinService.as deleted file mode 100755 index fa5ab90b8b042138678f1a8f1f7e1ac68dd0bc4d..0000000000000000000000000000000000000000 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/JoinService.as +++ /dev/null @@ -1,76 +0,0 @@ -/* - * BigBlueButton - http://www.bigbluebutton.org - * - * Copyright (c) 2008-2009 by respective authors (see below). All rights reserved. - * - * BigBlueButton is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 3 of the License, or (at your option) any later - * version. - * - * BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License along - * with BigBlueButton; if not, If not, see <http://www.gnu.org/licenses/>. - * - * $Id: $ - */ -package org.bigbluebutton.modules.viewers.business -{ - import flash.events.*; - import flash.net.URLLoader; - import flash.net.URLRequest; - import flash.net.URLRequestMethod; - import flash.net.URLVariables; - import org.bigbluebutton.common.LogUtil; - - public class JoinService - { - private var request:URLRequest = new URLRequest(); - private var vars:URLVariables = new URLVariables(); - - private var urlLoader:URLLoader; - private var _resultListener:Function; - - public function JoinService() - { - } - - public function load(url:String) : void - { - LogUtil.debug("JoinService:load(...) " + url); - - request = new URLRequest(url); - request.method = URLRequestMethod.GET; - - urlLoader = new URLLoader(); - urlLoader.addEventListener(Event.COMPLETE, handleComplete); - urlLoader.load(request); - } - - public function addJoinResultListener(listener:Function):void { - _resultListener = listener; - } - - private function handleComplete(e:Event):void { - var xml:XML = new XML(e.target.data) - - var returncode:String = xml.returncode; - if (returncode == 'FAILED') { - LogUtil.debug("Join FAILED = " + xml); - _resultListener(false, {message:xml.message}); - } else if (returncode == 'SUCCESS') { - LogUtil.debug("Join SUCESS = " + xml); - var user:Object = {username:xml.fullname, conference:xml.conference, conferenceName:xml.confname, - meetingID:xml.meetingID, externUserID:xml.externUserID, - role:xml.role, room:xml.room, authToken:xml.room, record:xml.record, - webvoiceconf:xml.webvoiceconf, - voicebridge:xml.voicebridge, mode:xml.mode, welcome:xml.welcome}; - _resultListener(true, user); - } - - } - } -} \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/NetConnectionDelegate.as b/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/NetConnectionDelegate.as deleted file mode 100755 index 30b8899e232da5919e50a61b92a935ff9f42d344..0000000000000000000000000000000000000000 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/NetConnectionDelegate.as +++ /dev/null @@ -1,254 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2008 by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 2.1 of the License, or (at your option) any later -* version. -* -* This program is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -*/ -package org.bigbluebutton.modules.viewers.business -{ - import com.asfusion.mate.events.Dispatcher; - - import flash.events.*; - import flash.net.NetConnection; - import flash.net.Responder; - import flash.utils.Timer; - - import mx.controls.Alert; - - import org.bigbluebutton.common.LogUtil; - import org.bigbluebutton.modules.viewers.events.ConnectionFailedEvent; - import org.bigbluebutton.modules.viewers.events.ViewersConnectionEvent; - - public class NetConnectionDelegate - { - public static const NAME:String = "NetConnectionDelegate"; - - public static const CONNECT_SUCCESS:String = "NetConnection.Connect.Success"; - public static const CONNECT_FAILED:String = "NetConnection.Connect.Failed"; - public static const CONNECT_CLOSED:String = "NetConnection.Connect.Closed"; - public static const INVALID_APP:String = "NetConnection.Connect.InvalidApp"; - public static const APP_SHUTDOWN:String = "NetConnection.Connect.AppShutDown"; - public static const CONNECT_REJECTED:String = "NetConnection.Connect.Rejected"; - - private var _netConnection:NetConnection; - private var connectionId:Number; - private var connected:Boolean = false; - - private var _userid:Number = -1; - private var _role:String = "unknown"; - private var _module:ViewersModule; - - // These two are just placeholders. We'll get this from the server later and - // then pass to other modules. - private var _authToken:String = "AUTHORIZED"; - private var _room:String; - private var tried_tunneling:Boolean = false; - - private var dispatcher:Dispatcher; - - public function NetConnectionDelegate(m:ViewersModule) : void - { - _module = m; - dispatcher = new Dispatcher(); - } - - public function get connection():NetConnection { - return _netConnection; - } - - /** - * Connect to the server. - * uri: The uri to the conference application. - * username: Fullname of the participant. - * role: MODERATOR/VIEWER - * conference: The conference room - * mode: LIVE/PLAYBACK - Live:when used to collaborate, Playback:when being used to playback a recorded conference. - * room: Need the room number when playing back a recorded conference. When LIVE, the room is taken from the URI. - */ - public function connect(username:String, role:String, conference:String, mode:String, room:String, externUserID:String, tunnel:Boolean=false):void - { - tried_tunneling = tunnel; - _netConnection = new NetConnection(); - _netConnection.client = this; - _netConnection.addEventListener( NetStatusEvent.NET_STATUS, netStatus ); - _netConnection.addEventListener( AsyncErrorEvent.ASYNC_ERROR, netASyncError ); - _netConnection.addEventListener( SecurityErrorEvent.SECURITY_ERROR, netSecurityError ); - _netConnection.addEventListener( IOErrorEvent.IO_ERROR, netIOError ); - - try { - var uri:String = _module.uri; -// if (tunnel) { -// uri = uri.replace(/rtmp:/g, "rtmpt:"); -// } - - LogUtil.debug(NAME + "::Connecting to " + uri + " [" + username + "," + role + "," + conference + - "," + mode + "," + room + "]"); - _netConnection.connect(uri, username, role, conference, mode, room, _module.voicebridge, _module.record, externUserID); - - } catch( e : ArgumentError ) { - // Invalid parameters. - switch ( e.errorID ) - { - case 2004 : - LogUtil.debug("Error! Invalid server location: " + uri); - break; - default : - LogUtil.debug("UNKNOWN Error! Invalid server location: " + uri); - break; - } - } - } - - public function disconnect() : void - { - _netConnection.close(); - } - - protected function netStatus( event : NetStatusEvent ) : void - { - handleResult( event ); - } - - public function handleResult( event : Object ) : void { - var info : Object = event.info; - var statusCode : String = info.code; - - switch ( statusCode ) - { - case CONNECT_SUCCESS : - LogUtil.debug(NAME + ":Connection to viewers application succeeded."); - _netConnection.call( - "getMyUserId",// Remote function name - new Responder( - // result - On successful result - function(result:Object):void { - LogUtil.debug("Successful result: " + result); - _userid = Number(result); - if (_userid >= 0) { - sendConnectionSuccessEvent(_userid); - } - }, - // status - On error occurred - function(status:Object):void { - LogUtil.error("Error occurred:"); - for (var x:Object in status) { - LogUtil.error(x + " : " + status[x]); - } - } - )//new Responder - ); //_netConnection.call - - break; - - case CONNECT_FAILED : - if (tried_tunneling) { - LogUtil.debug(NAME + ":Connection to viewers application failed...even when tunneling"); - sendConnectionFailedEvent(ConnectionFailedEvent.CONNECTION_FAILED); - } else { - disconnect(); - _netConnection = null; - LogUtil.debug(NAME + ":Connection to viewers application failed...try tunneling"); - var rtmptRetryTimer:Timer = new Timer(1000, 1); - rtmptRetryTimer.addEventListener("timer", rtmptRetryTimerHandler); - rtmptRetryTimer.start(); - } - break; - - case CONNECT_CLOSED : - LogUtil.debug(NAME + ":Connection to viewers application closed"); - sendConnectionFailedEvent(ConnectionFailedEvent.CONNECTION_CLOSED); - break; - - case INVALID_APP : - LogUtil.debug(NAME + ":viewers application not found on server"); - sendConnectionFailedEvent(ConnectionFailedEvent.INVALID_APP); - break; - - case APP_SHUTDOWN : - LogUtil.debug(NAME + ":viewers application has been shutdown"); - sendConnectionFailedEvent(ConnectionFailedEvent.APP_SHUTDOWN); - break; - - case CONNECT_REJECTED : - LogUtil.debug(NAME + ":Connection to the server rejected. Uri: " + _module.uri + ". Check if the red5 specified in the uri exists and is running" ); - sendConnectionFailedEvent(ConnectionFailedEvent.CONNECTION_REJECTED); - break; - - default : - LogUtil.debug(NAME + ":Default status to the viewers application" ); - sendConnectionFailedEvent(ConnectionFailedEvent.UNKNOWN_REASON); - break; - } - } - - private function rtmptRetryTimerHandler(event:TimerEvent):void { - LogUtil.debug(NAME + "rtmptRetryTimerHandler: " + event); - connect(_module.username, _module.role, _module.conference, _module.mode, _module.room, _module.externUserID, true); - } - - private function sendFailReason(reason:String):void{ - //ViewersFacade.getInstance().sendNotification(ViewersModuleConstants.LOGIN_FAILED, reason); - var e:ConnectionFailedEvent = new ConnectionFailedEvent(); - e.reason = reason; - dispatcher.dispatchEvent(e); - } - - - protected function netSecurityError( event : SecurityErrorEvent ) : void - { - LogUtil.debug("Security error - " + event.text); - sendConnectionFailedEvent(ConnectionFailedEvent.UNKNOWN_REASON); - } - - protected function netIOError( event : IOErrorEvent ) : void - { - LogUtil.debug("Input/output error - " + event.text); - sendConnectionFailedEvent(ConnectionFailedEvent.UNKNOWN_REASON); - } - - protected function netASyncError( event : AsyncErrorEvent ) : void - { - LogUtil.debug("Asynchronous code error - " + event.error ); - sendConnectionFailedEvent(ConnectionFailedEvent.UNKNOWN_REASON); - } - - /** - * Callback from server - */ - public function setUserId(id:Number, role:String):String - { - LogUtil.debug( "ViewersNetDelegate::setConnectionId: id=[" + id + "," + role + "]"); - if (isNaN(id)) return "FAILED"; - - // We should be receiving authToken and room from the server here. - _userid = id; - return "OK"; - } - - private function sendConnectionSuccessEvent(userid:int):void{ - var e:ViewersConnectionEvent = new ViewersConnectionEvent(ViewersConnectionEvent.CONNECTION_SUCCESS); - e.connection = _netConnection; - e.userid = userid; - dispatcher.dispatchEvent(e); - } - - private function sendConnectionFailedEvent(reason:String):void{ - var e:ConnectionFailedEvent = new ConnectionFailedEvent(); - e.reason = reason; - dispatcher.dispatchEvent(e); - } - } -} \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/Status.as b/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/Status.as deleted file mode 100755 index 07f567e85f6d75df87cde600ff020867ebcc5e8d..0000000000000000000000000000000000000000 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/Status.as +++ /dev/null @@ -1,34 +0,0 @@ -/* - * BigBlueButton - http://www.bigbluebutton.org - * - * Copyright (c) 2008-2009 by respective authors (see below). All rights reserved. - * - * BigBlueButton is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 3 of the License, or (at your option) any later - * version. - * - * BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License along - * with BigBlueButton; if not, If not, see <http://www.gnu.org/licenses/>. - * - * $Id: $ - */ -package org.bigbluebutton.modules.viewers.business -{ - public class Status - { - public var name:String; - public var value:Object; - - public function Status(name:String, value:Object) - { - this.name = name; - this.value = value; - } - - } -} \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/StatusCollection.as b/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/StatusCollection.as deleted file mode 100755 index c80b8be69605e2a36cf2e4639d2d76842bcff445..0000000000000000000000000000000000000000 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/StatusCollection.as +++ /dev/null @@ -1,106 +0,0 @@ -/** -* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ -* -* Copyright (c) 2008 by respective authors (see below). -* -* This program is free software; you can redistribute it and/or modify it under the -* terms of the GNU Lesser General Public License as published by the Free Software -* Foundation; either version 2.1 of the License, or (at your option) any later -* version. -* -* This program is distributed in the hope that it will be useful, but WITHOUT ANY -* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A -* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -*/ -package org.bigbluebutton.modules.viewers.business -{ - import mx.collections.ArrayCollection; - - public class StatusCollection - { - private var _status:ArrayCollection; - - public function StatusCollection() - { - _status = new ArrayCollection(); - } - - public function set status(s:ArrayCollection):void { - _status = s; - } - - public function addStatus(status:Status):void - { - if (! hasStatus(status.name)) { - _status.addItem(status); - } - } - - public function hasStatus(name:String):Boolean - { - var index:int = getStatusIndex(name); - - if (index > -1) { - return true; - } - return false; - } - - public function changeStatus(status:Status):void { - if (hasStatus(status.name)) { - var s:Status = getStatus(status.name) - s = status; - } - } - - public function getStatus(name:String):Status - { - var index:int = getStatusIndex(name); - - if (index > -1) { - return _status.getItemAt(index) as Status; - } - - return null; - } - - public function removeStatus(name:String):void - { - var index : int = getStatusIndex(name); - - if (index > -1) { - _status.removeItemAt(index); - } - } - - private function getStatusIndex(name:String):int - { - for (var i:int=0;i<_status.length;i++) - { - var s:Status = _status.getItemAt(i) as Status; - - if (s.name == name) { - return i; - } - } - - // Stream not found. - return -1; - } - - public function removeAll():void - { - _status.removeAll(); - } - - public function getAll():ArrayCollection - { - return _status; - } - } -} \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/ViewersProxy.as b/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/ViewersProxy.as deleted file mode 100755 index a1fa6ea94225bf47ea6638d16a3300cae1a1889f..0000000000000000000000000000000000000000 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/ViewersProxy.as +++ /dev/null @@ -1,182 +0,0 @@ -/* - * BigBlueButton - http://www.bigbluebutton.org - * - * Copyright (c) 2008-2009 by respective authors (see below). All rights reserved. - * - * BigBlueButton is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 3 of the License, or (at your option) any later - * version. - * - * BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License along - * with BigBlueButton; if not, If not, see <http://www.gnu.org/licenses/>. - * - * $Id: $ - */ -package org.bigbluebutton.modules.viewers.business -{ - import com.asfusion.mate.events.Dispatcher; - - import flash.net.NetConnection; - - import mx.collections.ArrayCollection; - import mx.controls.Alert; - - import org.bigbluebutton.common.LogUtil; - import org.bigbluebutton.main.events.BBBEvent; - import org.bigbluebutton.modules.videoconf.events.BroadcastStartedEvent; - import org.bigbluebutton.modules.videoconf.events.BroadcastStoppedEvent; - import org.bigbluebutton.modules.viewers.events.ConferenceCreatedEvent; - import org.bigbluebutton.modules.viewers.events.ConnectionFailedEvent; - import org.bigbluebutton.modules.viewers.events.LowerHandEvent; - import org.bigbluebutton.modules.viewers.events.RaiseHandEvent; - import org.bigbluebutton.modules.viewers.events.ViewersConnectionEvent; - import org.bigbluebutton.modules.viewers.events.ViewersModuleEndEvent; - import org.bigbluebutton.modules.viewers.events.ViewersModuleStartedEvent; - - public class ViewersProxy - { - private var module:ViewersModule; - private var _viewersService:ViewersSOService; - private var _participants:Conference = null; - private var joinService:JoinService; - - private var isPresenter:Boolean = false; - - private var dispatcher:Dispatcher; - - public function ViewersProxy(){ - dispatcher = new Dispatcher(); - } - - public function join(e:ViewersModuleStartedEvent):void { - module = e.module; - - LogUtil.debug("ViewersProxy" + "::joining in "); - joinService = new JoinService(); - joinService.addJoinResultListener(joinListener); - joinService.load(module.host); - } - - private function joinListener(success:Boolean, result:Object):void { - LogUtil.debug("Got join result"); - if (success) { - LogUtil.debug("ViewersProxy" + '::Sending ViewersModuleConstants.JOIN_SUCCESS' + result.role); - _participants = new Conference(); - _participants.me.name = result.username; - _participants.me.role = result.role; - _participants.me.room = result.room; - _participants.me.authToken = result.authToken; - - module.conference = result.conference; - module.username = _participants.me.name; - module.role = _participants.me.role; - module.room = _participants.me.room; - module.authToken = _participants.me.authToken; - module.mode = result.mode; - module.webvoiceconf = result.webvoiceconf; - module.voicebridge = result.voicebridge; - module.conferenceName = result.conferenceName; - module.welcome = result.welcome; - module.meetingID = result.meetingID; - module.externUserID = result.externUserID; - - if (result.record == 'true') { - module.record = true; - } else { - module.record = false; - } - - var e:ConferenceCreatedEvent = new ConferenceCreatedEvent(ConferenceCreatedEvent.CONFERENCE_CREATED_EVENT); - e.conference = _participants; - dispatcher.dispatchEvent(e); - - connect(); - } else { - LogUtil.debug("ViewersProxy" + '::Sending ViewersModuleConstants.JOIN_FAILED'); - var connectionEvent:ConnectionFailedEvent = new ConnectionFailedEvent(); - connectionEvent.reason = ConnectionFailedEvent.UNKNOWN_REASON; - dispatcher.dispatchEvent(connectionEvent); - } - } - - public function connect():void { - _viewersService = new ViewersSOService(module, _participants); - LogUtil.debug("ViewersProxy" + '::' + module.username + "," + module.role); - _viewersService.connect(module.username, module.role, module.conference, module.mode, module.room, module.externUserID); - } - - public function connectSharedObjects(e:ViewersConnectionEvent):void{ - _viewersService.join(e.userid); - } - - public function stop(e:ViewersModuleEndEvent):void { - _viewersService.disconnect(); - } - - public function get me():BBBUser { - return _participants.me; - } - - public function isModerator():Boolean { - if (me.role == "MODERATOR") { - return true; - } - - return false; - } - - public function get participants():ArrayCollection { - return _participants.users; - } - - public function assignPresenter(assignTo:Number):void { - _viewersService.assignPresenter(assignTo, me.userid); - } - - public function addStream(e:BroadcastStartedEvent):void { - _viewersService.addStream(e.userid, e.stream); - } - - public function removeStream(e:BroadcastStoppedEvent):void { - _viewersService.removeStream(e.userid, e.stream); - } - - public function raiseHand(e:RaiseHandEvent):void { - var userid:Number = _participants.me.userid; - _viewersService.raiseHand(userid, e.raised); - } - - public function lowerHand(e:LowerHandEvent):void { - if (this.isModerator()) _viewersService.raiseHand(e.userid, false); - } - - public function queryPresenter():void { -// _viewersService.queryPresenter(); - } - - private function connectionStatusListener(connected:Boolean, reason:String = null):void { - if (connected) { - // Set the module.userid, _participants.me.userid in the ViewersSOService. - module.userid = _participants.me.userid; - //sendNotification(ViewersModuleConstants.LOGGED_IN); - new Dispatcher().dispatchEvent(new BBBEvent(BBBEvent.LOGIN_EVENT)); - //new Dispatcher().dispatchEvent(new BBBMessageEvent(BBBMessageEvent.MESSAGE_EVENT, "test")); - } else { - _participants = null; - var connectionEvent:ConnectionFailedEvent = new ConnectionFailedEvent(); - connectionEvent.reason = ConnectionFailedEvent.UNKNOWN_REASON; - dispatcher.dispatchEvent(connectionEvent); - } - } - - public function get connection():NetConnection - { - return _viewersService.connection; - } - } -} \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/ViewersSOService.as b/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/ViewersSOService.as deleted file mode 100755 index 7430c745dab256eff4083cf1690b4fc55b9e47f4..0000000000000000000000000000000000000000 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/business/ViewersSOService.as +++ /dev/null @@ -1,461 +0,0 @@ -/* - * BigBlueButton - http://www.bigbluebutton.org - * - * Copyright (c) 2008-2009 by respective authors (see below). All rights reserved. - * - * BigBlueButton is free software; you can redistribute it and/or modify it under the - * terms of the GNU Lesser General Public License as published by the Free Software - * Foundation; either version 3 of the License, or (at your option) any later - * version. - * - * BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License along - * with BigBlueButton; if not, If not, see <http://www.gnu.org/licenses/>. - * - * $Id: $ - */ -package org.bigbluebutton.modules.viewers.business -{ - import com.asfusion.mate.events.Dispatcher; - - import flash.events.AsyncErrorEvent; - import flash.events.NetStatusEvent; - import flash.net.NetConnection; - import flash.net.Responder; - import flash.net.SharedObject; - - import mx.controls.Alert; - - import org.bigbluebutton.common.LogUtil; - import org.bigbluebutton.main.events.BBBEvent; - import org.bigbluebutton.main.events.ParticipantJoinEvent; - import org.bigbluebutton.main.events.PresenterStatusEvent; - import org.bigbluebutton.main.model.User; - import org.bigbluebutton.modules.viewers.events.ConnectionFailedEvent; - import org.bigbluebutton.modules.viewers.events.RoleChangeEvent; - - public class ViewersSOService - { - public static const NAME:String = "ViewersSOService"; - public static const LOGNAME:String = "[ViewersSOService]"; - - private var _participantsSO : SharedObject; - private static const SO_NAME : String = "participantsSO"; - private static const STATUS:String = "_STATUS"; - - private var netConnectionDelegate: NetConnectionDelegate; - - private var _participants:Conference; - private var _mode:String; - private var _room:String; - - private var _module:ViewersModule; - - private var dispatcher:Dispatcher; - - public function ViewersSOService(m:ViewersModule, participants:Conference) - { - _module = m; - _participants = participants; - netConnectionDelegate = new NetConnectionDelegate(_module); - dispatcher = new Dispatcher(); - } - - public function connect(username:String, role:String, conference:String, mode:String, room:String, externUserID:String):void { - _mode = mode; - _room = room; - netConnectionDelegate.connect(username, role, conference, mode, room, externUserID); - } - - public function disconnect():void { - leave(); - netConnectionDelegate.disconnect(); - } - - public function join(userid:Number) : void - { - _participantsSO = SharedObject.getRemote(SO_NAME, _module.uri, false); - _participantsSO.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); - _participantsSO.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler); - _participantsSO.client = this; - _participantsSO.connect(netConnectionDelegate.connection); - LogUtil.debug(LOGNAME + ":ViewersModules is connected to Shared object"); - if (_mode == 'PLAYBACK') { - startPlayback() - } else { - queryForParticipants(); - } - - _participants.me.userid = userid; - } - - private function startPlayback():void { - var nc:NetConnection = netConnectionDelegate.connection; - nc.call( - "archive.startPlayback",// Remote function name - new Responder( - // participants - On successful result - function(result:Object):void { - LogUtil.debug("Successfully started playback: "); - //notifyConnectionStatusListener(true, ViewersModuleConstants.PLAYBACK_STARTED); - }, - // status - On error occurred - function(status:Object):void { - LogUtil.error("Error occurred:"); - for (var x:Object in status) { - LogUtil.error(x + " : " + status[x]); - } - //notifyConnectionStatusListener(false, "Failed to join the conference."); - } - ),//new Responder - _module.playbackRoom - ); //_netConnection.call - } - - private function queryForParticipants():void { - var nc:NetConnection = netConnectionDelegate.connection; - nc.call( - "participants.getParticipants",// Remote function name - new Responder( - // participants - On successful result - function(result:Object):void { - LogUtil.debug("Successfully queried participants: " + result.count); - if (result.count > 0) { - for(var p:Object in result.participants) - { - participantJoined(result.participants[p]); - } - //notifyConnectionStatusListener(true, ViewersModuleConstants.QUERY_PARTICIPANTS_REPLY); - trace("Am I the only moderator?"); - LogUtil.debug("Am I the only moderator?"); - becomePresenterIfLoneModerator(); - } - - }, - // status - On error occurred - function(status:Object):void { - LogUtil.error("Error occurred:"); - for (var x:Object in status) { - LogUtil.error(x + " : " + status[x]); - } - sendConnectionFailedEvent(ConnectionFailedEvent.UNKNOWN_REASON); - } - )//new Responder - ); //_netConnection.call - } - - private function becomePresenterIfLoneModerator():void { - if (_participants.hasOnlyOneModerator()) { - trace("There is only one moderator"); - var user:BBBUser = _participants.getTheOnlyModerator(); - if (user.me) { - trace("I am the only moderator"); - var presenterEvent:RoleChangeEvent = new RoleChangeEvent(RoleChangeEvent.ASSIGN_PRESENTER); - presenterEvent.userid = user.userid; - presenterEvent.username = user.name; - dispatcher.dispatchEvent(presenterEvent); - } else { - trace("The moderator is not me"); - } - } else { - trace("I am not the only moderator"); - } - - } - - private function leave():void - { - if (_participantsSO != null) _participantsSO.close(); - } - - public function participantLeft(user:Object):void { - var participant:BBBUser = _participants.getParticipant(Number(user)); - - var p:User = new User(); - p.userid = String(participant.userid); - p.name = participant.name; - - var dispatcher:Dispatcher = new Dispatcher(); - var joinEvent:ParticipantJoinEvent = new ParticipantJoinEvent(ParticipantJoinEvent.PARTICIPANT_JOINED_EVENT); - joinEvent.participant = p; - joinEvent.join = false; - dispatcher.dispatchEvent(joinEvent); - - _participants.removeParticipant(Number(user)); - } - - public function participantJoined(joinedUser:Object):void { - var user:BBBUser = new BBBUser(); - user.userid = Number(joinedUser.userid); - user.name = joinedUser.name; - user.role = joinedUser.role; - - LogUtil.debug("User status: " + joinedUser.status.hasStream); - - LogUtil.info("Joined as [" + user.userid + "," + user.name + "," + user.role + "]"); - _participants.addUser(user); - - participantStatusChange(user.userid, "hasStream", joinedUser.status.hasStream); - participantStatusChange(user.userid, "streamName", joinedUser.status.streamName); - participantStatusChange(user.userid, "presenter", joinedUser.status.presenter); - participantStatusChange(user.userid, "raiseHand", joinedUser.status.raiseHand); - - var participant:User = new User(); - participant.userid = String(user.userid); - participant.name = user.name; - participant.isPresenter = joinedUser.status.presenter; - participant.role = user.role; - - var dispatcher:Dispatcher = new Dispatcher(); - var joinEvent:ParticipantJoinEvent = new ParticipantJoinEvent(ParticipantJoinEvent.PARTICIPANT_JOINED_EVENT); - joinEvent.participant = participant; - joinEvent.join = true; - dispatcher.dispatchEvent(joinEvent); - } - - public function logout():void { - var dispatcher:Dispatcher = new Dispatcher(); - var endMeetingEvent:BBBEvent = new BBBEvent("EndMeetingKickAllEvent"); - dispatcher.dispatchEvent(endMeetingEvent); - } - - public function participantStatusChange(userid:Number, status:String, value:Object):void { - LogUtil.debug("Received status change [" + userid + "," + status + "," + value + "]") - - _participants.newUserStatus(userid, status, value); - - if (status == "presenter"){ - var e:PresenterStatusEvent = new PresenterStatusEvent(PresenterStatusEvent.PRESENTER_NAME_CHANGE); - e.userid = userid; - var dispatcher:Dispatcher = new Dispatcher(); - dispatcher.dispatchEvent(e); - } - - } - - public function assignPresenter(userid:Number, assignedBy:Number):void { - - var nc:NetConnection = netConnectionDelegate.connection; - nc.call( - "participants.assignPresenter",// Remote function name - new Responder( - // participants - On successful result - function(result:Boolean):void { - if (result) { - LogUtil.debug("Successfully assigned presenter to: " + userid); - } - }, - // status - On error occurred - function(status:Object):void { - LogUtil.error("Error occurred:"); - for (var x:Object in status) { - LogUtil.error(x + " : " + status[x]); - } - } - ), //new Responder - userid, - assignedBy - ); //_netConnection.call - } -/* - public function assignPresenterCallback(userid:Number, assignedBy:Number):void { - sendMessage(ViewersModuleConstants.ASSIGN_PRESENTER, {assignedTo:userid, assignedBy:assignedBy}); - } - - public function queryPresenter():void { - - } -*/ - - public function raiseHand(userid:Number, raise:Boolean):void { - var nc:NetConnection = netConnectionDelegate.connection; - nc.call( - "participants.setParticipantStatus",// Remote function name - new Responder( - // participants - On successful result - function(result:Boolean):void { - - if (result) { - LogUtil.debug("Successfully assigned raise hand to: " + userid); - } - }, - // status - On error occurred - function(status:Object):void { - LogUtil.error("Error occurred:"); - for (var x:Object in status) { - LogUtil.error(x + " : " + status[x]); - } - } - ), //new Responder - userid, - "raiseHand", - raise - ); //_netConnection.call - } - - public function addStream(userid:Number, streamName:String):void { - var nc:NetConnection = netConnectionDelegate.connection; - nc.call( - "participants.setParticipantStatus",// Remote function name - new Responder( - // participants - On successful result - function(result:Boolean):void { - - if (result) { - LogUtil.debug("Successfully assigned stream to: " + userid); - } - }, - // status - On error occurred - function(status:Object):void { - LogUtil.error("Error occurred:"); - for (var x:Object in status) { - LogUtil.error(x + " : " + status[x]); - } - } - ), //new Responder - userid, - "streamName", - streamName - ); //_netConnection.call - - nc.call( - "participants.setParticipantStatus",// Remote function name - new Responder( - // participants - On successful result - function(result:Boolean):void { - - if (result) { - LogUtil.debug("Successfully assigned stream to: " + userid); - } - }, - // status - On error occurred - function(status:Object):void { - LogUtil.error("Error occurred:"); - for (var x:Object in status) { - LogUtil.error(x + " : " + status[x]); - } - } - ), //new Responder - userid, - "hasStream", - true - ); //_netConnection.call - } - - public function removeStream(userid:Number, streamName:String):void { - var nc:NetConnection = netConnectionDelegate.connection; - nc.call( - "participants.setParticipantStatus",// Remote function name - new Responder( - // participants - On successful result - function(result:Boolean):void { - - if (result) { - LogUtil.debug("Successfully assigned stream to: " + userid); - } - }, - // status - On error occurred - function(status:Object):void { - LogUtil.error("Error occurred:"); - for (var x:Object in status) { - LogUtil.error(x + " : " + status[x]); - } - } - ), //new Responder - userid, - "streamName", - "" - ); //_netConnection.call - - nc.call( - "participants.setParticipantStatus",// Remote function name - new Responder( - // participants - On successful result - function(result:Boolean):void { - - if (result) { - LogUtil.debug("Successfully removed stream to: " + userid); - } - }, - // status - On error occurred - function(status:Object):void { - LogUtil.error("Error occurred:"); - for (var x:Object in status) { - LogUtil.error(x + " : " + status[x]); - } - } - ), //new Responder - userid, - "hasStream", - false - ); //_netConnection.call - } - - private function netStatusHandler ( event : NetStatusEvent ) : void - { - var statusCode : String = event.info.code; - - switch ( statusCode ) - { - case "NetConnection.Connect.Success" : - LogUtil.debug(LOGNAME + ":Connection Success"); - sendConnectionSuccessEvent(); - break; - - case "NetConnection.Connect.Failed" : - LogUtil.debug(LOGNAME + ":Connection to viewers application failed"); - sendConnectionFailedEvent(ConnectionFailedEvent.CONNECTION_FAILED); - break; - - case "NetConnection.Connect.Closed" : - LogUtil.debug(LOGNAME + ":Connection to viewers application closed"); - sendConnectionFailedEvent(ConnectionFailedEvent.CONNECTION_CLOSED); - break; - - case "NetConnection.Connect.InvalidApp" : - LogUtil.debug(LOGNAME + ":Viewers application not found on server"); - sendConnectionFailedEvent(ConnectionFailedEvent.INVALID_APP); - break; - - case "NetConnection.Connect.AppShutDown" : - LogUtil.debug(LOGNAME + ":Viewers application has been shutdown"); - sendConnectionFailedEvent(ConnectionFailedEvent.APP_SHUTDOWN); - break; - - case "NetConnection.Connect.Rejected" : - LogUtil.debug(LOGNAME + ":No permissions to connect to the viewers application" ); - sendConnectionFailedEvent(ConnectionFailedEvent.CONNECTION_REJECTED); - break; - - default : - LogUtil.debug(LOGNAME + ":default - " + event.info.code ); - sendConnectionFailedEvent(ConnectionFailedEvent.UNKNOWN_REASON); - break; - } - } - - private function asyncErrorHandler ( event : AsyncErrorEvent ) : void - { - LogUtil.debug(LOGNAME + "participantsSO asyncErrorHandler " + event.error); - sendConnectionFailedEvent(ConnectionFailedEvent.ASYNC_ERROR); - } - - public function get connection():NetConnection - { - return netConnectionDelegate.connection; - } - - private function sendConnectionFailedEvent(reason:String):void{ - var e:ConnectionFailedEvent = new ConnectionFailedEvent(); - e.reason = reason; - dispatcher.dispatchEvent(e); - } - - private function sendConnectionSuccessEvent():void{ - //TODO - } - } -} \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/events/ConferenceCreatedEvent.as b/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/events/ConferenceCreatedEvent.as deleted file mode 100755 index badc153df4f0e10ac4bb8acfc7f3e7677123858a..0000000000000000000000000000000000000000 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/events/ConferenceCreatedEvent.as +++ /dev/null @@ -1,18 +0,0 @@ -package org.bigbluebutton.modules.viewers.events -{ - import flash.events.Event; - - import org.bigbluebutton.modules.viewers.business.Conference; - - public class ConferenceCreatedEvent extends Event - { - public static const CONFERENCE_CREATED_EVENT:String = "CONFERENCE_CREATED"; - - public var conference:Conference; - - public function ConferenceCreatedEvent(type:String) - { - super(type, true, false); - } - } -} \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/events/RoleChangeEvent.as b/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/events/RoleChangeEvent.as deleted file mode 100755 index 92c155ac5f4377fe69fd8fbe5c3c938b904a1750..0000000000000000000000000000000000000000 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/events/RoleChangeEvent.as +++ /dev/null @@ -1,17 +0,0 @@ -package org.bigbluebutton.modules.viewers.events -{ - import flash.events.Event; - - public class RoleChangeEvent extends Event - { - public static const ASSIGN_PRESENTER:String = "ASSIGN_PRESENTER"; - - public var userid:Number; - public var username:String; - - public function RoleChangeEvent(type:String) - { - super(type, true, false); - } - } -} \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/events/ViewersConnectionEvent.as b/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/events/ViewersConnectionEvent.as deleted file mode 100755 index 4b5ab21af766689b8116a81e7be3ad5595f77538..0000000000000000000000000000000000000000 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/events/ViewersConnectionEvent.as +++ /dev/null @@ -1,18 +0,0 @@ -package org.bigbluebutton.modules.viewers.events -{ - import flash.events.Event; - import flash.net.NetConnection; - - public class ViewersConnectionEvent extends Event - { - public static const CONNECTION_SUCCESS:String = "VIEWERS_CONNECTION_SUCCESS"; - - public var connection:NetConnection; - public var userid:Number; - - public function ViewersConnectionEvent(type:String) - { - super(type, true, false); - } - } -} \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/managers/ViewersManager.as b/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/managers/ViewersManager.as index 7aad13a95d228f7ebc2170b1050f8d8603a07c01..2bed8913587c111da4481520fa456bf93339a55c 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/managers/ViewersManager.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/managers/ViewersManager.as @@ -7,7 +7,6 @@ package org.bigbluebutton.modules.viewers.managers import org.bigbluebutton.main.events.CloseWindowEvent; import org.bigbluebutton.main.events.OpenWindowEvent; import org.bigbluebutton.modules.viewers.events.LoginSuccessEvent; - import org.bigbluebutton.modules.viewers.events.ViewersConnectionEvent; import org.bigbluebutton.modules.viewers.events.ViewersModuleEndEvent; import org.bigbluebutton.modules.viewers.events.ViewersModuleStartedEvent; import org.bigbluebutton.modules.viewers.views.ViewersWindow; @@ -39,22 +38,5 @@ package org.bigbluebutton.modules.viewers.managers event.window = viewersWindow; dispatcher.dispatchEvent(event); } - - public function loginSuccess(e:ViewersConnectionEvent):void{ - _module.userid = e.userid; - var user:Object = {username:_module.username, conference:_module.conference, - conferenceName:_module.conferenceName, - userrole:_module.role, room:_module.room, authToken:_module.authToken, - userid:_module.userid, connection:e.connection, - mode:_module.mode, voicebridge:_module.voicebridge, - webvoiceconf:_module.webvoiceconf, - record:_module.record, welcome:_module.welcome, - meetingID:_module.meetingID, externUserID:_module.externUserID, - playbackRoom:_module.playbackRoom}; - - var loginEvent:LoginSuccessEvent = new LoginSuccessEvent(LoginSuccessEvent.LOGIN_SUCCESS); - loginEvent.user = user; - dispatcher.dispatchEvent(loginEvent); - } } } \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/maps/ViewersEventMap.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/maps/ViewersEventMap.mxml index c54fe2b8554f0650232524e36d12d64dae0b3c3b..d8398d8c391e0f648f16019546e12c868c04c0e7 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/maps/ViewersEventMap.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/maps/ViewersEventMap.mxml @@ -4,12 +4,6 @@ <![CDATA[ import mx.events.FlexEvent; - import org.bigbluebutton.modules.videoconf.events.BroadcastStartedEvent; - import org.bigbluebutton.modules.videoconf.events.BroadcastStoppedEvent; - import org.bigbluebutton.modules.viewers.business.ViewersProxy; - import org.bigbluebutton.modules.viewers.events.LowerHandEvent; - import org.bigbluebutton.modules.viewers.events.RaiseHandEvent; - import org.bigbluebutton.modules.viewers.events.ViewersConnectionEvent; import org.bigbluebutton.modules.viewers.events.ViewersModuleEndEvent; import org.bigbluebutton.modules.viewers.events.ViewersModuleStartedEvent; import org.bigbluebutton.modules.viewers.managers.ViewersManager; @@ -17,39 +11,15 @@ </mx:Script> <EventHandlers type="{FlexEvent.PREINITIALIZE}" > - <ObjectBuilder generator="{ViewersProxy}" cache="global" /> <ObjectBuilder generator="{ViewersManager}" cache="global" /> </EventHandlers> <EventHandlers type="{ViewersModuleStartedEvent.VIEWERS_MODULE_STARTED}" > <MethodInvoker generator="{ViewersManager}" method="moduleStarted" arguments="{event}" /> - <MethodInvoker generator="{ViewersProxy}" method="join" arguments="{event}" /> </EventHandlers> <EventHandlers type="{ViewersModuleEndEvent.VIEWERS_MODULE_ENDED}" > <MethodInvoker generator="{ViewersManager}" method="moduleEnded" arguments="{event}" /> - <MethodInvoker generator="{ViewersProxy}" method="stop" arguments="{event}" /> - </EventHandlers> - - <EventHandlers type="{ViewersConnectionEvent.CONNECTION_SUCCESS}" > - <MethodInvoker generator="{ViewersProxy}" method="connectSharedObjects" arguments="{event}" /> - <MethodInvoker generator="{ViewersManager}" method="loginSuccess" arguments="{event}" /> - </EventHandlers> - - <EventHandlers type="{RaiseHandEvent.RAISE_HAND}" > - <MethodInvoker generator="{ViewersProxy}" method="raiseHand" arguments="{event}" /> - </EventHandlers> - - <EventHandlers type="{LowerHandEvent.LOWER_HAND_EVENT}" > - <MethodInvoker generator="{ViewersProxy}" method="lowerHand" arguments="{event}" /> - </EventHandlers> - - <EventHandlers type="{BroadcastStartedEvent.BROADCAST_STARTED_EVENT}" > - <MethodInvoker generator="{ViewersProxy}" method="addStream" arguments="{event}" /> - </EventHandlers> - - <EventHandlers type="{BroadcastStoppedEvent.BROADCAST_STOPPED}" > - <MethodInvoker generator="{ViewersProxy}" method="removeStream" arguments="{event}" /> </EventHandlers> </EventMap> diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/views/StatusItemRenderer.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/views/StatusItemRenderer.mxml index cb4ec6183833d374d32f763588c5df0bd6604e9a..744b03ead0dfa32ca7c0410095517718ac110e04 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/views/StatusItemRenderer.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/views/StatusItemRenderer.mxml @@ -28,12 +28,12 @@ <mx:Script> <![CDATA[ - import org.bigbluebutton.common.LogUtil; import com.asfusion.mate.events.Dispatcher; import org.bigbluebutton.common.Images; + import org.bigbluebutton.common.LogUtil; import org.bigbluebutton.main.events.BBBEvent; - import org.bigbluebutton.modules.viewers.events.LowerHandEvent; + import org.bigbluebutton.main.model.users.events.LowerHandEvent; import org.bigbluebutton.modules.viewers.events.ViewCameraEvent; import org.bigbluebutton.util.i18n.ResourceUtil; diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/views/ViewersWindow.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/views/ViewersWindow.mxml index 7e1443d84059bdbbe9c46796f5fc52ffee1900b5..284f1f44560b753a33bef3ce83c224c7726797da 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/views/ViewersWindow.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/viewers/views/ViewersWindow.mxml @@ -20,7 +20,7 @@ $Id: $ --> -<viewer:MDIWindow xmlns:mx="http://www.adobe.com/2006/mxml" +<viewer:MDIWindow xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:viewer="flexlib.mdi.containers.*" implements="org.bigbluebutton.common.IBbbModuleWindow" xmlns:mate="http://mate.asfusion.com/" @@ -42,11 +42,11 @@ import org.bigbluebutton.common.Images; import org.bigbluebutton.common.Role; import org.bigbluebutton.main.events.ParticipantJoinEvent; + import org.bigbluebutton.main.model.users.events.ConferenceCreatedEvent; + import org.bigbluebutton.main.model.users.events.RaiseHandEvent; + import org.bigbluebutton.main.model.users.events.RoleChangeEvent; import org.bigbluebutton.main.view.components.MainCanvas; import org.bigbluebutton.modules.viewers.events.ChangeStatusEvent; - import org.bigbluebutton.modules.viewers.events.ConferenceCreatedEvent; - import org.bigbluebutton.modules.viewers.events.RaiseHandEvent; - import org.bigbluebutton.modules.viewers.events.RoleChangeEvent; import org.bigbluebutton.util.i18n.ResourceUtil; [Bindable]