- provide API to query if presenter or not
This commit is contained in:
parent
8ae85e9dd4
commit
565fe826c1
@ -22,9 +22,9 @@
|
||||
|
||||
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
|
||||
creationComplete="onCreationComplete()"
|
||||
backgroundColor="white"
|
||||
pageTitle="BigBlueButton"
|
||||
width="100%" height="100%"
|
||||
backgroundColor="red"
|
||||
pageTitle="WebcamPreview"
|
||||
width="600" height="400"
|
||||
layout="absolute">
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
@ -67,15 +67,21 @@
|
||||
private var userID:String;
|
||||
|
||||
private function onCreationComplete():void{
|
||||
_videoHolder = new UIComponent();
|
||||
_videoHolder.width = camWidth;
|
||||
_videoHolder.height = camHeight;
|
||||
this.addChild(_videoHolder);
|
||||
// _videoHolder = new UIComponent();
|
||||
// _videoHolder.width = camWidth;
|
||||
// _videoHolder.height = camHeight;
|
||||
// this.addChild(_videoHolder);
|
||||
|
||||
this.minWidth = _minWidth;
|
||||
this.minHeight = _minHeight;
|
||||
// this.minWidth = _minWidth;
|
||||
// this.minHeight = _minHeight;
|
||||
trace('onCreationComplete');
|
||||
initExternalInterface();
|
||||
}
|
||||
|
||||
|
||||
private function initExternalInterface():void {
|
||||
trace('initExternalInterface');
|
||||
}
|
||||
|
||||
public function handleUserTalkingEvent(event:CoreEvent):void {
|
||||
if (event.message.userID == userID) {
|
||||
if (event.message.talking) {
|
||||
@ -169,5 +175,5 @@
|
||||
<mx:Text id="lblWarning" width="100%" textAlign="right" fontSize="14" fontWeight="bold" y="{this.height - lblWarning.height - 30}"
|
||||
visible="false" selectable="false" hideEffect="{dissolveOut}" showEffect="{dissolveIn}"/>
|
||||
|
||||
<mx:Label text="Fooo!"/>
|
||||
<mx:Label text="Fooo!" width="100%" height="100%" color="blue"/>
|
||||
</mx:Application>
|
||||
|
@ -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';
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import org.bigbluebutton.core.EventConstants;
|
||||
import org.bigbluebutton.core.events.AmIPresenterQueryEvent;
|
||||
import org.bigbluebutton.main.api.ExternalApiCalls;
|
||||
import org.bigbluebutton.main.events.BBBEvent;
|
||||
import org.bigbluebutton.main.events.MadePresenterEvent;
|
||||
@ -34,6 +35,10 @@
|
||||
<!--
|
||||
Listen for events we are interested to forward to the external container..
|
||||
-->
|
||||
<EventHandlers type="{AmIPresenterQueryEvent.AM_I_PRESENTER_QUERY}" >
|
||||
<MethodInvoker generator="{ExternalApiCalls}" method="handleAmIPresenterQueryEvent" arguments="{event}"/>
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{BBBEvent.USER_VOICE_MUTED}" >
|
||||
<MethodInvoker generator="{ExternalApiCalls}" method="handleUserVoiceMutedEvent" arguments="{event}"/>
|
||||
</EventHandlers>
|
||||
|
Loading…
Reference in New Issue
Block a user