From 0902cbb16495e295507a93a2fc4139ee33889bf9 Mon Sep 17 00:00:00 2001 From: paweldomas Date: Wed, 22 Jul 2015 13:57:54 +0200 Subject: [PATCH] Fixes problems with Temasys plugin support in Safari. --- modules/RTC/RTCUtils.js | 4 ++-- modules/UI/videolayout/LargeVideo.js | 9 +++++++-- modules/UI/videolayout/RemoteVideo.js | 5 ++--- modules/UI/videolayout/VideoLayout.js | 2 +- modules/statistics/LocalStatsCollector.js | 4 +++- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/modules/RTC/RTCUtils.js b/modules/RTC/RTCUtils.js index fba37e61b..b182fe7c1 100644 --- a/modules/RTC/RTCUtils.js +++ b/modules/RTC/RTCUtils.js @@ -234,8 +234,8 @@ function RTCUtils(RTCService, onTemasysPluginReady) // Detect IE/Safari else if (RTCBrowserType.isTemasysPluginUsed()) { - AdapterJS.WebRTCPlugin.setLogLevel( - AdapterJS.WebRTCPlugin.PLUGIN_LOG_LEVELS.VERBOSE); + //AdapterJS.WebRTCPlugin.setLogLevel( + // AdapterJS.WebRTCPlugin.PLUGIN_LOG_LEVELS.VERBOSE); AdapterJS.webRTCReady(function (isPlugin) { diff --git a/modules/UI/videolayout/LargeVideo.js b/modules/UI/videolayout/LargeVideo.js index fb3cfcd32..7cdb17b5c 100644 --- a/modules/UI/videolayout/LargeVideo.js +++ b/modules/UI/videolayout/LargeVideo.js @@ -299,8 +299,13 @@ var LargeVideo = { // or null. this.eventEmitter.emit(UIEvents.SELECTED_ENDPOINT, resourceJid); } - $('#largeVideo').fadeOut(300, - changeVideo.bind($('#largeVideo'), this.isLargeVideoVisible())); + if (RTCBrowserType.isSafari()) { + // FIXME In Safari fadeOut works only for the first time + changeVideo(this.isLargeVideoVisible()); + } else { + $('#largeVideo').fadeOut(300, + changeVideo.bind($('#largeVideo'), this.isLargeVideoVisible())); + } } else { if (currentSmallVideo) { currentSmallVideo.showAvatar(); diff --git a/modules/UI/videolayout/RemoteVideo.js b/modules/UI/videolayout/RemoteVideo.js index d51424b51..844d17605 100644 --- a/modules/UI/videolayout/RemoteVideo.js +++ b/modules/UI/videolayout/RemoteVideo.js @@ -165,7 +165,7 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream, isVideo, id) this.VideoLayout.updateRemovedVideo(this.getResourceJid()); }; -RemoteVideo.prototype.waitForPlayback = function (stream) { +RemoteVideo.prototype.waitForPlayback = function (sel, stream) { var isVideo = stream.getVideoTracks().length > 0; if (!isVideo || stream.id === 'mixedmslabel') { @@ -174,7 +174,6 @@ RemoteVideo.prototype.waitForPlayback = function (stream) { var self = this; var resourceJid = this.getResourceJid(); - var sel = this.VideoLayout.getPeerVideoSel(resourceJid); // Register 'onplaying' listener to trigger 'videoactive' on VideoLayout // when video playback starts @@ -213,7 +212,7 @@ RemoteVideo.prototype.addRemoteStreamElement = function (sid, stream, thessrc) { // If the container is currently visible we attach the stream. if (!isVideo || (this.container.offsetParent !== null && isVideo)) { - this.waitForPlayback(stream); + this.waitForPlayback(sel, stream); APP.RTC.attachMediaStream(sel, stream); } diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js index 8e698649d..df283f949 100644 --- a/modules/UI/videolayout/VideoLayout.js +++ b/modules/UI/videolayout/VideoLayout.js @@ -715,7 +715,7 @@ var VideoLayout = (function (my) { updateLargeVideo = false; } - remoteVideos[resourceJid].waitForPlayback(mediaStream.stream); + remoteVideos[resourceJid].waitForPlayback(sel, mediaStream.stream); } }); } diff --git a/modules/statistics/LocalStatsCollector.js b/modules/statistics/LocalStatsCollector.js index 40c2a816b..04cf6db39 100644 --- a/modules/statistics/LocalStatsCollector.js +++ b/modules/statistics/LocalStatsCollector.js @@ -2,6 +2,7 @@ * Provides statistics for the local stream. */ +var RTCBrowserType = require('../RTC/RTCBrowserType'); /** * Size of the webaudio analizer buffer. @@ -84,7 +85,8 @@ function LocalStatsCollector(stream, interval, statisticsService, eventEmitter) * Starts the collecting the statistics. */ LocalStatsCollector.prototype.start = function () { - if (config.disableAudioLevels || !window.AudioContext) + if (config.disableAudioLevels || !window.AudioContext + || RTCBrowserType.isTemasysPluginUsed()) return; var context = new AudioContext();