From 1176390214e154a193ba11ebd8c02f4085cefb30 Mon Sep 17 00:00:00 2001 From: hristoterezov Date: Fri, 29 Jan 2016 13:31:58 -0600 Subject: [PATCH] Fixes issues for audio only participants --- conference.js | 15 +++++++++++---- modules/UI/videolayout/LargeVideo.js | 12 +++++++----- modules/UI/videolayout/VideoLayout.js | 1 + 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/conference.js b/conference.js index abf88f065..0f3cf4639 100644 --- a/conference.js +++ b/conference.js @@ -225,7 +225,9 @@ export default { return JitsiMeetJS.init(config).then(() => { return Promise.all([ - this.createLocalTracks('audio', 'video').catch( + this.createLocalTracks('audio', 'video').catch(()=>{ + return this.createLocalTracks('audio'); + }).catch( () => {return [];}), connect() ]); @@ -500,7 +502,7 @@ export default { handler(id , mute); }); room.on(ConferenceEvents.TRACK_AUDIO_LEVEL_CHANGED, (id, lvl) => { - if(this.isLocalId(id) && localAudio.isMuted()) { + if(this.isLocalId(id) && localAudio && localAudio.isMuted()) { lvl = 0; } @@ -584,9 +586,13 @@ export default { }); APP.UI.addListener(UIEvents.AUDIO_MUTED, (muted) => { + if(!localAudio) + return; (muted)? localAudio.mute() : localAudio.unmute(); }); APP.UI.addListener(UIEvents.VIDEO_MUTED, (muted) => { + if(!localVideo) + return; (muted)? localVideo.mute() : localVideo.unmute(); }); @@ -794,7 +800,7 @@ export default { APP.desktopsharing.addListener(DSEvents.NEW_STREAM_CREATED, (track, callback) => { const localCallback = (newTrack) => { - if(!newTrack || !newTrack.isLocal() || + if(!newTrack || !localVideo || !newTrack.isLocal() || newTrack !== localVideo) return; if(localVideo.isMuted() && @@ -808,7 +814,8 @@ export default { if(room) { room.on(ConferenceEvents.TRACK_ADDED, localCallback); } - localVideo.stop(); + if(localVideo) + localVideo.stop(); localVideo = track; addTrack(track); if(!room) diff --git a/modules/UI/videolayout/LargeVideo.js b/modules/UI/videolayout/LargeVideo.js index c39ef63ec..e7528bce9 100644 --- a/modules/UI/videolayout/LargeVideo.js +++ b/modules/UI/videolayout/LargeVideo.js @@ -277,6 +277,9 @@ class VideoContainer extends LargeContainer { this.stream = stream; this.videoType = videoType; + if(!stream) + return; + stream.attach(this.$video); let flipX = stream.isLocal() && !this.isScreenSharing(); @@ -421,7 +424,7 @@ export default class LargeVideoManager { // change the avatar url on large this.updateAvatar(Avatar.getAvatarUrl(id)); - let isVideoMuted = stream.isMuted(); + let isVideoMuted = stream? stream.isMuted() : true; // show the avatar on large if needed this.videoContainer.showAvatar(isVideoMuted); @@ -443,19 +446,18 @@ export default class LargeVideoManager { /** * Update large video. * Switches to large video even if previously other container was visible. + * @param userID the userID of the participant associated with the stream * @param {JitsiTrack?} stream new stream * @param {string?} videoType new video type * @returns {Promise} */ - updateLargeVideo (stream, videoType) { - let id = getStreamOwnerId(stream); - + updateLargeVideo (userID, stream, videoType) { if (this.newStreamData) { this.newStreamData.reject(); } this.newStreamData = createDeferred(); - this.newStreamData.id = id; + this.newStreamData.id = userID; this.newStreamData.stream = stream; this.newStreamData.videoType = videoType; diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js index 680541048..b83dfeaaf 100644 --- a/modules/UI/videolayout/VideoLayout.js +++ b/modules/UI/videolayout/VideoLayout.js @@ -987,6 +987,7 @@ var VideoLayout = { let videoType = this.getRemoteVideoType(id); largeVideo.updateLargeVideo( + id, smallVideo.videoStream, videoType ).then(function() {