diff --git a/bigbluebutton-client/src/WebcamPreviewStandalone.mxml b/bigbluebutton-client/src/WebcamPreviewStandalone.mxml index 9b50050b29..bc9c2e492d 100755 --- a/bigbluebutton-client/src/WebcamPreviewStandalone.mxml +++ b/bigbluebutton-client/src/WebcamPreviewStandalone.mxml @@ -22,9 +22,9 @@ - + diff --git a/bigbluebutton-client/src/org/bigbluebutton/core/EventConstants.as b/bigbluebutton-client/src/org/bigbluebutton/core/EventConstants.as index 6adcb34a0b..d697e7dd46 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/core/EventConstants.as +++ b/bigbluebutton-client/src/org/bigbluebutton/core/EventConstants.as @@ -19,7 +19,8 @@ package org.bigbluebutton.core /** Events to External JS **/ public static const GET_MY_ROLE_RESP:String = 'GetMyRoleResponse'; - + public static const AM_I_PRESENTER_RESP:String = 'AmIPresenterQueryResponse'; + public static const USER_JOINED:String = 'UserJoinedEvent'; public static const USER_LEFT:String = 'UserLeftEvent'; public static const NEW_ROLE:String = 'NewRoleEvent'; diff --git a/bigbluebutton-client/src/org/bigbluebutton/core/events/AmIPresenterQueryEvent.as b/bigbluebutton-client/src/org/bigbluebutton/core/events/AmIPresenterQueryEvent.as new file mode 100755 index 0000000000..d65ff7b132 --- /dev/null +++ b/bigbluebutton-client/src/org/bigbluebutton/core/events/AmIPresenterQueryEvent.as @@ -0,0 +1,13 @@ +package org.bigbluebutton.core.events +{ + import flash.events.Event; + + public class AmIPresenterQueryEvent extends Event + { + public static const AM_I_PRESENTER_QUERY:String = "am I presenter query request"; + + public function AmIPresenterQueryEvent(bubbles:Boolean=true, cancelable:Boolean=false) { + super(AM_I_PRESENTER_QUERY, bubbles, cancelable); + } + } +} \ No newline at end of file diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/api/ExternalApiCallbacks.as b/bigbluebutton-client/src/org/bigbluebutton/main/api/ExternalApiCallbacks.as index eebf6b39bd..9206111378 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/api/ExternalApiCallbacks.as +++ b/bigbluebutton-client/src/org/bigbluebutton/main/api/ExternalApiCallbacks.as @@ -9,6 +9,7 @@ package org.bigbluebutton.main.api import org.bigbluebutton.common.LogUtil; import org.bigbluebutton.core.EventConstants; import org.bigbluebutton.core.UsersUtil; + import org.bigbluebutton.core.events.AmIPresenterQueryEvent; import org.bigbluebutton.core.events.CoreEvent; import org.bigbluebutton.core.managers.UserManager; import org.bigbluebutton.main.events.BBBEvent; @@ -19,8 +20,7 @@ package org.bigbluebutton.main.api { private var _dispatcher:Dispatcher; - public function ExternalApiCallbacks() - { + public function ExternalApiCallbacks() { _dispatcher = new Dispatcher(); init(); @@ -33,6 +33,8 @@ package org.bigbluebutton.main.api ExternalInterface.addCallback("joinVoiceRequest", handleJoinVoiceRequest); ExternalInterface.addCallback("getMyRoleRequestSync", handleGetMyRoleRequestSync); ExternalInterface.addCallback("getMyRoleRequestAsync", handleGetMyRoleRequestAsynch); + ExternalInterface.addCallback("amIPresenterRequestSync", handleAmIPresenterRequestSync); + ExternalInterface.addCallback("amIPresenterRequestAsync", handleAmIPresenterRequestAsync); ExternalInterface.addCallback("muteMeRequest", handleMuteMeRequest); ExternalInterface.addCallback("unmuteMeRequest", handleUnmuteMeRequest); ExternalInterface.addCallback("muteAllUsersRequest", handleMuteAllUsersRequest); @@ -45,6 +47,14 @@ package org.bigbluebutton.main.api } } + private function handleAmIPresenterRequestSync():void { + return UsersUtil.amIPresenter(); + } + + private function handleAmIPresenterRequestAsync():void { + _dispatcher.dispatchEvent(new AmIPresenterQueryEvent()); + } + private function handleGetMyUserID():String { return UsersUtil.internalUserIDToExternalUserID(UsersUtil.getMyUserID()); } @@ -75,7 +85,7 @@ package org.bigbluebutton.main.api * */ private function handleSendPublicChatRequest(fontColor:String, localeLang:String, message:String):void { - LogUtil.debug("handleSendPublicChatRequest"); + trace("handleSendPublicChatRequest"); var chatEvent:CoreEvent = new CoreEvent(EventConstants.SEND_PUBLIC_CHAT_REQ); var payload:Object = new Object(); payload.fromColor = fontColor; @@ -167,17 +177,17 @@ package org.bigbluebutton.main.api } private function handleGetMyRoleRequestAsynch():void { - LogUtil.debug("handleGetMyRoleRequestAsynch"); + trace("handleGetMyRoleRequestAsynch"); _dispatcher.dispatchEvent(new CoreEvent(EventConstants.GET_MY_ROLE_REQ)); } private function handleJoinVoiceRequest():void { - LogUtil.debug("handleJoinVoiceRequest"); + trace("handleJoinVoiceRequest"); _dispatcher.dispatchEvent(new BBBEvent(BBBEvent.JOIN_VOICE_CONFERENCE)); } private function onShareVideoCamera(publishInClient:Boolean=true):void { - LogUtil.debug("Sharing webcam: publishInClient = [" + publishInClient + "]"); + trace("Sharing webcam: publishInClient = [" + publishInClient + "]"); var event:ShareCameraRequestEvent = new ShareCameraRequestEvent(); event.publishInClient = publishInClient; diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/api/ExternalApiCalls.as b/bigbluebutton-client/src/org/bigbluebutton/main/api/ExternalApiCalls.as index 967a2c8dc5..e4bdebb2c7 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/api/ExternalApiCalls.as +++ b/bigbluebutton-client/src/org/bigbluebutton/main/api/ExternalApiCalls.as @@ -5,6 +5,7 @@ package org.bigbluebutton.main.api import org.bigbluebutton.common.LogUtil; import org.bigbluebutton.core.EventConstants; import org.bigbluebutton.core.UsersUtil; + import org.bigbluebutton.core.events.AmIPresenterQueryEvent; import org.bigbluebutton.core.events.CoreEvent; import org.bigbluebutton.core.managers.UserManager; import org.bigbluebutton.main.events.BBBEvent; @@ -12,8 +13,15 @@ package org.bigbluebutton.main.api import org.bigbluebutton.main.events.UserLeftEvent; import org.bigbluebutton.main.model.users.BBBUser; - public class ExternalApiCalls - { + public class ExternalApiCalls { + + public function handleAmIPresenterQueryEvent(event:AmIPresenterQueryEvent):void { + var payload:Object = new Object(); + payload.eventName = EventConstants.AM_I_PRESENTER_RESP; + payload.amIPresenter = UsersUtil.amIPresenter(); + broadcastEvent(payload); + } + public function handleSwitchToNewRoleEvent(event:CoreEvent):void { var payload:Object = new Object(); payload.eventName = EventConstants.NEW_ROLE; @@ -40,7 +48,7 @@ package org.bigbluebutton.main.api payload.eventName = EventConstants.USER_JOINED_VOICE; payload.userID = UsersUtil.internalUserIDToExternalUserID(event.payload.userID); - LogUtil.debug("Notifying external API that [" + UsersUtil.getUserName(event.payload.userID) + "] has joined the voice conference."); + trace("Notifying external API that [" + UsersUtil.getUserName(event.payload.userID) + "] has joined the voice conference."); broadcastEvent(payload); } @@ -51,7 +59,7 @@ package org.bigbluebutton.main.api payload.userID = UsersUtil.internalUserIDToExternalUserID(event.payload.userID); payload.muted = event.payload.muted; - LogUtil.debug("Notifying external API that [" + UsersUtil.getUserName(event.payload.userID) + "] is now muted=[" + payload.muted + "]"); + trace("Notifying external API that [" + UsersUtil.getUserName(event.payload.userID) + "] is now muted=[" + payload.muted + "]"); broadcastEvent(payload); } @@ -61,7 +69,7 @@ package org.bigbluebutton.main.api payload.userID = UsersUtil.internalUserIDToExternalUserID(event.payload.userID); payload.locked = event.payload.locked; - LogUtil.debug("Notifying external API that [" + UsersUtil.getUserName(event.payload.userID) + "] is now locked=[" + payload.locked + "]"); + trace("Notifying external API that [" + UsersUtil.getUserName(event.payload.userID) + "] is now locked=[" + payload.locked + "]"); broadcastEvent(payload); } @@ -70,7 +78,7 @@ package org.bigbluebutton.main.api payload.eventName = EventConstants.USER_LEFT_VOICE; payload.userID = UsersUtil.internalUserIDToExternalUserID(event.payload.userID); - LogUtil.debug("Notifying external API that [" + UsersUtil.getUserName(event.payload.userID) + "] has left the voice conference."); + trace("Notifying external API that [" + UsersUtil.getUserName(event.payload.userID) + "] has left the voice conference."); broadcastEvent(payload); } diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/api/maps/ExternalApiEventMap.mxml b/bigbluebutton-client/src/org/bigbluebutton/main/api/maps/ExternalApiEventMap.mxml index b4e25538e7..4e7888bf82 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/api/maps/ExternalApiEventMap.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/main/api/maps/ExternalApiEventMap.mxml @@ -24,6 +24,7 @@ + + + +