- hook events to webcam

This commit is contained in:
Richard Alam 2012-10-28 21:04:35 +00:00
parent eb3e1cbc5b
commit f5550549ce
7 changed files with 130 additions and 41 deletions

View File

@ -6,6 +6,17 @@ package org.bigbluebutton.core
public class UsersUtil
{
public static function getVoiceUser(voiceUserID:Number):BBBUser {
return UserManager.getInstance().getConference().getVoiceUser(voiceUserID);
}
public static function hasUser(userID:String):Boolean {
return UserManager.getInstance().getConference().hasUser(userID);
}
public static function getUser(userID:String):BBBUser {
return UserManager.getInstance().getConference().getUser(userID);
}
public static function isMe(userID:String):Boolean {
return UserManager.getInstance().getConference().amIThisUser(userID);

View File

@ -154,6 +154,15 @@ package org.bigbluebutton.main.model.users {
// Participant not found.
return null;
}
public function getVoiceUser(voiceUserID:Number):BBBUser {
for (var i:int = 0; i < users.length; i++) {
var aUser:BBBUser = users.getItemAt(i) as BBBUser;
if (aUser.voiceUserid == voiceUserID) return aUser;
}
return null;
}
public function whatsMyRole():String {
return me.role;

View File

@ -18,15 +18,21 @@
*/
package org.bigbluebutton.modules.listeners.business
{
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.core.EventConstants;
import org.bigbluebutton.core.UsersUtil;
import org.bigbluebutton.core.events.CoreEvent;
import org.bigbluebutton.core.managers.UserManager;
import org.bigbluebutton.main.events.BBBEvent;
import org.bigbluebutton.main.model.users.BBBUser;
import org.bigbluebutton.modules.listeners.business.vo.Listener;
import org.bigbluebutton.modules.listeners.business.vo.Listeners;
import org.bigbluebutton.modules.listeners.events.ListenersEvent;
@ -129,6 +135,14 @@ package org.bigbluebutton.modules.listeners.business
UserManager.getInstance().getConference().muteMyVoice(n.muted);
UserManager.getInstance().getConference().setMyVoiceJoined(true);
}
if (UsersUtil.hasUser(result[1])) {
var bu:BBBUser = UsersUtil.getUser(result[1]);
bu.voiceUserid = n.userid;
bu.voiceMuted = n.muted;
bu.voiceJoined = true;
}
n.callerName = result[2]; /* Store the username */
}
@ -150,7 +164,12 @@ package org.bigbluebutton.modules.listeners.business
*/
if (UserManager.getInstance().getConference().amIThisVoiceUser(userId)) {
UserManager.getInstance().getConference().muteMyVoice(l.muted);
}
}
var bu:BBBUser = UsersUtil.getVoiceUser(userId)
if (bu != null) {
bu.voiceMuted = l.muted;
}
}
}
@ -165,6 +184,11 @@ package org.bigbluebutton.modules.listeners.business
if (UserManager.getInstance().getConference().amIThisVoiceUser(userId)) {
UserManager.getInstance().getConference().voiceLocked = l.locked;
}
var bu:BBBUser = UsersUtil.getVoiceUser(userId)
if (bu != null) {
bu.voiceLocked = l.locked;
}
}
}
@ -173,6 +197,15 @@ package org.bigbluebutton.modules.listeners.business
var l:Listener = _listeners.getListener(userId);
if (l != null) {
l.talking = talk;
var bu:BBBUser = UsersUtil.getVoiceUser(userId);
if (bu != null) {
var event:CoreEvent = new CoreEvent(EventConstants.USER_TALKING);
event.message.userID = bu.userID;
event.message.talking = l.talking;
var gd:Dispatcher = new Dispatcher();
gd.dispatchEvent(event);
}
}
}
@ -187,6 +220,13 @@ package org.bigbluebutton.modules.listeners.business
UserManager.getInstance().getConference().setMyVoiceUserId(0);
UserManager.getInstance().getConference().setMyVoiceJoined(false);
}
var bu:BBBUser = UsersUtil.getVoiceUser(userId)
if (bu != null) {
bu.voiceUserid = 0;
bu.voiceMuted = false;
bu.voiceJoined = false;
}
}
public function ping(message:String):void {

View File

@ -28,6 +28,7 @@ package org.bigbluebutton.modules.videoconf.business
import flexlib.mdi.containers.MDIWindow;
import flexlib.mdi.events.MDIWindowEvent;
import mx.containers.Panel;
import mx.controls.Button;
import mx.core.UIComponent;
@ -37,9 +38,12 @@ package org.bigbluebutton.modules.videoconf.business
import org.bigbluebutton.common.events.CloseWindowEvent;
import org.bigbluebutton.common.events.DragWindowEvent;
import org.bigbluebutton.core.UsersUtil;
import org.bigbluebutton.core.events.CoreEvent;
import org.bigbluebutton.core.managers.UserManager;
import org.bigbluebutton.main.model.users.BBBUser;
import org.bigbluebutton.main.model.users.events.RoleChangeEvent;
import org.bigbluebutton.main.views.MainCanvas;
import org.bigbluebutton.modules.listeners.events.ListenersCommand;
import org.bigbluebutton.util.i18n.ResourceUtil;
public class VideoWindowItf extends MDIWindow implements IBbbModuleWindow
@ -81,6 +85,12 @@ package org.bigbluebutton.modules.videoconf.business
}
}
protected function handleUserTalkingEvent(event:CoreEvent):void {
if (event.message.userID == _sharerUserID) {
this._video.visible = event.message.talking;
}
}
protected function get paddingVertical():Number {
return this.borderMetrics.top + this.borderMetrics.bottom;
}
@ -320,7 +330,14 @@ package org.bigbluebutton.modules.videoconf.business
}
protected function onMuteUnmuteClicked(event:MouseEvent = null):void {
var bu:BBBUser = UsersUtil.getUser(_sharerUserID);
if (bu != null) {
var e:ListenersCommand = new ListenersCommand(ListenersCommand.MUTE_USER);
e.userid = bu.voiceUserid;
e.mute = ! bu.voiceMuted;
var gd:Dispatcher = new Dispatcher();
gd.dispatchEvent(e);
}
}
protected function onFitVideoClick(event:MouseEvent = null):void {

View File

@ -32,6 +32,8 @@
verticalScrollPolicy="off"
layout="absolute">
<mate:Listener type="{EventConstants.USER_TALKING}" method="handleUserTalkingEvent" />
<mx:Script>
<![CDATA[
import flexlib.mdi.events.MDIWindowEvent;
@ -43,6 +45,7 @@
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.common.events.CloseWindowEvent;
import org.bigbluebutton.common.events.LocaleChangeEvent;
import org.bigbluebutton.core.EventConstants;
import org.bigbluebutton.core.managers.UserManager;
import org.bigbluebutton.main.views.MainCanvas;
import org.bigbluebutton.modules.videoconf.events.CloseAllWindowsEvent;

View File

@ -28,18 +28,24 @@
resize="onResize()"
layout="absolute">
<mate:Listener type="{EventConstants.USER_TALKING}" method="handleUserTalkingEvent" />
<mx:Script>
<![CDATA[
import com.asfusion.mate.events.Dispatcher;
import flexlib.mdi.events.MDIWindowEvent;
import mx.controls.Alert;
import mx.core.UIComponent;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.main.events.BBBEvent;
import org.bigbluebutton.main.views.MainCanvas;
import org.bigbluebutton.modules.videoconf.events.CloseAllWindowsEvent;
import org.bigbluebutton.common.events.CloseWindowEvent;
import org.bigbluebutton.modules.videoconf.model.VideoConfOptions;
import com.asfusion.mate.events.Dispatcher;
import flexlib.mdi.events.MDIWindowEvent;
import mx.controls.Alert;
import mx.core.UIComponent;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.common.events.CloseWindowEvent;
import org.bigbluebutton.core.EventConstants;
import org.bigbluebutton.main.events.BBBEvent;
import org.bigbluebutton.main.views.MainCanvas;
import org.bigbluebutton.modules.videoconf.events.CloseAllWindowsEvent;
import org.bigbluebutton.modules.videoconf.model.VideoConfOptions;
private var ns:NetStream;
private var globalDispatcher:Dispatcher;

View File

@ -30,35 +30,37 @@
<mate:Listener type="{ConferenceCreatedEvent.CONFERENCE_CREATED_EVENT}" method="conferenceStarted" />
<mate:Listener type="{LocaleChangeEvent.LOCALE_CHANGED}" method="localeChanged" />
<mx:Script>
<![CDATA[
import org.bigbluebutton.modules.viewers.model.ViewerOptions;
import com.asfusion.mate.events.Dispatcher;
import flexlib.mdi.events.MDIWindowEvent;
import mx.binding.utils.BindingUtils;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.controls.listClasses.IListItemRenderer;
import mx.events.DataGridEvent;
import mx.events.ListEvent;
import org.bigbluebutton.common.Images;
import org.bigbluebutton.common.Role;
import org.bigbluebutton.core.managers.UserManager;
import org.bigbluebutton.common.events.LocaleChangeEvent;
import org.bigbluebutton.main.events.ParticipantJoinEvent;
import org.bigbluebutton.main.model.users.BBBUser;
import org.bigbluebutton.main.model.users.Conference;
import org.bigbluebutton.main.model.users.events.ConferenceCreatedEvent;
import org.bigbluebutton.main.model.users.events.KickUserEvent;
import org.bigbluebutton.main.model.users.events.RaiseHandEvent;
import org.bigbluebutton.main.model.users.events.RoleChangeEvent;
import org.bigbluebutton.main.views.MainCanvas;
import org.bigbluebutton.modules.viewers.events.ChangeStatusEvent;
import org.bigbluebutton.util.i18n.ResourceUtil;
import com.asfusion.mate.events.Dispatcher;
import flexlib.mdi.events.MDIWindowEvent;
import mx.binding.utils.BindingUtils;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.controls.listClasses.IListItemRenderer;
import mx.events.DataGridEvent;
import mx.events.ListEvent;
import org.bigbluebutton.common.Images;
import org.bigbluebutton.common.Role;
import org.bigbluebutton.common.events.LocaleChangeEvent;
import org.bigbluebutton.core.EventConstants;
import org.bigbluebutton.core.events.CoreEvent;
import org.bigbluebutton.core.managers.UserManager;
import org.bigbluebutton.main.events.ParticipantJoinEvent;
import org.bigbluebutton.main.model.users.BBBUser;
import org.bigbluebutton.main.model.users.Conference;
import org.bigbluebutton.main.model.users.events.ConferenceCreatedEvent;
import org.bigbluebutton.main.model.users.events.KickUserEvent;
import org.bigbluebutton.main.model.users.events.RaiseHandEvent;
import org.bigbluebutton.main.model.users.events.RoleChangeEvent;
import org.bigbluebutton.main.views.MainCanvas;
import org.bigbluebutton.modules.viewers.events.ChangeStatusEvent;
import org.bigbluebutton.modules.viewers.model.ViewerOptions;
import org.bigbluebutton.util.i18n.ResourceUtil;
[Bindable] private var windowTitle:String = ResourceUtil.getInstance().getString('bbb.viewers.title',["", ""]);
@ -85,6 +87,7 @@
this.visible = viewerOptions.windowVisible;
}
private function updateNumberOfViewers(numViewers:int):void {
if (numViewers > 4)
windowTitle = ResourceUtil.getInstance().getString('bbb.viewers.title', [":", numViewers]);