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 2018/09/30 11:10:35 UTC

[openmeetings] branch master updated: [OPENMEETINGS-1649] constraints creation seems to work

This is an automated email from the ASF dual-hosted git repository.

solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openmeetings.git


The following commit(s) were added to refs/heads/master by this push:
     new de7f5627 [OPENMEETINGS-1649] constraints creation seems to work
de7f5627 is described below

commit de7f5627f1558b51832b5ba12697f4fbf423f5aa
Author: Maxim Solodovnik <so...@gmail.com>
AuthorDate: Sun Sep 30 18:10:23 2018 +0700

    [OPENMEETINGS-1649] constraints creation seems to work
---
 openmeetings-web/pom.xml                           |  2 +-
 .../apache/openmeetings/web/room/RoomPanel.java    |  1 +
 .../apache/openmeetings/web/room/raw-settings.js   | 29 +++++++++++++++-------
 .../apache/openmeetings/web/room/raw-video-util.js |  4 +--
 .../org/apache/openmeetings/web/room/raw-video.js  | 21 ++++------------
 openmeetings-web/src/main/webapp/css/raw-room.css  |  3 ++-
 6 files changed, 31 insertions(+), 29 deletions(-)

diff --git a/openmeetings-web/pom.xml b/openmeetings-web/pom.xml
index db90eeb..1033e00 100644
--- a/openmeetings-web/pom.xml
+++ b/openmeetings-web/pom.xml
@@ -210,7 +210,6 @@
 							<jsSourceDir>../java/org/apache/openmeetings/web/room</jsSourceDir>
 							<jsSourceFiles>
 								<jsSourceFile>jquery.dialogextend.js</jsSourceFile>
-								<jsSourceFile>raw-video-util.js</jsSourceFile>
 								<jsSourceFile>raw-video.js</jsSourceFile>
 								<jsSourceFile>raw-video-manager.js</jsSourceFile>
 								<jsSourceFile>raw-room.js</jsSourceFile>
@@ -229,6 +228,7 @@
 							<charset>UTF-8</charset>
 							<jsSourceDir>../java/org/apache/openmeetings/web/room</jsSourceDir>
 							<jsSourceFiles>
+								<jsSourceFile>raw-video-util.js</jsSourceFile>
 								<jsSourceFile>raw-settings.js</jsSourceFile>
 								<jsSourceFile>kurento-utils.js</jsSourceFile>
 							</jsSourceFiles>
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 4292a63..5fc37fb 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
@@ -132,6 +132,7 @@ public class RoomPanel extends BasePanel {
 					.put("uid", _c.getUid())
 					.put("rights", _c.toJson(true).getJSONArray("rights"))
 					.put("interview", interview)
+					.put("audioOnly", r.isAudioOnly())
 					.put("showMicStatus", !r.getHiddenElements().contains(RoomElement.MicrophoneStatus))
 					.put("exclusiveTitle", getString("1386"));
 			if (!Strings.isEmpty(r.getRedirectURL()) && (ws.getSoapLogin() != null || ws.getInvitation() != null)) {
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/raw-settings.js b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/raw-settings.js
index 1790fff..14cb45a 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/raw-settings.js
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/raw-settings.js
@@ -249,28 +249,36 @@ var VideoSettings = (function() {
 	function _updateRec() {
 		recBtn.prop('disabled', !recAllowed || (s.video.cam < 0 && s.video.mic < 0)).button('refresh');
 	}
-	function _constraints() {
-		const cnts = {}
-			, v = cam.find('option:selected')
-			, m = mic.find('option:selected');
+	//each bool OR https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints
+	function _constraints(c) {
+		const cnts = {};
 		//TODO add check if constraint is supported
-		if (s.video.cam > -1) {
+		//TODO remove hardcodings
+		const o = typeof(Room) === 'object' ? Room.getOptions() : {audioOnly: false};
+		if (false === o.audioOnly && VideoUtil.hasVideo(c) && s.video.cam > -1) {
 			cnts.video = {
 				width: s.video.width
 				, height: s.video.height
-				, deviceId: { exact: v.data('device-id')  }
 				, frameRate: { max: 30 }
 			};
+			if (!!s.video.camDevice) {
+				cnts.video.deviceId = {
+					exact: s.video.camDevice
+				};
+			}
 		} else {
 			cnts.video = false;
 		}
-		if (s.video.mic > -1) {
-			//TODO remove hardcodings
+		if (VideoUtil.hasAudio(c) && s.video.mic > -1) {
 			cnts.audio = {
 				sampleSize: 22
-				, deviceId: { exact: m.data('device-id')  }
 				, echoCancellation: true
 			};
+			if (!!s.video.micDevice) {
+				cnts.audio.deviceId = {
+					exact: s.video.micDevice
+				};
+			}
 		} else {
 			cnts.audio = false;
 		}
@@ -281,7 +289,9 @@ var VideoSettings = (function() {
 			, m = mic.find('option:selected')
 			, o = res.find('option:selected').data();
 		s.video.cam = 1 * cam.val();
+		s.video.camDevice = v.data('device-id');
 		s.video.mic = 1 * mic.val();
+		s.video.micDevice = m.data('device-id');
 		s.video.width = o.width;
 		s.video.height = o.height;
 		vid.width(o.width).height(o.height);
@@ -467,5 +477,6 @@ var VideoSettings = (function() {
 		, close: function() { _close(); vs.dialog('close'); }
 		, load: _load
 		, save: _save
+		, constraints: _constraints
 	};
 })();
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/raw-video-util.js b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/raw-video-util.js
index 865c896..44742b6 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/raw-video-util.js
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/raw-video-util.js
@@ -18,10 +18,10 @@ var VideoUtil = (function() {
 			&& !c.screenActivities.includes('sharing');
 	}
 	function _hasAudio(c) {
-		return c.activities.includes(MIC_ACTIVITY);
+		return !c || c.activities.includes(MIC_ACTIVITY);
 	}
 	function _hasVideo(c) {
-		return c.activities.includes(CAM_ACTIVITY);
+		return !c || c.activities.includes(CAM_ACTIVITY);
 	}
 	function _getRects(sel, excl) {
 		const list = [], elems = $(sel);
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/raw-video.js b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/raw-video.js
index e6cc905..a5285c7 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/raw-video.js
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/raw-video.js
@@ -32,20 +32,8 @@ var Video = (function() {
 		vc.width(w).height(h);
 		video.width(w).height(h);
 	}
-	function _createGainableStream() {
-		//each bool OR https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints
-		const constraints = {
-			audio : VideoUtil.hasAudio(c)
-			, video : VideoUtil.hasVideo(c)
-		}
-		if (constraints.video) {
-			constraints.video = {
-				mandatory : {
-					maxWidth : c.width,
-					maxFrameRate : c.height,
-				}
-			};
-		}
+	function _createSendPeer() {
+		const constraints = VideoSettings.constraints(c);
 		navigator.mediaDevices.getUserMedia(constraints)
 			.then(function(stream) {
 				let _stream = stream;
@@ -294,8 +282,9 @@ var Video = (function() {
 			vc.addClass('audio-only').css('background-image', 'url(' + imgUrl + ')');
 		}
 		if (c.self) { //FIXME TODO multi-stream
-			_createGainableStream();
-		} else {
+			_createSendPeer();
+		} else if (VideoUtil.hasAudio(c)) {
+			vol.show();
 			_handleVolume(lastVolume);
 		}
 
diff --git a/openmeetings-web/src/main/webapp/css/raw-room.css b/openmeetings-web/src/main/webapp/css/raw-room.css
index c7fd6e0..5eab122 100644
--- a/openmeetings-web/src/main/webapp/css/raw-room.css
+++ b/openmeetings-web/src/main/webapp/css/raw-room.css
@@ -422,7 +422,8 @@ ul.settings-menu {
 }
 .room.box .user-video .video.audio-only {
 	background-repeat: no-repeat;
-	background-size: 100% 100%;
+	background-size: auto 100%;
+	background-position: center;
 }
 .pod-area {
 	display: inline-grid;