Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Adds experimental active speaker detection.

paweldomase3f33c7a778a
diff --git a/data_channels.js b/data_channels.js
index 38d70741e7..e63015b894 100644
--- a/data_channels.js
+++ b/data_channels.js
@@ -1,3 +1,4 @@
+/* global connection, Strophe, updateLargeVideo*/
/**
* Callback triggered by PeerConnection when new data channel is opened
* on the bridge.
@@ -27,6 +28,34 @@ function onDataChannel(event)
{
var msgData = event.data;
console.info("Got Data Channel Message:", msgData, dataChannel);
+
+ // Active speaker event
+ if (msgData.indexOf('activeSpeaker') === 0)
+ {
+ // Endpoint ID from the bridge
+ var endpointId = msgData.split(":")[1];
+ console.info("New active speaker: " + endpointId);
+
+ var container = document.getElementById(
+ 'participant_' + endpointId);
+ // Check if local video
+ if (!container)
+ {
+ if (endpointId ===
+ Strophe.getResourceFromJid(connection.emuc.myroomjid))
+ {
+ container = document.getElementById('localVideoContainer');
+ }
+ }
+ if (container)
+ {
+ var video = container.getElementsByTagName("video");
+ if (video.length)
+ {
+ updateLargeVideo(video[0].src);
+ }
+ }
+ }
};
dataChannel.onclose = function ()
@@ -48,7 +77,7 @@ function bindDataChannelListener(peerConnection)
// and peer as single channel can be used for sending and receiving data.
// So either channel opened by the bridge or the one opened here is enough
// for communication with the bridge.
- var dataChannelOptions =
+ /*var dataChannelOptions =
{
reliable: true
};
@@ -60,4 +89,9 @@ function bindDataChannelListener(peerConnection)
{
dataChannel.send("My channel !!!");
};
+ dataChannel.onmessage = function (event)
+ {
+ var msgData = event.data;
+ console.info("Got My Data Channel Message:", msgData, dataChannel);
+ };*/
}
\ No newline at end of file
diff --git a/libs/strophe/strophe.jingle.adapter.js b/libs/strophe/strophe.jingle.adapter.js
index 8f273ea61a..7de3263cea 100644
--- a/libs/strophe/strophe.jingle.adapter.js
+++ b/libs/strophe/strophe.jingle.adapter.js
@@ -33,7 +33,7 @@ function TraceablePeerConnection(ice_config, constraints) {
// override as desired
this.trace = function (what, info) {
- console.warn('WTRACE', what, info);
+ //console.warn('WTRACE', what, info);
self.updateLog.push({
time: new Date(),
type: what,
diff --git a/muc.js b/muc.js
index dee2474a9c..0a05979d72 100644
--- a/muc.js
+++ b/muc.js
@@ -21,6 +21,9 @@ Strophe.addConnectionPlugin('emuc', {
},
doJoin: function (jid, password) {
this.myroomjid = jid;
+
+ console.info("Joined MUC as " + this.myroomjid);
+
this.initPresenceMap(this.myroomjid);
if (!this.roomjid) {