Browse Source

VideoWaiter should re-check availability of video if video gets unmuted

This fixes receiving videos to not be shown sometimes. Usually caused
when using a TURN server or MCU.
pull/414/head
Leon Klingele 9 years ago committed by Leon Klingele
parent
commit
89a2dc10fa
No known key found for this signature in database
GPG Key ID: 83AEC0FEBAA5D483
  1. 7
      static/js/services/videowaiter.js

7
static/js/services/videowaiter.js

@ -36,6 +36,7 @@ define(["underscore"], function(_) { @@ -36,6 +36,7 @@ define(["underscore"], function(_) {
}
return;
}
var recheck = _.bind(this.start, this, video, stream, cb, err_cb);
var videoTracks = stream && stream.getVideoTracks() || [];
//console.log("wait for video", videoTracks.length, video.currentTime, video.videoHeight, video);
if (videoTracks.length === 0 && this.count >= 10) {
@ -46,13 +47,17 @@ define(["underscore"], function(_) { @@ -46,13 +47,17 @@ define(["underscore"], function(_) {
if (videoTracks.length > 0 && this.count >= 10) {
var videoTrack = videoTracks[0];
if (videoTrack.enabled === true && videoTrack.muted === true) {
videoTrack.onunmute = function() {
videoTrack.onunmute = undefined;
recheck();
};
cb(false, video, stream);
return;
}
}
this.count++;
if (this.count < this.retries) {
$window.setTimeout(_.bind(this.start, this, video, stream, cb, err_cb), 100);
$window.setTimeout(recheck, 100);
} else {
if (err_cb) {
err_cb(video, stream);

Loading…
Cancel
Save