- broadcast event when role has changed
This commit is contained in:
parent
6e602c4b1d
commit
117bc0ebe6
@ -15,7 +15,8 @@ package org.bigbluebutton.core
|
||||
/** Events to External JS **/
|
||||
public static const GET_MY_ROLE_RESP:String = 'GetMyRoleResponse';
|
||||
|
||||
public static const USER_JOINED_EVENT:String = 'UserJoinedEvent';
|
||||
public static const USER_LEFT_EVENT:String = 'UserLeftEvent';
|
||||
public static const USER_JOINED:String = 'UserJoinedEvent';
|
||||
public static const USER_LEFT:String = 'UserLeftEvent';
|
||||
public static const NEW_ROLE:String = 'NewRoleEvent';
|
||||
}
|
||||
}
|
@ -11,11 +11,8 @@ package org.bigbluebutton.core.controllers
|
||||
public var dispatcher:IEventDispatcher;
|
||||
|
||||
public function handleGetMyRoleReq():void {
|
||||
var message:Object = new Object();
|
||||
message.role = UserManager.getInstance().getConference().whatsMyRole();
|
||||
|
||||
var event:CoreEvent = new CoreEvent(EventConstants.GET_MY_ROLE_RESP);
|
||||
event.message = message;
|
||||
event.message.role = UserManager.getInstance().getConference().whatsMyRole();
|
||||
|
||||
dispatcher.dispatchEvent(event);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ package org.bigbluebutton.core.events
|
||||
|
||||
public class CoreEvent extends Event
|
||||
{
|
||||
public var message:Object;
|
||||
public var message:Object = new Object();
|
||||
|
||||
public function CoreEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
|
||||
{
|
||||
|
@ -9,7 +9,14 @@ package org.bigbluebutton.main.api
|
||||
|
||||
public class ExternalApiCalls
|
||||
{
|
||||
|
||||
public function handleSwitchToNewRoleEvent(event:CoreEvent):void {
|
||||
var payload:Object = new Object();
|
||||
payload.eventName = EventConstants.NEW_ROLE;
|
||||
payload.role = event.message.role;
|
||||
LogUtil.debug("Switch to new role [" + payload.role + "]");
|
||||
broadcastEvent(payload);
|
||||
}
|
||||
|
||||
public function handleGetMyRoleResponse(event:CoreEvent):void {
|
||||
var payload:Object = new Object();
|
||||
payload.eventName = EventConstants.GET_MY_ROLE_RESP;
|
||||
@ -35,11 +42,11 @@ package org.bigbluebutton.main.api
|
||||
var payload:Object = new Object();
|
||||
|
||||
if (event.join) {
|
||||
payload.eventName = EventConstants.USER_JOINED_EVENT;
|
||||
payload.eventName = EventConstants.USER_JOINED;
|
||||
payload.userID = event.participant.userid;
|
||||
payload.userName = event.participant.name;
|
||||
} else {
|
||||
payload.eventName = EventConstants.USER_LEFT_EVENT;
|
||||
payload.eventName = EventConstants.USER_LEFT;
|
||||
payload.userID = event.participant.userid;
|
||||
}
|
||||
|
||||
|
@ -23,10 +23,11 @@
|
||||
<EventMap xmlns="http://mate.asfusion.com/" xmlns:mx="http://www.adobe.com/2006/mxml">
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import org.bigbluebutton.core.EventConstants;
|
||||
import org.bigbluebutton.main.api.ExternalApiCalls;
|
||||
import org.bigbluebutton.main.events.BBBEvent;
|
||||
import org.bigbluebutton.main.events.ParticipantJoinEvent;
|
||||
import org.bigbluebutton.core.EventConstants;
|
||||
import org.bigbluebutton.main.api.ExternalApiCalls;
|
||||
import org.bigbluebutton.main.events.BBBEvent;
|
||||
import org.bigbluebutton.main.events.ParticipantJoinEvent;
|
||||
import org.bigbluebutton.main.events.MadePresenterEvent;
|
||||
]]>
|
||||
</mx:Script>
|
||||
<!--
|
||||
@ -43,5 +44,9 @@
|
||||
<EventHandlers type="{ParticipantJoinEvent.PARTICIPANT_JOINED_EVENT}" >
|
||||
<MethodInvoker generator="{ExternalApiCalls}" method="handleParticipantJoinEvent" arguments="{event}"/>
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{EventConstants.NEW_ROLE}" >
|
||||
<MethodInvoker generator="{ExternalApiCalls}" method="handleSwitchToNewRoleEvent" arguments="{event}"/>
|
||||
</EventHandlers>
|
||||
|
||||
</EventMap>
|
||||
|
@ -17,14 +17,19 @@
|
||||
*
|
||||
*/
|
||||
package org.bigbluebutton.main.model.users {
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
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 flash.net.SharedObject;
|
||||
|
||||
import org.bigbluebutton.common.LogUtil;
|
||||
import org.bigbluebutton.common.Role;
|
||||
import org.bigbluebutton.core.BBB;
|
||||
import org.bigbluebutton.core.EventConstants;
|
||||
import org.bigbluebutton.core.events.CoreEvent;
|
||||
import org.bigbluebutton.core.managers.ConnectionManager;
|
||||
import org.bigbluebutton.core.managers.UserManager;
|
||||
import org.bigbluebutton.main.events.BBBEvent;
|
||||
@ -169,7 +174,12 @@ package org.bigbluebutton.main.model.users {
|
||||
e.presenterName = name;
|
||||
e.assignerBy = assignedBy;
|
||||
|
||||
dispatcher.dispatchEvent(e);
|
||||
dispatcher.dispatchEvent(e);
|
||||
|
||||
var roleEvent:CoreEvent = new CoreEvent(EventConstants.NEW_ROLE);
|
||||
roleEvent.message.role = Role.PRESENTER;
|
||||
dispatcher.dispatchEvent(roleEvent);
|
||||
|
||||
} else {
|
||||
meeting.setMePresenter(false);
|
||||
var viewerEvent:MadePresenterEvent = new MadePresenterEvent(MadePresenterEvent.SWITCH_TO_VIEWER_MODE);
|
||||
@ -178,6 +188,10 @@ package org.bigbluebutton.main.model.users {
|
||||
viewerEvent.assignerBy = assignedBy;
|
||||
|
||||
dispatcher.dispatchEvent(viewerEvent);
|
||||
|
||||
var roleEvent:CoreEvent = new CoreEvent(EventConstants.NEW_ROLE);
|
||||
roleEvent.message.role = Role.VIEWER;
|
||||
dispatcher.dispatchEvent(roleEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user