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/08/27 16:06:44 UTC
openmeetings git commit: [OPENMEETINGS-1644] refresh seems to work
Repository: openmeetings
Updated Branches:
refs/heads/master df5d58f87 -> 42c1aad6f
[OPENMEETINGS-1644] refresh seems to work
Project: http://git-wip-us.apache.org/repos/asf/openmeetings/repo
Commit: http://git-wip-us.apache.org/repos/asf/openmeetings/commit/42c1aad6
Tree: http://git-wip-us.apache.org/repos/asf/openmeetings/tree/42c1aad6
Diff: http://git-wip-us.apache.org/repos/asf/openmeetings/diff/42c1aad6
Branch: refs/heads/master
Commit: 42c1aad6f8cd664f40f57fb17399b34b5247aaa4
Parents: df5d58f
Author: Maxim Solodovnik <so...@gmail.com>
Authored: Sun Aug 27 23:06:35 2017 +0700
Committer: Maxim Solodovnik <so...@gmail.com>
Committed: Sun Aug 27 23:06:35 2017 +0700
----------------------------------------------------------------------
.../core/remote/ScopeApplicationAdapter.java | 3 ++
.../openmeetings/db/entity/basic/Client.java | 9 ++++
.../openmeetings/db/entity/basic/IClient.java | 1 +
openmeetings-flash/src/main/flex/main.mxml | 50 ++++++++++++++------
.../flex/org/apache/openmeetings/OmVideo.as | 24 ++++++----
.../apache/openmeetings/web/room/RoomPanel.java | 9 ++--
.../org/apache/openmeetings/web/room/room.js | 43 ++++++++++++-----
7 files changed, 102 insertions(+), 37 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/42c1aad6/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java
----------------------------------------------------------------------
diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java
index 6682c1f..2e81761 100644
--- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java
+++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ScopeApplicationAdapter.java
@@ -91,6 +91,7 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp
private static final String OWNER_SID_PARAM = "ownerSid";
private static final String PARENT_SID_PARAM = "parentSid"; //mobile
private static final String MOBILE_PARAM = "mobileClient";
+ private static final String ROOM_PARAM = "roomClient";
private static final String WIDTH_PARAM = "width";
private static final String HEIGHT_PARAM = "height";
public static final String HIBERNATE_SCOPE = "hibernate";
@@ -226,6 +227,8 @@ public class ScopeApplicationAdapter extends MultiThreadedApplicationAdapter imp
}
if (Boolean.TRUE.equals(connParams.get(MOBILE_PARAM))) {
rcm.setType(Client.Type.mobile);
+ } else if (Boolean.TRUE.equals(connParams.get(ROOM_PARAM))) {
+ rcm.setType(Client.Type.room);
}
rcm.setUid(Strings.isEmpty(uid) ? UUID.randomUUID().toString() : uid);
rcm.setOwnerSid(ownerSid);
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/42c1aad6/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java
----------------------------------------------------------------------
diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java
index 3895cb0..1be2209 100644
--- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java
+++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/Client.java
@@ -26,6 +26,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
+import java.util.stream.Collectors;
import org.apache.openmeetings.db.dao.user.UserDao;
import org.apache.openmeetings.db.entity.room.Room.Right;
@@ -469,6 +470,14 @@ public class Client implements IClient {
return json;
}
+ public JSONArray streamArray(boolean self) {
+ // stream `uid` is unknown at the time of self stream creation
+ // so we will replace stream `uid` with client `uid` for self
+ return new JSONArray(streams.stream().map(
+ s -> self && Type.room == s.getType() ? uid : s.getUid()
+ ).collect(Collectors.toList()));
+ }
+
@Override
public String toString() {
return "Client [uid=" + uid + ", sessionId=" + sessionId + ", pageId=" + pageId + ", userId=" + user.getId() + ", roomId=" + roomId
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/42c1aad6/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/IClient.java
----------------------------------------------------------------------
diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/IClient.java b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/IClient.java
index c471b9e..0ec52cf 100644
--- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/IClient.java
+++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/basic/IClient.java
@@ -30,6 +30,7 @@ import org.apache.openmeetings.db.entity.IDataProviderEntity;
public interface IClient extends IDataProviderEntity {
enum Type {
video
+ , room // room flash client
, sip
, mobile
, sharing
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/42c1aad6/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 2d369ac..c12080e 100644
--- a/openmeetings-flash/src/main/flex/main.mxml
+++ b/openmeetings-flash/src/main/flex/main.mxml
@@ -159,28 +159,24 @@
attachCamera(function ():void {
addImage(params.width, params.height);
video.resize(params.width, params.height);
- video.reset();
- var broadcastId:String = UIDUtil.createUID();
- debug("BroadcastId = " + broadcastId);
activityTimer.addEventListener(TimerEvent.TIMER, broadcastTimerListener);
- mic = getMic();
- if (mic != null) {
- volumeRect.visible = true;
- volumeRect.fill = new SolidColor(0x00FF00);
- activityTimer.start();
- }
- video.broadcast(broadcastId, hasVideo() ? getCam() : null, mic);
- if (!hasAudio()) {
- video.mute();
- }
+ refreshBroadcast();
ExternalInterface.call("VideoManager.securityMode", params.uid, false);
+ ExternalInterface.addCallback("refresh", refreshBroadcast);
});
}
break;
case OmVideo.PLAY: {
addImage(params.width, params.height);
video.resize(params.width, params.height);
- video.play(params.broadcastId); // TODO audio/video
+ refreshPlayback();
+ 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);
}
break;
}
@@ -192,6 +188,32 @@
});
}
+ private function refreshBroadcast():void {
+ video.reset();
+ activityTimer.stop();
+ var broadcastId:String = UIDUtil.createUID();
+ debug("BroadcastId = " + broadcastId);
+ mic = getMic();
+ if (mic != null) {
+ volumeRect.visible = true;
+ volumeRect.fill = new SolidColor(0x00FF00);
+ activityTimer.start();
+ }
+ video.broadcast(broadcastId, hasVideo() ? getCam() : null, mic);
+ if (!hasAudio()) {
+ video.mute();
+ } else {
+ video.resetVolume();
+ }
+ }
+
+ private function refreshPlayback():void {
+ var params:Object = FlexGlobals.topLevelApplication.parameters;
+ video.reset();
+ video.play(params.broadcastId); // TODO audio/video
+ video.resetStreamVolume();
+ }
+
private function addImage(_width:int, _height:int):void {
userImage.source = 'profile/' + userId + '?anti=' + new Date().time;
userImage.width = _width;
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/42c1aad6/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
----------------------------------------------------------------------
diff --git a/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as b/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
index b6cd258..659c7dc 100644
--- a/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
+++ b/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
@@ -108,21 +108,30 @@ public class OmVideo {
_setVolume(volume);
}
+ public function resetVolume():void {
+ _setVolume(volume);
+ }
+
+ public function resetStreamVolume():void {
+ setStreamVolume(volume);
+ }
+
/**
* This method to set volume of other stream
* @param vol - new volume
*/
public function setStreamVolume(vol:int):void {
- debug("setStreamVolume: " + vol);
+ volume = vol;
+ //debug("setStreamVolume: " + vol);
if (ns != null) {
- debug("setStreamVolume: not null");
+ //debug("setStreamVolume: not null");
ns.soundTransform = new SoundTransform(vol / 100.0);
}
}
private function _setVolume(vol:int):void {
- debug("_setVolume: " + vol);
+ //debug("_setVolume: " + vol);
if (mic != null) {
- debug("_setVolume: not null");
+ //debug("_setVolume: not null");
mic.gain = vol;
}
}
@@ -211,6 +220,7 @@ public class OmVideo {
private function _connect(url:String):void {
nc.connect(url, {
ownerSid: params.sid
+ , roomClient: true
, nativeSsl: 'best' == params.proxyType
});
}
@@ -294,17 +304,15 @@ public class OmVideo {
switch (mode) {
case PLAY:
ns.pause();
- ns.dispose();
- clear();
break;
case BROADCAST:
case RECORD:
ns.publish(null); //false in original code
default:
- clear();
- ns.dispose();
break;
}
+ clear();
+ ns.dispose();
} else {
clear();
}
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/42c1aad6/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
index e8eb4fd..8f41b31 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
@@ -443,8 +443,11 @@ public class RoomPanel extends BasePanel {
return;
}
Client _c = getClient();
- handler.appendJavaScript(String.format("VideoManager.update(%s);"
- , c.toJson(_c.getUid().equals(c.getUid())).put("sid", _c.getSid())));
+ boolean self = _c.getUid().equals(c.getUid());
+ handler.appendJavaScript(String.format("VideoManager.update(%s, %s);"
+ , c.toJson(self).put("sid", _c.getSid())
+ , c.streamArray(self).toString()
+ ));
sidebar.update(handler);
menu.update(handler);
wb.update(handler);
@@ -563,7 +566,7 @@ public class RoomPanel extends BasePanel {
return;
}
if (!getClient().getUid().equals(c.getUid())) {
- handler.appendJavaScript(String.format("if (!!VideoManager) {VideoManager.micActivity('%s', %s);}", c.getUid(), obj.getBoolean("active")));
+ handler.appendJavaScript(String.format("if (VideoManager !== undefined) {VideoManager.micActivity('%s', %s);}", c.getUid(), obj.getBoolean("active")));
}
}
break;
http://git-wip-us.apache.org/repos/asf/openmeetings/blob/42c1aad6/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 635bf92..280d817 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
@@ -178,7 +178,9 @@ var Video = (function() {
t.removeClass('ui-state-highlight');
}
}
- swf[0].setVolume(val);
+ if (swf[0].setVolume !== undefined) {
+ swf[0].setVolume(val);
+ }
}
function _init(_box, _uid, _c, _pos) {
c = _c;
@@ -244,6 +246,15 @@ var Video = (function() {
}).dblclick(function(e) {
e.stopImmediatePropagation();
});
+ let refresh = v.parent().find('.ui-dialog-titlebar-refresh')
+ .click(function(e) {
+ e.stopImmediatePropagation();
+ if (swf[0].refresh !== undefined) {
+ swf[0].refresh();
+ }
+ }).dblclick(function(e) {
+ e.stopImmediatePropagation();
+ });
volume.on('mouseleave', function() {
$(this).hide();
});
@@ -291,7 +302,8 @@ var Video = (function() {
v.dialog("widget").css(_pos);
}
function _update(_c) {
- c = _c;
+ c.screenActivities = _c.screenActivities;
+ c.activities = _c.activities;
if (VideoUtil.hasAudio(c)) {
vol.show();
} else {
@@ -318,19 +330,26 @@ var VideoManager = (function() {
box = $('.room.box');
share = box.find('.icon.shared.ui-button');
}
- function _update(c) {
+ function _update(c, uids) {
if (options === undefined) {
return;
}
- var _id = VideoUtil.getVid(c.uid)
- , av = VideoUtil.hasAudio(c) || VideoUtil.hasVideo(c)
- , v = $('#' + _id);
- if (av && v.length != 1 && !!c.self) {
- Video().init(box, options.uid, c, VideoUtil.getPos(VideoUtil.getRects(VID_SEL), c.width, c.height + 25));
- } else if (av && v.length == 1) {
- v.data().update(c);
- } else if (!av && v.length == 1) {
- _closeV(v);
+ if (uids.length === 0) {
+ uids.push(c.uid);
+ }
+ for (let i = 0; i < uids.length; ++i) {
+ //TODO different features for different streams
+ // TODO width, height, AV
+ let _id = VideoUtil.getVid(uids[i])
+ , av = VideoUtil.hasAudio(c) || VideoUtil.hasVideo(c)
+ , v = $('#' + _id);
+ if (av && v.length != 1 && !!c.self) {
+ Video().init(box, options.uid, c, VideoUtil.getPos(VideoUtil.getRects(VID_SEL), c.width, c.height + 25));
+ } else if (av && v.length == 1) {
+ v.data().update(c);
+ } else if (!av && v.length == 1) {
+ _closeV(v);
+ }
}
}
function _closeV(v) {