move assign presenter logic to users/participants. This fixes a race condition where the first moderator
doesn't become presenter by default.
This commit is contained in:
parent
9224107ec2
commit
0bbe44e785
@ -19,11 +19,13 @@
|
||||
|
||||
package org.bigbluebutton.conference;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public interface IRoomListener {
|
||||
public String getName();
|
||||
public void participantStatusChange(Long userid, String status, Object value);
|
||||
public void participantJoined(Participant participant);
|
||||
public void participantLeft(Long userid);
|
||||
|
||||
public void assignPresenter(ArrayList<String> presenter);
|
||||
public void endAndKickAll();
|
||||
}
|
@ -19,6 +19,7 @@
|
||||
|
||||
package org.bigbluebutton.conference;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bigbluebutton.conference.service.messaging.MessagingConstants;
|
||||
@ -88,6 +89,10 @@ public class ParticipantUpdatingRoomListener implements IRoomListener{
|
||||
}
|
||||
}
|
||||
|
||||
public void assignPresenter(ArrayList<String> presenter) {
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
public void endAndKickAll() {
|
||||
// no-op
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import org.red5.logging.Red5LoggerFactory;
|
||||
import net.jcip.annotations.ThreadSafe;
|
||||
import java.io.Serializable;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
@ -34,7 +35,7 @@ import java.util.Map;
|
||||
@ThreadSafe
|
||||
public class Room implements Serializable {
|
||||
private static Logger log = Red5LoggerFactory.getLogger( Room.class, "bigbluebutton" );
|
||||
|
||||
ArrayList<String> currentPresenter = null;
|
||||
private String name;
|
||||
private Map <Long, Participant> participants;
|
||||
|
||||
@ -151,4 +152,17 @@ public class Room implements Serializable {
|
||||
return sum;
|
||||
}
|
||||
|
||||
public ArrayList<String> getCurrentPresenter() {
|
||||
return currentPresenter;
|
||||
}
|
||||
|
||||
public void assignPresenter(ArrayList<String> presenter){
|
||||
currentPresenter = presenter;
|
||||
for (Iterator iter = listeners.values().iterator(); iter.hasNext();) {
|
||||
log.debug("calling on listener");
|
||||
IRoomListener listener = (IRoomListener) iter.next();
|
||||
log.debug("calling sendUpdateMessage on listener " + listener.getName());
|
||||
listener.assignPresenter(presenter);
|
||||
}
|
||||
}
|
||||
}
|
@ -58,6 +58,10 @@ public class RoomListener implements IRoomListener{
|
||||
so.sendMessage("participantLeft", args);
|
||||
}
|
||||
|
||||
public void assignPresenter(ArrayList<String> presenter) {
|
||||
so.sendMessage("assignPresenterCallback", presenter);
|
||||
}
|
||||
|
||||
public void endAndKickAll() {
|
||||
// no-op
|
||||
}
|
||||
|
@ -23,9 +23,12 @@ import org.bigbluebutton.conference.service.messaging.MessageListener;
|
||||
import org.bigbluebutton.conference.service.messaging.MessagingConstants;
|
||||
import org.bigbluebutton.conference.service.messaging.MessagingService;
|
||||
import org.bigbluebutton.conference.service.presentation.ConversionUpdatesMessageListener;
|
||||
import org.bigbluebutton.conference.service.presentation.PresentationRoom;
|
||||
import org.red5.logging.Red5LoggerFactory;
|
||||
import com.google.gson.Gson;
|
||||
import net.jcip.annotations.ThreadSafe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@ -191,6 +194,25 @@ public class RoomsManager {
|
||||
this.messagingService.addListener(new RoomsManagerListener());
|
||||
this.messagingService.start();
|
||||
}
|
||||
|
||||
public ArrayList<String> getCurrentPresenter( String room){
|
||||
Room r = getRoom(room);
|
||||
if (r != null) {
|
||||
return r.getCurrentPresenter();
|
||||
}
|
||||
log.warn("Getting presenter from a non-existing room " + room);
|
||||
return null;
|
||||
}
|
||||
|
||||
public void assignPresenter(String room, ArrayList presenter){
|
||||
Room r = getRoom(room);
|
||||
if (r != null) {
|
||||
r.assignPresenter(presenter);
|
||||
return;
|
||||
}
|
||||
log.warn("Assigning presenter to a non-existing room " + room);
|
||||
}
|
||||
|
||||
public void setConversionUpdatesMessageListener(ConversionUpdatesMessageListener conversionUpdatesMessageListener) {
|
||||
this.conversionUpdatesMessageListener = conversionUpdatesMessageListener;
|
||||
}
|
||||
|
@ -20,7 +20,8 @@ package org.bigbluebutton.conference.service.participants;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.red5.logging.Red5LoggerFactory;
|
||||
import java.util.Map;
import org.bigbluebutton.conference.RoomsManager;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
import org.bigbluebutton.conference.RoomsManager;
|
||||
import org.bigbluebutton.conference.Room;
import org.bigbluebutton.conference.Participant;
import org.bigbluebutton.conference.IRoomListener;
|
||||
|
||||
public class ParticipantsApplication {
|
||||
@ -104,6 +105,22 @@ public class ParticipantsApplication {
|
||||
return false;
|
||||
}
|
||||
|
||||
public ArrayList<String> getCurrentPresenter(String room){
|
||||
if (roomsManager.hasRoom(room)){
|
||||
return roomsManager.getCurrentPresenter(room);
|
||||
}
|
||||
log.warn("Getting presenter on a non-existant room " + room);
|
||||
return null;
|
||||
}
|
||||
|
||||
public void assignPresenter(String room, ArrayList presenter){
|
||||
if (roomsManager.hasRoom(room)){
|
||||
roomsManager.assignPresenter(room, presenter);
|
||||
return;
|
||||
}
|
||||
log.warn("Assigning presenter on a non-existant room " + room);
|
||||
}
|
||||
|
||||
public void setRoomsManager(RoomsManager r) {
|
||||
log.debug("Setting room manager");
|
||||
roomsManager = r;
|
||||
|
@ -53,6 +53,13 @@ public class ParticipantsEventSender implements IRoomListener {
|
||||
so.sendMessage("logout", new ArrayList());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void assignPresenter(ArrayList<String> presenter) {
|
||||
log.debug("calling assignPresenterCallback " + presenter.get(0) + ", " + presenter.get(1) + " " + presenter.get(2));
|
||||
so.sendMessage("assignPresenterCallback", presenter);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void participantJoined(Participant p) {
|
||||
|
@ -23,8 +23,10 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.red5.logging.Red5LoggerFactory;
|
||||
|
||||
import org.red5.server.api.IScope;
|
||||
import org.red5.server.api.Red5;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@ -35,12 +37,34 @@ public class ParticipantsService {
|
||||
private static Logger log = Red5LoggerFactory.getLogger( ParticipantsService.class, "bigbluebutton" );
|
||||
private ParticipantsApplication application;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void assignPresenter(Long userid, String name, Long assignedBy) {
|
||||
log.info("Receive assignPresenter request from client [" + userid + "," + name + "," + assignedBy + "]");
|
||||
IScope scope = Red5.getConnectionLocal().getScope();
|
||||
ArrayList<String> presenter = new ArrayList<String>();
|
||||
presenter.add(userid.toString());
|
||||
presenter.add(name);
|
||||
presenter.add(assignedBy.toString());
|
||||
ArrayList<String> curPresenter = application.getCurrentPresenter(scope.getName());
|
||||
application.setParticipantStatus(scope.getName(), userid, "presenter", true);
|
||||
|
||||
if (curPresenter != null){
|
||||
String curUserid = (String) curPresenter.get(0);
|
||||
if (! curUserid.equals(userid.toString())){
|
||||
log.info("Changing the current presenter [" + curPresenter.get(0) + "] to viewer.");
|
||||
application.setParticipantStatus(scope.getName(), new Long(curPresenter.get(0)), "presenter", false);
|
||||
}
|
||||
} else {
|
||||
log.info("No current presenter. So do nothing.");
|
||||
}
|
||||
application.assignPresenter(scope.getName(), presenter);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map getParticipants() {
|
||||
String roomName = Red5.getConnectionLocal().getScope().getName();
|
||||
log.debug("getting participants for " + roomName);
|
||||
log.info("Client is requesting for list of participants in [" + roomName + "].");
|
||||
Map p = application.getParticipants(roomName);
|
||||
log.debug("getting participants for " + roomName);
|
||||
Map participants = new HashMap();
|
||||
if (p == null) {
|
||||
participants.put("count", 0);
|
||||
|
@ -28,7 +28,6 @@ import java.util.Map;
|
||||
public interface IPresentationRoomListener {
|
||||
public String getName();
|
||||
public void sendUpdateMessage(Map<String, Object> message);
|
||||
public void assignPresenter(ArrayList presenter);
|
||||
public void gotoSlide(int curslide);
|
||||
public void resizeAndMoveSlide(Double xOffset, Double yOffset, Double widthRatio, Double heightRatio);
|
||||
public void removePresentation(String name);
|
||||
|
@ -69,15 +69,7 @@ public class PresentationApplication {
|
||||
}
|
||||
log.warn("Sending update message to a non-existant room " + room);
|
||||
}
|
||||
|
||||
public ArrayList getCurrentPresenter(String room){
|
||||
if (roomsManager.hasRoom(room)){
|
||||
return roomsManager.getCurrentPresenter(room);
|
||||
}
|
||||
log.warn("Getting presenter on a non-existant room " + room);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public ArrayList<String> getPresentations(String room){
|
||||
if (roomsManager.hasRoom(room)){
|
||||
return roomsManager.getPresentations(room);
|
||||
@ -134,15 +126,7 @@ public class PresentationApplication {
|
||||
}
|
||||
log.warn("resizeAndMoveSlide on a non-existant room " + room);
|
||||
}
|
||||
|
||||
public void assignPresenter(String room, ArrayList presenter){
|
||||
if (roomsManager.hasRoom(room)){
|
||||
roomsManager.assignPresenter(room, presenter);
|
||||
return;
|
||||
}
|
||||
log.warn("Assigning presenter on a non-existant room " + room);
|
||||
}
|
||||
|
||||
|
||||
public void gotoSlide(String room, int slide){
|
||||
if (roomsManager.hasRoom(room)){
|
||||
log.debug("Request to go to slide " + slide + " for room " + room);
|
||||
|
@ -140,13 +140,6 @@ public class PresentationEventSender implements IPresentationRoomListener {
|
||||
so.sendMessage("sharePresentationCallback", list);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void assignPresenter(ArrayList presenter) {
|
||||
log.debug("calling assignPresenterCallback " + presenter.get(0) + ", " + presenter.get(1) + " " + presenter.get(2));
|
||||
so.sendMessage("assignPresenterCallback", presenter);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void resizeAndMoveSlide(Double xOffset, Double yOffset, Double widthRatio, Double heightRatio) {
|
||||
|
@ -40,9 +40,6 @@ public class PresentationRoom {
|
||||
private final String name;
|
||||
private final Map<String, IPresentationRoomListener> listeners;
|
||||
|
||||
//TODO: check this type of attributes...
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList currentPresenter = null;
|
||||
int currentSlide = 0;
|
||||
Boolean sharing = false;
|
||||
String currentPresentation = "";
|
||||
@ -109,17 +106,7 @@ public class PresentationRoom {
|
||||
listener.resizeAndMoveSlide(xOffset, yOffset, widthRatio, heightRatio);
|
||||
}
|
||||
}
|
||||
|
||||
public void assignPresenter(ArrayList presenter){
|
||||
currentPresenter = presenter;
|
||||
for (Iterator iter = listeners.values().iterator(); iter.hasNext();) {
|
||||
log.debug("calling on listener");
|
||||
IPresentationRoomListener listener = (IPresentationRoomListener) iter.next();
|
||||
log.debug("calling sendUpdateMessage on listener " + listener.getName());
|
||||
listener.assignPresenter(presenter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void gotoSlide(int curslide){
|
||||
log.debug("Request to go to slide " + curslide + "for room " + name);
|
||||
@ -190,10 +177,6 @@ public class PresentationRoom {
|
||||
return presentationNames;
|
||||
}
|
||||
|
||||
public ArrayList getCurrentPresenter() {
|
||||
return currentPresenter;
|
||||
}
|
||||
|
||||
public Double getxOffset() {
|
||||
return xOffset;
|
||||
}
|
||||
|
@ -96,16 +96,7 @@ public class PresentationRoomsManager {
|
||||
}
|
||||
log.warn("Sending update message to a non-existing room " + room);
|
||||
}
|
||||
|
||||
public ArrayList getCurrentPresenter( String room){
|
||||
PresentationRoom r = getRoom(room);
|
||||
if (r != null) {
|
||||
return r.getCurrentPresenter();
|
||||
}
|
||||
log.warn("Getting presenter from a non-existing room " + room);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public Boolean getSharingPresentation(String room){
|
||||
PresentationRoom r = getRoom(room);
|
||||
if (r != null) {
|
||||
@ -114,16 +105,7 @@ public class PresentationRoomsManager {
|
||||
log.warn("Getting sharing from a non-existing room " + room);
|
||||
return null;
|
||||
}
|
||||
|
||||
public void assignPresenter(String room, ArrayList presenter){
|
||||
PresentationRoom r = getRoom(room);
|
||||
if (r != null) {
|
||||
r.assignPresenter(presenter);
|
||||
return;
|
||||
}
|
||||
log.warn("Assigning presenter to a non-existing room " + room);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map getPresenterSettings(String room){
|
||||
PresentationRoom r = getRoom(room);
|
||||
|
@ -29,34 +29,12 @@ import org.red5.logging.Red5LoggerFactory;
|
||||
import org.red5.server.api.Red5;
|
||||
import org.red5.server.api.IScope;
import org.bigbluebutton.conference.service.participants.ParticipantsApplication;
|
||||
|
||||
public class PresentationService {
|
||||
|
||||
public class PresentationService {
|
||||
private static Logger log = Red5LoggerFactory.getLogger( PresentationService.class, "bigbluebutton" );
|
||||
|
||||
private ParticipantsApplication participantsApplication;
|
||||
private PresentationApplication presentationApplication;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void assignPresenter(Long userid, String name, Long assignedBy) {
|
||||
log.debug("assignPresenter " + userid + " " + name + " " + assignedBy);
|
||||
IScope scope = Red5.getConnectionLocal().getScope();
|
||||
ArrayList presenter = new ArrayList();
|
||||
presenter.add(userid);
|
||||
presenter.add(name);
|
||||
presenter.add(assignedBy);
|
||||
ArrayList curPresenter = presentationApplication.getCurrentPresenter(scope.getName());
|
||||
participantsApplication.setParticipantStatus(scope.getName(), userid, "presenter", true);
|
||||
|
||||
if (curPresenter != null){
|
||||
long curUserid=(Long) curPresenter.get(0);
|
||||
if( curUserid!= userid){
|
||||
log.debug("Changing presenter from " + curPresenter.get(0) + " to " + userid);
|
||||
participantsApplication.setParticipantStatus(scope.getName(), (Long)curPresenter.get(0), "presenter", false);
|
||||
}
|
||||
}
|
||||
presentationApplication.assignPresenter(scope.getName(), presenter);
|
||||
}
|
||||
|
||||
public void removePresentation(String name) {
|
||||
log.debug("removePresentation " + name);
|
||||
IScope scope = Red5.getConnectionLocal().getScope();
|
||||
@ -67,7 +45,7 @@ public class PresentationService {
|
||||
public Map getPresentationInfo() {
|
||||
log.debug("Getting presentation information.");
|
||||
IScope scope = Red5.getConnectionLocal().getScope();
|
||||
ArrayList curPresenter = presentationApplication.getCurrentPresenter(scope.getName());
|
||||
ArrayList<String> curPresenter = participantsApplication.getCurrentPresenter(scope.getName());
|
||||
int curSlide = presentationApplication.getCurrentSlide(scope.getName());
|
||||
Boolean isSharing = presentationApplication.getSharingPresentation(scope.getName());
|
||||
String currentPresentation = presentationApplication.getCurrentPresentation(scope.getName());
|
||||
@ -127,10 +105,10 @@ public class PresentationService {
|
||||
IScope scope = Red5.getConnectionLocal().getScope();
|
||||
presentationApplication.resizeAndMoveSlide(scope.getName(), xOffset, yOffset, widthRatio, heightRatio);
|
||||
}
|
||||
|
||||
|
||||
public void setParticipantsApplication(ParticipantsApplication a) {
|
||||
log.debug("Setting participants application");
|
||||
participantsApplication = a;
|
||||
log.debug("Setting participants application");
|
||||
participantsApplication = a;
|
||||
}
|
||||
|
||||
public void setPresentationApplication(PresentationApplication a) {
|
||||
|
@ -1,14 +1,12 @@
|
||||
package org.bigbluebutton.conference.service.recorder.presentation;
|
||||
package org.bigbluebutton.conference.service.recorder.participants;
|
||||
|
||||
public class AssignPresenterRecordEvent extends AbstractParticipantRecordEvent {
|
||||
|
||||
public class AssignPresenterPresentationRecordEvent extends
|
||||
AbstractPresentationRecordEvent {
|
||||
|
||||
public AssignPresenterPresentationRecordEvent() {
|
||||
public AssignPresenterRecordEvent() {
|
||||
super();
|
||||
setEvent("AssignPresenterEvent");
|
||||
}
|
||||
|
||||
|
||||
public void setUserId(String userid) {
|
||||
eventMap.put("userid", userid);
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package org.bigbluebutton.conference.service.recorder.participants;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import org.bigbluebutton.conference.IRoomListener;
|
||||
import org.bigbluebutton.conference.Participant;
|
||||
import org.bigbluebutton.conference.service.recorder.RecorderApplication;
|
||||
@ -62,6 +61,19 @@ public class ParticipantsEventRecorder implements IRoomListener {
|
||||
recorder.record(session, ev);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void assignPresenter(ArrayList<String> presenter) {
|
||||
log.debug("RECORD module:presentation event:assign_presenter");
|
||||
AssignPresenterRecordEvent event = new AssignPresenterRecordEvent();
|
||||
event.setMeetingId(session);
|
||||
event.setTimestamp(System.currentTimeMillis());
|
||||
event.setUserId(presenter.get(0).toString());
|
||||
event.setName(presenter.get(1).toString());
|
||||
event.setAssignedBy(presenter.get(2).toString());
|
||||
|
||||
recorder.record(session, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
|
@ -66,20 +66,6 @@ public class PresentationEventRecorder implements IPresentationRoomListener {
|
||||
recorder.record(session, event);
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public void assignPresenter(ArrayList presenter) {
|
||||
log.debug("RECORD module:presentation event:assign_presenter");
|
||||
AssignPresenterPresentationRecordEvent event = new AssignPresenterPresentationRecordEvent();
|
||||
event.setMeetingId(session);
|
||||
event.setTimestamp(System.currentTimeMillis());
|
||||
event.setUserId(presenter.get(0).toString());
|
||||
event.setName(presenter.get(1).toString());
|
||||
event.setAssignedBy(presenter.get(2).toString());
|
||||
|
||||
recorder.record(session, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gotoSlide(int curslide) {
|
||||
log.debug("RECORD module:presentation event:update_slide");
|
||||
|
@ -21,7 +21,6 @@
|
||||
-->
|
||||
|
||||
<EventMap xmlns="http://mate.asfusion.com/" xmlns:mx="http://www.adobe.com/2006/mxml">
|
||||
|
||||
<!--
|
||||
This is the main event map for the application, think of it as the application controller.
|
||||
-->
|
||||
@ -94,12 +93,16 @@
|
||||
<MethodInvoker generator="{SkinningService}" method="loadSkins" arguments="{event.config.skinning}" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{RoleChangeEvent.ASSIGN_PRESENTER}">
|
||||
<MethodInvoker generator="{UserService}" method="assignPresenter" arguments="{event}" />
|
||||
</EventHandlers>
|
||||
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import org.bigbluebutton.core.services.SkinningService;
|
||||
import org.bigbluebutton.core.managers.ConfigManager;
|
||||
import mx.events.FlexEvent;
|
||||
|
||||
import org.bigbluebutton.main.model.users.events.RoleChangeEvent;
|
||||
import org.bigbluebutton.main.events.ConfigEvent;
|
||||
import org.bigbluebutton.main.events.LogoutEvent;
|
||||
import org.bigbluebutton.main.events.ModuleLoadEvent;
|
||||
|
@ -36,6 +36,7 @@ package org.bigbluebutton.main.model.users
|
||||
import org.bigbluebutton.main.model.users.events.KickUserEvent;
|
||||
import org.bigbluebutton.main.model.users.events.LowerHandEvent;
|
||||
import org.bigbluebutton.main.model.users.events.RaiseHandEvent;
|
||||
import org.bigbluebutton.main.model.users.events.RoleChangeEvent;
|
||||
import org.bigbluebutton.main.model.users.events.UsersConnectionEvent;
|
||||
|
||||
public class UserService {
|
||||
@ -129,11 +130,7 @@ package org.bigbluebutton.main.model.users
|
||||
public function get participants():ArrayCollection {
|
||||
return UserManager.getInstance().getConference().users;
|
||||
}
|
||||
|
||||
public function assignPresenter(assignTo:Number):void {
|
||||
_userSOService.assignPresenter(assignTo, UserManager.getInstance().getConference().getMyUserId());
|
||||
}
|
||||
|
||||
|
||||
public function addStream(e:BroadcastStartedEvent):void {
|
||||
_userSOService.addStream(e.userid, e.stream);
|
||||
}
|
||||
@ -153,5 +150,16 @@ package org.bigbluebutton.main.model.users
|
||||
public function kickUser(e:KickUserEvent):void{
|
||||
if (this.isModerator()) _userSOService.kickUser(e.userid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign a new presenter
|
||||
* @param e
|
||||
*
|
||||
*/
|
||||
public function assignPresenter(e:RoleChangeEvent):void{
|
||||
var assignTo:Number = e.userid;
|
||||
var name:String = e.username;
|
||||
_userSOService.assignPresenter(assignTo, name, 1);
|
||||
}
|
||||
}
|
||||
}
|
@ -29,11 +29,13 @@ package org.bigbluebutton.main.model.users {
|
||||
import org.bigbluebutton.core.managers.UserManager;
|
||||
import org.bigbluebutton.main.events.BBBEvent;
|
||||
import org.bigbluebutton.main.events.LogoutEvent;
|
||||
import org.bigbluebutton.main.events.MadePresenterEvent;
|
||||
import org.bigbluebutton.main.events.ParticipantJoinEvent;
|
||||
import org.bigbluebutton.main.events.PresenterStatusEvent;
|
||||
import org.bigbluebutton.main.model.ConferenceParameters;
|
||||
import org.bigbluebutton.main.model.User;
|
||||
import org.bigbluebutton.main.model.users.events.ConnectionFailedEvent;
|
||||
import org.bigbluebutton.main.model.users.events.ConnectionFailedEvent;
|
||||
import org.bigbluebutton.main.model.users.events.RoleChangeEvent;
|
||||
|
||||
public class UsersSOService {
|
||||
public static const NAME:String = "ViewersSOService";
|
||||
@ -87,7 +89,8 @@ package org.bigbluebutton.main.model.users {
|
||||
for(var p:Object in result.participants) {
|
||||
participantJoined(result.participants[p]);
|
||||
}
|
||||
}
|
||||
}
|
||||
becomePresenterIfLoneModerator();
|
||||
},
|
||||
// status - On error occurred
|
||||
function(status:Object):void {
|
||||
@ -101,6 +104,71 @@ package org.bigbluebutton.main.model.users {
|
||||
); //_netConnection.call
|
||||
}
|
||||
|
||||
private function becomePresenterIfLoneModerator():void {
|
||||
var participants:Conference = UserManager.getInstance().getConference();
|
||||
if (participants.hasOnlyOneModerator()) {
|
||||
var user:BBBUser = participants.getTheOnlyModerator();
|
||||
if (user.me) {
|
||||
var presenterEvent:RoleChangeEvent = new RoleChangeEvent(RoleChangeEvent.ASSIGN_PRESENTER);
|
||||
presenterEvent.userid = user.userid;
|
||||
presenterEvent.username = user.name;
|
||||
var dispatcher:Dispatcher = new Dispatcher();
|
||||
dispatcher.dispatchEvent(presenterEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function assignPresenter(userid:Number, name:String, assignedBy:Number):void {
|
||||
var nc:NetConnection = netConnectionDelegate.connection;
|
||||
nc.call("participants.assignPresenter",// Remote function name
|
||||
new Responder(
|
||||
// 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,
|
||||
name,
|
||||
assignedBy
|
||||
); //_netConnection.call
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the server to assign a presenter
|
||||
*/
|
||||
public function assignPresenterCallback(userid:Number, name:String, assignedBy:Number):void {
|
||||
LogUtil.debug("assignPresenterCallback " + userid + "," + name + "," + assignedBy);
|
||||
var dispatcher:Dispatcher = new Dispatcher();
|
||||
var meeting:Conference = UserManager.getInstance().getConference();
|
||||
if (meeting.amIThisUser(userid)) {
|
||||
meeting.setMePresenter(true);
|
||||
var e:MadePresenterEvent = new MadePresenterEvent(MadePresenterEvent.SWITCH_TO_PRESENTER_MODE);
|
||||
e.userid = userid;
|
||||
e.presenterName = name;
|
||||
e.assignerBy = assignedBy;
|
||||
|
||||
dispatcher.dispatchEvent(e);
|
||||
} else {
|
||||
meeting.setMePresenter(false);
|
||||
var viewerEvent:MadePresenterEvent = new MadePresenterEvent(MadePresenterEvent.SWITCH_TO_VIEWER_MODE);
|
||||
viewerEvent.userid = userid;
|
||||
viewerEvent.presenterName = name;
|
||||
viewerEvent.assignerBy = assignedBy;
|
||||
|
||||
dispatcher.dispatchEvent(viewerEvent);
|
||||
}
|
||||
}
|
||||
|
||||
public function kickUser(userid:Number):void{
|
||||
_participantsSO.send("kickUserCallback", userid);
|
||||
}
|
||||
@ -184,16 +252,6 @@ package org.bigbluebutton.main.model.users {
|
||||
}
|
||||
}
|
||||
|
||||
public function assignPresenter(userid:Number, assignedBy:Number):void {
|
||||
var nc:NetConnection = netConnectionDelegate.connection;
|
||||
nc.call(
|
||||
"participants.assignPresenter",// Remote function name
|
||||
responder,
|
||||
userid,
|
||||
assignedBy
|
||||
); //_netConnection.call
|
||||
}
|
||||
|
||||
public function raiseHand(userid:Number, raise:Boolean):void {
|
||||
var nc:NetConnection = netConnectionDelegate.connection;
|
||||
nc.call(
|
||||
|
@ -63,20 +63,7 @@ package org.bigbluebutton.modules.present.business
|
||||
connection = a.connection;
|
||||
url = connection.uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign a new presenter
|
||||
* @param e
|
||||
*
|
||||
*/
|
||||
public function assignPresenter(e:RoleChangeEvent):void{
|
||||
var assignTo:Number = e.userid;
|
||||
var name:String = e.username;
|
||||
soService.assignPresenter(assignTo, name, 1);
|
||||
soService.setPresenterName(name);
|
||||
//antAlert.show(e.username + " " + e.userid);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Start uploading the selected file
|
||||
* @param e
|
||||
|
@ -351,56 +351,7 @@ package org.bigbluebutton.modules.present.business {
|
||||
uploadEvent.presentationName = presentationName;
|
||||
dispatcher.dispatchEvent(uploadEvent)
|
||||
}
|
||||
|
||||
public function assignPresenter(userid:Number, name:String, assignedBy:Number):void {
|
||||
nc.call("presentation.assignPresenter",// Remote function name
|
||||
new Responder(
|
||||
// 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,
|
||||
name,
|
||||
assignedBy
|
||||
); //_netConnection.call
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the server to assign a presenter
|
||||
*/
|
||||
public function assignPresenterCallback(userid:Number, name:String, assignedBy:Number):void {
|
||||
LogUtil.debug("assignPresenterCallback " + userid + "," + name + "," + assignedBy);
|
||||
var meeting:Conference = UserManager.getInstance().getConference();
|
||||
if (this.userid == userid) {
|
||||
meeting.setMePresenter(true);
|
||||
var e:MadePresenterEvent = new MadePresenterEvent(MadePresenterEvent.SWITCH_TO_PRESENTER_MODE);
|
||||
e.userid = userid;
|
||||
e.presenterName = name;
|
||||
e.assignerBy = assignedBy;
|
||||
dispatcher.dispatchEvent(e);
|
||||
setPresenterName(name);
|
||||
} else {
|
||||
|
||||
meeting.setMePresenter(false);
|
||||
var viewerEvent:MadePresenterEvent = new MadePresenterEvent(MadePresenterEvent.SWITCH_TO_VIEWER_MODE);
|
||||
viewerEvent.userid = userid;
|
||||
viewerEvent.presenterName = name;
|
||||
viewerEvent.assignerBy = assignedBy;
|
||||
dispatcher.dispatchEvent(viewerEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send an event out to the server to go to a new page in the SlidesDeck
|
||||
* @param page
|
||||
|
@ -18,10 +18,8 @@
|
||||
*/
|
||||
package org.bigbluebutton.modules.present.managers
|
||||
{
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
import mx.managers.PopUpManager;
|
||||
|
||||
import org.bigbluebutton.common.IBbbModuleWindow;
|
||||
import org.bigbluebutton.common.LogUtil;
|
||||
import org.bigbluebutton.core.managers.UserManager;
|
||||
@ -54,8 +52,6 @@ package org.bigbluebutton.modules.present.managers
|
||||
presentWindow = new PresentationWindow();
|
||||
presentWindow.visible = (e.data.showPresentWindow == "true");
|
||||
openWindow(presentWindow);
|
||||
|
||||
becomePresenterIfLoneModerator();
|
||||
}
|
||||
|
||||
public function handleStopModuleEvent():void{
|
||||
@ -96,18 +92,5 @@ package org.bigbluebutton.modules.present.managers
|
||||
LogUtil.debug("Removing presentation " + e.presentationName + " at index " + index);
|
||||
}
|
||||
}
|
||||
|
||||
private function becomePresenterIfLoneModerator():void {
|
||||
var participants:Conference = UserManager.getInstance().getConference();
|
||||
if (participants.hasOnlyOneModerator()) {
|
||||
var user:BBBUser = participants.getTheOnlyModerator();
|
||||
if (user.me) {
|
||||
var presenterEvent:RoleChangeEvent = new RoleChangeEvent(RoleChangeEvent.ASSIGN_PRESENTER);
|
||||
presenterEvent.userid = user.userid;
|
||||
presenterEvent.username = user.name;
|
||||
globalDispatcher.dispatchEvent(presenterEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -67,11 +67,7 @@
|
||||
<EventHandlers type="{UploadEvent.CLOSE_UPLOAD_WINDOW}" >
|
||||
<MethodInvoker generator="{PresentManager}" method="handleCloseUploadWindow" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{RoleChangeEvent.ASSIGN_PRESENTER}" >
|
||||
<MethodInvoker generator="{PresentProxy}" method="assignPresenter" arguments="{event}" />
|
||||
</EventHandlers>
|
||||
|
||||
|
||||
<EventHandlers type="{UploadEvent.START_UPLOAD}">
|
||||
<MethodInvoker generator="{PresentProxy}" method="startUpload" arguments="{event}" />
|
||||
</EventHandlers>
|
||||
|
Loading…
Reference in New Issue
Block a user