|
@@ -9511,6 +9511,37 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream, isVideo, id)
|
9511
|
9511
|
this.VideoLayout.updateRemovedVideo(this.resourceJid);
|
9512
|
9512
|
};
|
9513
|
9513
|
|
|
9514
|
+RemoteVideo.prototype.waitForPlayback = function (stream) {
|
|
9515
|
+
|
|
9516
|
+ var isVideo = stream.getVideoTracks().length > 0;
|
|
9517
|
+ if (!isVideo || stream.id === 'mixedmslabel') {
|
|
9518
|
+ return;
|
|
9519
|
+ }
|
|
9520
|
+
|
|
9521
|
+ var self = this;
|
|
9522
|
+ var sel = this.VideoLayout.getPeerVideoSel(this.resourceJid);
|
|
9523
|
+
|
|
9524
|
+ // Register 'onplaying' listener to trigger 'videoactive' on VideoLayout
|
|
9525
|
+ // when video playback starts
|
|
9526
|
+ var onPlayingHandler = function () {
|
|
9527
|
+ // FIXME: why do i have to do this for FF?
|
|
9528
|
+ if (RTCBrowserType.isFirefox()) {
|
|
9529
|
+ APP.RTC.attachMediaStream(sel, stream);
|
|
9530
|
+ }
|
|
9531
|
+ if (RTCBrowserType.isTemasysPluginUsed()) {
|
|
9532
|
+ sel = $('#' + newElementId);
|
|
9533
|
+ }
|
|
9534
|
+ self.VideoLayout.videoactive(sel, self.resourceJid);
|
|
9535
|
+ sel[0].onplaying = null;
|
|
9536
|
+ if (RTCBrowserType.isTemasysPluginUsed()) {
|
|
9537
|
+ // 'currentTime' is used to check if the video has started
|
|
9538
|
+ // and the value is not set by the plugin, so we do it
|
|
9539
|
+ sel[0].currentTime = 1;
|
|
9540
|
+ }
|
|
9541
|
+ };
|
|
9542
|
+ sel[0].onplaying = onPlayingHandler;
|
|
9543
|
+};
|
|
9544
|
+
|
9514
|
9545
|
RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream, thessrc) {
|
9515
|
9546
|
if (!this.container)
|
9516
|
9547
|
return;
|
|
@@ -9526,35 +9557,12 @@ RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream, thessrc) {
|
9526
|
9557
|
sel.hide();
|
9527
|
9558
|
|
9528
|
9559
|
// If the container is currently visible we attach the stream.
|
9529
|
|
- if (!isVideo
|
9530
|
|
- || (this.container.offsetParent !== null && isVideo)) {
|
9531
|
|
-
|
9532
|
|
- // Register 'onplaying' listener to trigger 'videoactive' on VideoLayout
|
9533
|
|
- // when video playback starts
|
9534
|
|
- if (isVideo && stream.id !== 'mixedmslabel') {
|
9535
|
|
- var onPlayingHandler = function () {
|
9536
|
|
- // FIXME: why do i have to do this for FF?
|
9537
|
|
- if (RTCBrowserType.isFirefox()) {
|
9538
|
|
- APP.RTC.attachMediaStream(sel, stream);
|
9539
|
|
- }
|
9540
|
|
- if (RTCBrowserType.isTemasysPluginUsed()) {
|
9541
|
|
- sel = $('#' + newElementId);
|
9542
|
|
- }
|
9543
|
|
- self.VideoLayout.videoactive(sel, self.resourceJid);
|
9544
|
|
- sel[0].onplaying = null;
|
9545
|
|
- if (RTCBrowserType.isTemasysPluginUsed()) {
|
9546
|
|
- // 'currentTime' is used to check if the video has started
|
9547
|
|
- // and the value is not set by the plugin, so we do it
|
9548
|
|
- sel[0].currentTime = 1;
|
9549
|
|
- }
|
9550
|
|
- };
|
9551
|
|
- sel[0].onplaying = onPlayingHandler;
|
9552
|
|
- }
|
|
9560
|
+ if (!isVideo || (this.container.offsetParent !== null && isVideo)) {
|
|
9561
|
+ waitForPlayback(stream);
|
9553
|
9562
|
|
9554
|
9563
|
APP.RTC.attachMediaStream(sel, stream);
|
9555
|
9564
|
}
|
9556
|
9565
|
|
9557
|
|
- var self = this;
|
9558
|
9566
|
stream.onended = function () {
|
9559
|
9567
|
console.log('stream ended', this);
|
9560
|
9568
|
|
|
@@ -10595,7 +10603,7 @@ var VideoLayout = (function (my) {
|
10595
|
10603
|
}
|
10596
|
10604
|
|
10597
|
10605
|
var resource = Strophe.getResourceFromJid(jid);
|
10598
|
|
- var videoSel = VideoLayout.getVideoSelector(resource);
|
|
10606
|
+ var videoSel = VideoLayout.getPeerVideoSel(resource);
|
10599
|
10607
|
if (videoSel.length > 0) {
|
10600
|
10608
|
var videoThumb = videoSel[0];
|
10601
|
10609
|
// It is not always the case that a videoThumb exists (if there is
|
|
@@ -10833,7 +10841,7 @@ var VideoLayout = (function (my) {
|
10833
|
10841
|
|
10834
|
10842
|
updateLargeVideo = false;
|
10835
|
10843
|
}
|
10836
|
|
- remoteVideos[resourceJid].waitForRemoteVideo(sel, mediaStream.ssrc, mediaStream.stream);
|
|
10844
|
+ remoteVideos[resourceJid].waitForPlayback(mediaStream.stream);
|
10837
|
10845
|
}
|
10838
|
10846
|
});
|
10839
|
10847
|
}
|
|
@@ -14370,15 +14378,6 @@ JingleSession.prototype._modifySources = function (successCallback, queueCallbac
|
14370
|
14378
|
});
|
14371
|
14379
|
this.removessrc = [];
|
14372
|
14380
|
|
14373
|
|
- // FIXME:
|
14374
|
|
- // this was a hack for the situation when only one peer exists
|
14375
|
|
- // in the conference.
|
14376
|
|
- // check if still required and remove
|
14377
|
|
- if (sdp.media[0])
|
14378
|
|
- sdp.media[0] = sdp.media[0].replace('a=recvonly', 'a=sendrecv');
|
14379
|
|
- if (sdp.media[1])
|
14380
|
|
- sdp.media[1] = sdp.media[1].replace('a=recvonly', 'a=sendrecv');
|
14381
|
|
-
|
14382
|
14381
|
sdp.raw = sdp.session + sdp.media.join('');
|
14383
|
14382
|
this.peerconnection.setRemoteDescription(new RTCSessionDescription({type: 'offer', sdp: sdp.raw}),
|
14384
|
14383
|
function() {
|