Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Fixes broken video muting.
paweldomas0da0f865a1ff
diff --git a/app.js b/app.jsindex efdd6d14c9..a7584d099e 100644--- a/app.js+++ b/app.js@@ -782,20 +782,21 @@ function getConferenceHandler() {function toggleVideo() {if (!(connection && connection.jingle.localVideo)) return;- var ismuted = false;- var localVideo = connection.jingle.localVideo;- for (var idx = 0; idx < localVideo.getVideoTracks().length; idx++) {- ismuted = !localVideo.getVideoTracks()[idx].enabled;- }- for (var idx = 0; idx < localVideo.getVideoTracks().length; idx++) {- localVideo.getVideoTracks()[idx].enabled = !localVideo.getVideoTracks()[idx].enabled;- }+var sess = getConferenceHandler();if (sess) {- return;+ sess.toggleVideoMute(+ function(isMuted){+ if(isMuted) {+ $('#video').removeClass("fa fa-video-camera fa-lg");+ $('#video').addClass("fa fa-video-camera no-fa-video-camera fa-lg");+ } else {+ $('#video').removeClass("fa fa-video-camera no-fa-video-camera fa-lg");+ $('#video').addClass("fa fa-video-camera fa-lg");+ }+ }+ );}- sess.peerconnection.pendingop = ismuted ? 'unmute' : 'mute';- sess.peerconnection.modifySources();}function toggleAudio() {diff --git a/index.html b/index.htmlindex a2904c8d0c..392fbc08e6 100644--- a/index.html+++ b/index.html@@ -38,7 +38,7 @@<a class="button" onclick='buttonClick("#mute", "fa fa-microphone fa-lg fa fa-microphone-slash fa-lg");toggleAudio();'><i id="mute" title="Mute / unmute" class="fa fa-microphone fa-lg"></i></a><div class="header_button_separator"></div>- <a class="button" onclick='buttonClick("#video", "fa fa-video-camera fa-lg fa fa-video-camera no-fa-video-camera fa-lg");toggleVideo();'>+ <a class="button" onclick='buttonClick("#video");toggleVideo();'><i id="video" title="Start / stop camera" class="fa fa-video-camera fa-lg"></i></a><div class="header_button_separator"></div><a class="button" onclick="openLockDialog();"><i id="lockIcon" title="Lock/unlock room" class="fa fa-unlock fa-lg"></i></a>diff --git a/libs/strophe/strophe.jingle.adapter.js b/libs/strophe/strophe.jingle.adapter.jsindex 40200040cd..b24f82dad9 100644--- a/libs/strophe/strophe.jingle.adapter.js+++ b/libs/strophe/strophe.jingle.adapter.js@@ -189,7 +189,6 @@ TraceablePeerConnection.prototype.setRemoteDescription = function (description,TraceablePeerConnection.prototype.hardMuteVideo = function (muted) {this.pendingop = muted ? 'mute' : 'unmute';- this.modifySources();};TraceablePeerConnection.prototype.enqueueAddSsrc = function(channel, ssrcLines) {@@ -338,9 +337,11 @@ TraceablePeerConnection.prototype.modifySources = function(successCallback) {switch(self.pendingop) {case 'mute':sdp.media[1] = sdp.media[1].replace('a=sendrecv', 'a=recvonly');+ console.error("MUTE");break;case 'unmute':sdp.media[1] = sdp.media[1].replace('a=recvonly', 'a=sendrecv');+ console.error("UNMUTE");break;}sdp.raw = sdp.session + sdp.media.join('');diff --git a/libs/strophe/strophe.jingle.sessionbase.js b/libs/strophe/strophe.jingle.sessionbase.jsindex b35d2a6fed..ac389d2c6b 100644--- a/libs/strophe/strophe.jingle.sessionbase.js+++ b/libs/strophe/strophe.jingle.sessionbase.js@@ -170,11 +170,17 @@ SessionBase.prototype.sendSSRCUpdateIq = function(sdpMediaSsrcs, sid, initiator,// SDP-based mute by going recvonly/sendrecv// FIXME: should probably black out the screen as well-SessionBase.prototype.hardMuteVideo = function (muted) {+SessionBase.prototype.toggleVideoMute = function (callback) {- this.peerconnection.hardMuteVideo(muted);+ var ismuted = false;+ var localVideo = connection.jingle.localVideo;+ for (var idx = 0; idx < localVideo.getVideoTracks().length; idx++) {+ ismuted = !localVideo.getVideoTracks()[idx].enabled;+ }+ for (var idx = 0; idx < localVideo.getVideoTracks().length; idx++) {+ localVideo.getVideoTracks()[idx].enabled = !localVideo.getVideoTracks()[idx].enabled;+ }- this.connection.jingle.localVideo.getVideoTracks().forEach(function (track) {- track.enabled = !muted;- });+ this.peerconnection.hardMuteVideo(!ismuted);+ this.modifySources(callback(!ismuted));};\ No newline at end of file