|
@@ -55,6 +55,8 @@ function ColibriFocus(connection, bridgejid) {
|
55
|
55
|
this.addssrc = [];
|
56
|
56
|
// ssrc lines to be removed on next update
|
57
|
57
|
this.removessrc = [];
|
|
58
|
+ // pending mute/unmute video op that modify local description
|
|
59
|
+ this.pendingop = null;
|
58
|
60
|
|
59
|
61
|
// container for candidates from the focus
|
60
|
62
|
// gathered before confid is known
|
|
@@ -802,8 +804,8 @@ ColibriFocus.prototype.terminate = function (session, reason) {
|
802
|
804
|
|
803
|
805
|
ColibriFocus.prototype.modifySources = function () {
|
804
|
806
|
var self = this;
|
805
|
|
- if (!(this.addssrc.length || this.removessrc.length)) return;
|
806
|
807
|
if (this.peerconnection.signalingState == 'closed') return;
|
|
808
|
+ if (!(this.addssrc.length || this.removessrc.length || this.pendingop !== null)) return;
|
807
|
809
|
|
808
|
810
|
// FIXME: this is a big hack
|
809
|
811
|
// https://code.google.com/p/webrtc/issues/detail?id=2688
|
|
@@ -844,6 +846,25 @@ ColibriFocus.prototype.modifySources = function () {
|
844
|
846
|
self.peerconnection.createAnswer(
|
845
|
847
|
function (modifiedAnswer) {
|
846
|
848
|
console.log('modifiedAnswer created');
|
|
849
|
+
|
|
850
|
+ // change video direction, see https://github.com/jitsi/jitmeet/issues/41
|
|
851
|
+ if (self.pendingop !== null) {
|
|
852
|
+ var sdp = new SDP(modifiedAnswer.sdp);
|
|
853
|
+ if (sdp.media.length > 1) {
|
|
854
|
+ switch(self.pendingop) {
|
|
855
|
+ case 'mute':
|
|
856
|
+ sdp.media[1] = sdp.media[1].replace('a=sendrecv', 'a=recvonly');
|
|
857
|
+ break;
|
|
858
|
+ case 'unmute':
|
|
859
|
+ sdp.media[1] = sdp.media[1].replace('a=recvonly', 'a=sendrecv');
|
|
860
|
+ break;
|
|
861
|
+ }
|
|
862
|
+ sdp.raw = sdp.session + sdp.media.join('');
|
|
863
|
+ modifiedAnswer.sdp = sdp.raw;
|
|
864
|
+ }
|
|
865
|
+ self.pendingop = null;
|
|
866
|
+ }
|
|
867
|
+
|
847
|
868
|
// FIXME: pushing down an answer while ice connection state
|
848
|
869
|
// is still checking is bad...
|
849
|
870
|
//console.log(self.peerconnection.iceConnectionState);
|
|
@@ -900,6 +921,15 @@ ColibriFocus.prototype.modifySources = function () {
|
900
|
921
|
*/
|
901
|
922
|
};
|
902
|
923
|
|
|
924
|
+ColibriFocus.prototype.hardMuteVideo = function (muted) {
|
|
925
|
+ this.pendingop = muted ? 'mute' : 'unmute';
|
|
926
|
+ this.modifySources();
|
|
927
|
+
|
|
928
|
+ this.localStream.getVideoTracks.forEach(function (track) {
|
|
929
|
+ track.enabled = !muted;
|
|
930
|
+ });
|
|
931
|
+};
|
|
932
|
+
|
903
|
933
|
// A colibri session is similar to a jingle session, it just implements some things differently
|
904
|
934
|
// FIXME: inherit jinglesession, see https://github.com/legastero/Jingle-RTCPeerConnection/blob/master/index.js
|
905
|
935
|
function ColibriSession(me, sid, connection) {
|