Fixes call to undefined method(which fixes crash on lastN switch and when clicking contact on the contactlist).

This commit is contained in:
paweldomas 2015-07-15 14:01:36 +02:00
parent 2b103288c2
commit 420bbe136c
4 changed files with 71 additions and 64 deletions

View File

@ -22,7 +22,7 @@
<script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib --> <script src="libs/popover.js?v=1"></script><!-- bootstrap tooltip lib -->
<script src="libs/toastr.js?v=1"></script><!-- notifications lib --> <script src="libs/toastr.js?v=1"></script><!-- notifications lib -->
<script src="interface_config.js?v=5"></script> <script src="interface_config.js?v=5"></script>
<script src="libs/app.bundle.js?v=101"></script> <script src="libs/app.bundle.js?v=102"></script>
<script src="analytics.js?v=1"></script><!-- google analytics plugin --> <script src="analytics.js?v=1"></script><!-- google analytics plugin -->
<link rel="stylesheet" href="css/font.css?v=7"/> <link rel="stylesheet" href="css/font.css?v=7"/>
<link rel="stylesheet" href="css/toastr.css?v=1"> <link rel="stylesheet" href="css/toastr.css?v=1">

View File

@ -9511,27 +9511,18 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream, isVideo, id)
this.VideoLayout.updateRemovedVideo(this.resourceJid); this.VideoLayout.updateRemovedVideo(this.resourceJid);
}; };
RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream, thessrc) { RemoteVideo.prototype.waitForPlayback = function (stream) {
if (!this.container)
var isVideo = stream.getVideoTracks().length > 0;
if (!isVideo || stream.id === 'mixedmslabel') {
return; return;
}
var self = this; var self = this;
var isVideo = stream.getVideoTracks().length > 0; var sel = this.VideoLayout.getPeerVideoSel(this.resourceJid);
var streamElement = SmallVideo.createStreamElement(sid, stream);
var newElementId = streamElement.id;
this.container.appendChild(streamElement);
var sel = $('#' + newElementId);
sel.hide();
// If the container is currently visible we attach the stream.
if (!isVideo
|| (this.container.offsetParent !== null && isVideo)) {
// Register 'onplaying' listener to trigger 'videoactive' on VideoLayout // Register 'onplaying' listener to trigger 'videoactive' on VideoLayout
// when video playback starts // when video playback starts
if (isVideo && stream.id !== 'mixedmslabel') {
var onPlayingHandler = function () { var onPlayingHandler = function () {
// FIXME: why do i have to do this for FF? // FIXME: why do i have to do this for FF?
if (RTCBrowserType.isFirefox()) { if (RTCBrowserType.isFirefox()) {
@ -9549,12 +9540,29 @@ RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream, thessrc) {
} }
}; };
sel[0].onplaying = onPlayingHandler; sel[0].onplaying = onPlayingHandler;
} };
RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream, thessrc) {
if (!this.container)
return;
var self = this;
var isVideo = stream.getVideoTracks().length > 0;
var streamElement = SmallVideo.createStreamElement(sid, stream);
var newElementId = streamElement.id;
this.container.appendChild(streamElement);
var sel = $('#' + newElementId);
sel.hide();
// If the container is currently visible we attach the stream.
if (!isVideo || (this.container.offsetParent !== null && isVideo)) {
waitForPlayback(stream);
APP.RTC.attachMediaStream(sel, stream); APP.RTC.attachMediaStream(sel, stream);
} }
var self = this;
stream.onended = function () { stream.onended = function () {
console.log('stream ended', this); console.log('stream ended', this);
@ -10595,7 +10603,7 @@ var VideoLayout = (function (my) {
} }
var resource = Strophe.getResourceFromJid(jid); var resource = Strophe.getResourceFromJid(jid);
var videoSel = VideoLayout.getVideoSelector(resource); var videoSel = VideoLayout.getPeerVideoSel(resource);
if (videoSel.length > 0) { if (videoSel.length > 0) {
var videoThumb = videoSel[0]; var videoThumb = videoSel[0];
// It is not always the case that a videoThumb exists (if there is // It is not always the case that a videoThumb exists (if there is
@ -10833,7 +10841,7 @@ var VideoLayout = (function (my) {
updateLargeVideo = false; updateLargeVideo = false;
} }
remoteVideos[resourceJid].waitForRemoteVideo(sel, mediaStream.ssrc, mediaStream.stream); remoteVideos[resourceJid].waitForPlayback(mediaStream.stream);
} }
}); });
} }
@ -14370,15 +14378,6 @@ JingleSession.prototype._modifySources = function (successCallback, queueCallbac
}); });
this.removessrc = []; this.removessrc = [];
// FIXME:
// this was a hack for the situation when only one peer exists
// in the conference.
// check if still required and remove
if (sdp.media[0])
sdp.media[0] = sdp.media[0].replace('a=recvonly', 'a=sendrecv');
if (sdp.media[1])
sdp.media[1] = sdp.media[1].replace('a=recvonly', 'a=sendrecv');
sdp.raw = sdp.session + sdp.media.join(''); sdp.raw = sdp.session + sdp.media.join('');
this.peerconnection.setRemoteDescription(new RTCSessionDescription({type: 'offer', sdp: sdp.raw}), this.peerconnection.setRemoteDescription(new RTCSessionDescription({type: 'offer', sdp: sdp.raw}),
function() { function() {

View File

@ -165,27 +165,18 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream, isVideo, id)
this.VideoLayout.updateRemovedVideo(this.resourceJid); this.VideoLayout.updateRemovedVideo(this.resourceJid);
}; };
RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream, thessrc) { RemoteVideo.prototype.waitForPlayback = function (stream) {
if (!this.container)
var isVideo = stream.getVideoTracks().length > 0;
if (!isVideo || stream.id === 'mixedmslabel') {
return; return;
}
var self = this; var self = this;
var isVideo = stream.getVideoTracks().length > 0; var sel = this.VideoLayout.getPeerVideoSel(this.resourceJid);
var streamElement = SmallVideo.createStreamElement(sid, stream);
var newElementId = streamElement.id;
this.container.appendChild(streamElement);
var sel = $('#' + newElementId);
sel.hide();
// If the container is currently visible we attach the stream.
if (!isVideo
|| (this.container.offsetParent !== null && isVideo)) {
// Register 'onplaying' listener to trigger 'videoactive' on VideoLayout // Register 'onplaying' listener to trigger 'videoactive' on VideoLayout
// when video playback starts // when video playback starts
if (isVideo && stream.id !== 'mixedmslabel') {
var onPlayingHandler = function () { var onPlayingHandler = function () {
// FIXME: why do i have to do this for FF? // FIXME: why do i have to do this for FF?
if (RTCBrowserType.isFirefox()) { if (RTCBrowserType.isFirefox()) {
@ -203,12 +194,29 @@ RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream, thessrc) {
} }
}; };
sel[0].onplaying = onPlayingHandler; sel[0].onplaying = onPlayingHandler;
} };
RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream, thessrc) {
if (!this.container)
return;
var self = this;
var isVideo = stream.getVideoTracks().length > 0;
var streamElement = SmallVideo.createStreamElement(sid, stream);
var newElementId = streamElement.id;
this.container.appendChild(streamElement);
var sel = $('#' + newElementId);
sel.hide();
// If the container is currently visible we attach the stream.
if (!isVideo || (this.container.offsetParent !== null && isVideo)) {
waitForPlayback(stream);
APP.RTC.attachMediaStream(sel, stream); APP.RTC.attachMediaStream(sel, stream);
} }
var self = this;
stream.onended = function () { stream.onended = function () {
console.log('stream ended', this); console.log('stream ended', this);

View File

@ -475,7 +475,7 @@ var VideoLayout = (function (my) {
} }
var resource = Strophe.getResourceFromJid(jid); var resource = Strophe.getResourceFromJid(jid);
var videoSel = VideoLayout.getVideoSelector(resource); var videoSel = VideoLayout.getPeerVideoSel(resource);
if (videoSel.length > 0) { if (videoSel.length > 0) {
var videoThumb = videoSel[0]; var videoThumb = videoSel[0];
// It is not always the case that a videoThumb exists (if there is // It is not always the case that a videoThumb exists (if there is
@ -713,7 +713,7 @@ var VideoLayout = (function (my) {
updateLargeVideo = false; updateLargeVideo = false;
} }
remoteVideos[resourceJid].waitForRemoteVideo(sel, mediaStream.ssrc, mediaStream.stream); remoteVideos[resourceJid].waitForPlayback(mediaStream.stream);
} }
}); });
} }