Skip to content

Commit

Permalink
Merge pull request #1574 from nextcloud/fix-disabling-video-when-join…
Browse files Browse the repository at this point in the history
…ing-a-call-in-a-room-with-more-than-five-participants

Fix disabling video when joining a call in a room with more than five participants
  • Loading branch information
nickvergessen authored Feb 25, 2019
2 parents f7e9982 + 726eb60 commit 2f4726d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
25 changes: 12 additions & 13 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@
self.stopListening(self.activeRoom, 'change:displayName');
self.stopListening(self.activeRoom, 'change:participantFlags');

var participants;
if (OC.getCurrentUser().uid) {
roomChannel.trigger('active', token);

Expand All @@ -337,15 +336,6 @@
self.activeRoom = room;
}
});
participants = self.activeRoom.get('participants');
} else {
// The public page supports only a single room, so the
// active room is already the room for the given token.
participants = self.activeRoom.get('participants');
}
// Disable video when entering a room with more than 5 participants.
if (participants && Object.keys(participants).length > 5) {
self.disableVideo();
}

self._emptyContentView.setActiveRoom(self.activeRoom);
Expand Down Expand Up @@ -605,6 +595,15 @@
}
}.bind(this));

this.signaling.on('joinCall', function() {
// Disable video when joining a call in a room with more than 5
// participants.
var participants = this.activeRoom.get('participants');
if (participants && Object.keys(participants).length > 5) {
this.disableVideo();
}
}.bind(this));

$(window).unload(function () {
this.connection.leaveCurrentRoom();
this.signaling.disconnect();
Expand Down Expand Up @@ -792,9 +791,9 @@
localVideo.hide();
},
disableVideo: function() {
this._mediaControlsView.disableVideo();
// Always hide the video, even if "disableVideo" returned "false".
this.hideVideo();
if (this._mediaControlsView.disableVideo()) {
this.hideVideo();
}
},
// Called from webrtc.js
disableScreensharingButton: function() {
Expand Down
21 changes: 12 additions & 9 deletions js/embedded.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
.then(function() {
self.stopListening(self.activeRoom, 'change:participantFlags');

var participants;
if (OC.getCurrentUser().uid) {
roomChannel.trigger('active', token);

Expand All @@ -92,11 +91,6 @@
self.activeRoom = room;
}
});
participants = self.activeRoom.get('participants');
}
// Disable video when entering a room with more than 5 participants.
if (participants && Object.keys(participants).length > 5) {
self.disableVideo();
}
});
},
Expand Down Expand Up @@ -127,6 +121,15 @@
this.signaling = OCA.Talk.Signaling.createConnection();
this.connection = new OCA.Talk.Connection(this);

this.signaling.on('joinCall', function() {
// Disable video when joining a call in a room with more than 5
// participants.
var participants = this.activeRoom.get('participants');
if (participants && Object.keys(participants).length > 5) {
this.disableVideo();
}
}.bind(this));

$(window).unload(function () {
this.connection.leaveCurrentRoom();
this.signaling.disconnect();
Expand Down Expand Up @@ -234,9 +237,9 @@
localVideo.hide();
},
disableVideo: function() {
this._mediaControlsView.disableVideo();
// Always hide the video, even if "disableVideo" returned "false".
this.hideVideo();
if (this._mediaControlsView.disableVideo()) {
this.hideVideo();
}
},
// Called from webrtc.js
disableScreensharingButton: function() {
Expand Down

0 comments on commit 2f4726d

Please sign in to comment.