You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2017/09/07 12:18:11 UTC
openmeetings git commit: [OPENMEETINGS-1644] more work on exclusive
audio
Repository: openmeetings
Updated Branches:
refs/heads/master 55ba9e8ad -> af2425ae9
[OPENMEETINGS-1644] more work on exclusive audio
Project: http://git-wip-us.apache.org/repos/asf/openmeetings/repo
Commit: http://git-wip-us.apache.org/repos/asf/openmeetings/commit/af2425ae
Tree: http://git-wip-us.apache.org/repos/asf/openmeetings/tree/af2425ae
Diff: http://git-wip-us.apache.org/repos/asf/openmeetings/diff/af2425ae
Branch: refs/heads/master
Commit: af2425ae9f676ccc9eaa290aaf830ab2efb63f80
Parents: 55ba9e8
Author: Maxim Solodovnik <so...@gmail.com>
Authored: Thu Sep 7 19:18:02 2017 +0700
Committer: Maxim Solodovnik <so...@gmail.com>
Committed: Thu Sep 7 19:18:02 2017 +0700
----------------------------------------------------------------------
openmeetings-flash/src/main/flex/main.mxml | 103 +++++++++++++------
.../org/apache/openmeetings/web/room/room.js | 21 +++-
2 files changed, 90 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/af2425ae/openmeetings-flash/src/main/flex/main.mxml
----------------------------------------------------------------------
diff --git a/openmeetings-flash/src/main/flex/main.mxml b/openmeetings-flash/src/main/flex/main.mxml
index abaa3e0..990083d 100644
--- a/openmeetings-flash/src/main/flex/main.mxml
+++ b/openmeetings-flash/src/main/flex/main.mxml
@@ -31,6 +31,7 @@
import mx.core.FlexGlobals;
import mx.graphics.SolidColor;
import mx.utils.UIDUtil;
+ import flash.events.MouseEvent;
import org.apache.openmeetings.OmVideo;
@@ -47,6 +48,7 @@
private var recName:String;
private var mic:Microphone = null;
private var activities:Array = [];
+ private var rights:Array = [];
private var activityTimer:Timer = new Timer(100);
private var active:Boolean = false;
private var userId:String = null;
@@ -104,6 +106,7 @@
micRate = getIntParam(params.micRate, 22);
video = new OmVideo(videoDisplay, params);
activities = params.av == null ? [] : params.av.split(',');
+ rights = params.rights == null ? [] : params.rights.split(',');
userId = params.userId;
switch (params.mode) {
case 'settings': {
@@ -145,35 +148,13 @@
selectedCam = params.cam;
selectedMic = params.mic;
_resize(Math.max(300, params.width), Math.max(200, params.height));
- ExternalInterface.addCallback("update", function ():void {
- video.getNc().call("check", new Responder(function (check:Object):void {
- debug("check", check);
- var pVideo:Boolean = hasVideo(), nVideo:Boolean = _hasVideo(check.activities)
- , pAudio:Boolean = hasAudio(), nAudio:Boolean = _hasAudio(check.activities);
- if (nVideo != pVideo || nAudio != pAudio) {
- // activities are changed
- activities = check.activities;
- if (nVideo && pVideo) {
- nAudio ? video.unmute() : video.mute();
- if (mic != null) {
- activityTimer.start();
- } else {
- activityTimer.stop();
- }
- } else {
- refreshBroadcast(null);
- }
- }
- //debug("Client updated: ", c);
- }));
- });
ExternalInterface.addCallback("setVolume", function (vol:int):void {
if (hasAudio()) {
video.setVolume(vol);
}
});
+ ExternalInterface.addCallback("rightsUpdated", rightsUpdatedCallback);
video.connect(function ():void {
- debug("Going to call :: check", video.getNc());
// trust no-one
video.getNc().call("check", new Responder(function (check:Object):void {
debug("check", check);
@@ -181,12 +162,41 @@
activities = check.activities;
interview = 'interview' == check.roomType;
attachCamera(function ():void {
- addImage(params.width, params.height);
- _resize(params.width, params.height);
- activityTimer.addEventListener(TimerEvent.TIMER, broadcastTimerListener);
- refreshBroadcast(null);
- ExternalInterface.call("VideoManager.securityMode", params.uid, false);
- ExternalInterface.addCallback("refresh", refreshBroadcast);
+ // trust no-one
+ video.getNc().call("check", new Responder(function (check:Object):void {
+ debug("check", check);
+ activities = check.activities;
+ addImage(params.width, params.height);
+ _resize(params.width, params.height);
+ _updateExclusive();
+ activityTimer.addEventListener(TimerEvent.TIMER, broadcastTimerListener);
+ refreshBroadcast(null);
+ ExternalInterface.call("VideoManager.securityMode", params.uid, false);
+ ExternalInterface.addCallback("refresh", refreshBroadcast);
+ ExternalInterface.addCallback("update", function ():void {
+ video.getNc().call("check", new Responder(function (check:Object):void {
+ debug("check", check);
+ var pVideo:Boolean = hasVideo(), nVideo:Boolean = _hasVideo(check.activities)
+ , pAudio:Boolean = hasAudio(), nAudio:Boolean = _hasAudio(check.activities);
+ if (nVideo != pVideo || nAudio != pAudio) {
+ // activities are changed
+ activities = check.activities;
+ if (nVideo && pVideo) {
+ nAudio ? video.unmute() : video.mute();
+ if (mic != null) {
+ activityTimer.start();
+ } else {
+ activityTimer.stop();
+ }
+ } else {
+ refreshBroadcast(null);
+ }
+ }
+ _updateExclusive();
+ //debug("Client updated: ", c);
+ }));
+ });
+ }));
});
}))
});
@@ -195,20 +205,45 @@
case OmVideo.PLAY: {
addImage(params.width, params.height);
_resize(params.width, params.height);
- refreshPlayback(null);
+ refreshCallback(null);
ExternalInterface.addCallback("setVolume", function (vol:int):void {
video.setStreamVolume(vol);
});
ExternalInterface.addCallback("update", function (c:Object):void {
//no-op for now
});
- ExternalInterface.addCallback("refresh", refreshPlayback);
+ ExternalInterface.addCallback("refresh", refreshCallback);
+ ExternalInterface.addCallback("rightsUpdated", rightsUpdatedCallback);
}
break;
}
ExternalInterface.addCallback("vidResize", vidResize);
}
+ private function _updateExclusive():void {
+ if (hasAudio()) {
+ addEventListener(MouseEvent.MOUSE_OUT, exclMouseOutHandler);
+ addEventListener(MouseEvent.MOUSE_OVER, exclMouseOverHandler);
+ addEventListener(MouseEvent.CLICK, exclMouseClickHandler);
+ } else {
+ removeEventListener(MouseEvent.MOUSE_OUT, exclMouseOutHandler);
+ removeEventListener(MouseEvent.MOUSE_OVER, exclMouseOverHandler);
+ removeEventListener(MouseEvent.CLICK, exclMouseClickHandler);
+ }
+ }
+
+ private function exclMouseOutHandler(event:MouseEvent):void {
+ exclusiveMic.visible = false;
+ }
+
+ private function exclMouseOverHandler(event:MouseEvent):void {
+ exclusiveMic.visible = true;
+ }
+
+ private function exclMouseClickHandler(event:MouseEvent):void {
+ //exclusiveMic.visible = true;
+ }
+
private function _resize(_width:int, _height:int):void {
userImage.width = _width;
userImage.height = _height;
@@ -246,7 +281,11 @@
}
}
- private function refreshPlayback(opts:Object):void {
+ private function rightsUpdatedCallback(rights:Array):void {
+ debug("rightsUpdatedCallback", rights);
+ }
+
+ private function refreshCallback(opts:Object):void {
var params:Object = FlexGlobals.topLevelApplication.parameters;
video.reset();
video.play(params.broadcastId); // TODO audio/video
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/af2425ae/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js
index 19e0418..c47b2f9 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/room.js
@@ -316,6 +316,7 @@ var Video = (function() {
} else {
o.mode = 'play';
}
+ o.rights = o.rights.join();
o.width = c.width;
o.height = c.height;
o.sid = c.sid;
@@ -354,6 +355,11 @@ var Video = (function() {
swf[0].refresh(opts);
}
}
+ function _setRights(_r) {
+ if (swf[0].setRights !== undefined) {
+ swf[0].setRights(_r);
+ }
+ }
self.update = _update;
self.refresh = _refresh;
@@ -362,6 +368,7 @@ var Video = (function() {
self.init = _init;
self.securityMode = _securityMode;
self.client = function() { return c; };
+ self.setRights = _setRights;
return self;
});
var VideoManager = (function() {
@@ -394,6 +401,15 @@ var VideoManager = (function() {
_closeV(v);
}
}
+ if (c.uid === Room.getOptions().uid) {
+ Room.setRights(c.rights);
+ var windows = $(VID_SEL + ' .ui-dialog-content');
+ for (var i = 0; i < windows.length; ++i) {
+ let w = $(windows[i]);
+ w.data().setRights(c.rights);
+ }
+
+ }
if (c.streams.length == 0) {
// check for non inited video window
let v = $('#' + VideoUtil.getVid(c.uid));
@@ -449,7 +465,7 @@ var VideoManager = (function() {
});
}
function _find(uid) {
- return $('.video.user-video div[data-client-uid="room' + uid + '"]');
+ return $(VID_SEL + ' div[data-client-uid="room' + uid + '"]');
}
function _micActivity(uid, active) {
var u = $('#user' + uid + ' .audio-activity.ui-icon');
@@ -500,7 +516,7 @@ var VideoManager = (function() {
}
}
function _exclusive(uid) {
- var windows = $('.video.user-video .ui-dialog-content');
+ var windows = $(VID_SEL + ' .ui-dialog-content');
for (var i = 0; i < windows.length; ++i) {
let w = $(windows[i]);
w.data().mute('room' + uid !== w.data('client-uid'));
@@ -637,6 +653,7 @@ var Room = (function() {
self.init = _init;
self.getOptions = function() { return JSON.parse(JSON.stringify(options)); };
+ self.setRights = function(_r) { return options.rights = _r; };
self.setSize = _setSize;
self.keyHandler = _keyHandler;
self.load = _load;