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/toastr.js?v=1"></script><!-- notifications lib -->
<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 -->
<link rel="stylesheet" href="css/font.css?v=7"/>
<link rel="stylesheet" href="css/toastr.css?v=1">

View File

@ -9511,6 +9511,37 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream, isVideo, id)
this.VideoLayout.updateRemovedVideo(this.resourceJid);
};
RemoteVideo.prototype.waitForPlayback = function (stream) {
var isVideo = stream.getVideoTracks().length > 0;
if (!isVideo || stream.id === 'mixedmslabel') {
return;
}
var self = this;
var sel = this.VideoLayout.getPeerVideoSel(this.resourceJid);
// Register 'onplaying' listener to trigger 'videoactive' on VideoLayout
// when video playback starts
var onPlayingHandler = function () {
// FIXME: why do i have to do this for FF?
if (RTCBrowserType.isFirefox()) {
APP.RTC.attachMediaStream(sel, stream);
}
if (RTCBrowserType.isTemasysPluginUsed()) {
sel = $('#' + newElementId);
}
self.VideoLayout.videoactive(sel, self.resourceJid);
sel[0].onplaying = null;
if (RTCBrowserType.isTemasysPluginUsed()) {
// 'currentTime' is used to check if the video has started
// and the value is not set by the plugin, so we do it
sel[0].currentTime = 1;
}
};
sel[0].onplaying = onPlayingHandler;
};
RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream, thessrc) {
if (!this.container)
return;
@ -9526,35 +9557,12 @@ RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream, thessrc) {
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
// when video playback starts
if (isVideo && stream.id !== 'mixedmslabel') {
var onPlayingHandler = function () {
// FIXME: why do i have to do this for FF?
if (RTCBrowserType.isFirefox()) {
APP.RTC.attachMediaStream(sel, stream);
}
if (RTCBrowserType.isTemasysPluginUsed()) {
sel = $('#' + newElementId);
}
self.VideoLayout.videoactive(sel, self.resourceJid);
sel[0].onplaying = null;
if (RTCBrowserType.isTemasysPluginUsed()) {
// 'currentTime' is used to check if the video has started
// and the value is not set by the plugin, so we do it
sel[0].currentTime = 1;
}
};
sel[0].onplaying = onPlayingHandler;
}
if (!isVideo || (this.container.offsetParent !== null && isVideo)) {
waitForPlayback(stream);
APP.RTC.attachMediaStream(sel, stream);
}
var self = this;
stream.onended = function () {
console.log('stream ended', this);
@ -10595,7 +10603,7 @@ var VideoLayout = (function (my) {
}
var resource = Strophe.getResourceFromJid(jid);
var videoSel = VideoLayout.getVideoSelector(resource);
var videoSel = VideoLayout.getPeerVideoSel(resource);
if (videoSel.length > 0) {
var videoThumb = videoSel[0];
// It is not always the case that a videoThumb exists (if there is
@ -10833,7 +10841,7 @@ var VideoLayout = (function (my) {
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 = [];
// 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('');
this.peerconnection.setRemoteDescription(new RTCSessionDescription({type: 'offer', sdp: sdp.raw}),
function() {

View File

@ -165,6 +165,37 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream, isVideo, id)
this.VideoLayout.updateRemovedVideo(this.resourceJid);
};
RemoteVideo.prototype.waitForPlayback = function (stream) {
var isVideo = stream.getVideoTracks().length > 0;
if (!isVideo || stream.id === 'mixedmslabel') {
return;
}
var self = this;
var sel = this.VideoLayout.getPeerVideoSel(this.resourceJid);
// Register 'onplaying' listener to trigger 'videoactive' on VideoLayout
// when video playback starts
var onPlayingHandler = function () {
// FIXME: why do i have to do this for FF?
if (RTCBrowserType.isFirefox()) {
APP.RTC.attachMediaStream(sel, stream);
}
if (RTCBrowserType.isTemasysPluginUsed()) {
sel = $('#' + newElementId);
}
self.VideoLayout.videoactive(sel, self.resourceJid);
sel[0].onplaying = null;
if (RTCBrowserType.isTemasysPluginUsed()) {
// 'currentTime' is used to check if the video has started
// and the value is not set by the plugin, so we do it
sel[0].currentTime = 1;
}
};
sel[0].onplaying = onPlayingHandler;
};
RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream, thessrc) {
if (!this.container)
return;
@ -180,35 +211,12 @@ RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream, thessrc) {
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
// when video playback starts
if (isVideo && stream.id !== 'mixedmslabel') {
var onPlayingHandler = function () {
// FIXME: why do i have to do this for FF?
if (RTCBrowserType.isFirefox()) {
APP.RTC.attachMediaStream(sel, stream);
}
if (RTCBrowserType.isTemasysPluginUsed()) {
sel = $('#' + newElementId);
}
self.VideoLayout.videoactive(sel, self.resourceJid);
sel[0].onplaying = null;
if (RTCBrowserType.isTemasysPluginUsed()) {
// 'currentTime' is used to check if the video has started
// and the value is not set by the plugin, so we do it
sel[0].currentTime = 1;
}
};
sel[0].onplaying = onPlayingHandler;
}
if (!isVideo || (this.container.offsetParent !== null && isVideo)) {
waitForPlayback(stream);
APP.RTC.attachMediaStream(sel, stream);
}
var self = this;
stream.onended = function () {
console.log('stream ended', this);

View File

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