diff --git a/bigbluebutton-html5/imports/ui/components/screenshare/service.js b/bigbluebutton-html5/imports/ui/components/screenshare/service.js index ca9e566d8ceb3b1951b4810e1c789d1d1cf3679d..091afd2e03fb147860fa5a7644753faa75811228 100644 --- a/bigbluebutton-html5/imports/ui/components/screenshare/service.js +++ b/bigbluebutton-html5/imports/ui/components/screenshare/service.js @@ -3,7 +3,6 @@ import KurentoBridge from '/imports/api/screenshare/client/bridge'; import BridgeService from '/imports/api/screenshare/client/bridge/service'; import Settings from '/imports/ui/services/settings'; import logger from '/imports/startup/client/logger'; -import { tryGenerateIceCandidates } from '/imports/utils/safari-webrtc'; import { stopWatching } from '/imports/ui/components/external-video-player/service'; import Meetings from '/imports/api/meetings'; import Auth from '/imports/ui/services/auth'; diff --git a/bigbluebutton-html5/imports/ui/components/video-provider/component.jsx b/bigbluebutton-html5/imports/ui/components/video-provider/component.jsx index c2b6fb475db134c3d19ed5eda99780a3cc2c31f4..0f0573223a7672cafd7344ffc6d325519fb0b643 100755 --- a/bigbluebutton-html5/imports/ui/components/video-provider/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/video-provider/component.jsx @@ -9,7 +9,6 @@ import { fetchWebRTCMappedStunTurnServers, getMappedFallbackStun, } from '/imports/utils/fetchStunTurnServers'; -import { tryGenerateIceCandidates } from '/imports/utils/safari-webrtc'; import logger from '/imports/startup/client/logger'; import { notifyStreamStateChange } from '/imports/ui/services/bbb-webrtc-sfu/stream-state-service'; @@ -466,24 +465,6 @@ class VideoProvider extends Component { this.webRtcPeers[cameraId] = {}; - // WebRTC restrictions may need a capture device permission to release - // useful ICE candidates on recvonly/no-gUM peers - if (!isLocal) { - try { - await tryGenerateIceCandidates(); - } catch (error) { - logger.error({ - logCode: 'video_provider_no_valid_candidate_gum_failure', - extraInfo: { - cameraId, - role, - errorName: error.name, - errorMessage: error.message, - }, - }, `Forced gUM to release additional ICE candidates failed due to ${error.name}.`); - } - } - try { iceServers = await fetchWebRTCMappedStunTurnServers(this.info.sessionToken); } catch (error) { diff --git a/bigbluebutton-html5/imports/ui/services/audio-manager/index.js b/bigbluebutton-html5/imports/ui/services/audio-manager/index.js index f1973b0eb006e4c923b8e4ac941ef9a53860bdbe..6ce5e0984682d830af84552cab014785aaee46e9 100755 --- a/bigbluebutton-html5/imports/ui/services/audio-manager/index.js +++ b/bigbluebutton-html5/imports/ui/services/audio-manager/index.js @@ -8,7 +8,6 @@ import logger from '/imports/startup/client/logger'; import { notify } from '/imports/ui/services/notification'; import playAndRetry from '/imports/utils/mediaElementPlayRetry'; import iosWebviewAudioPolyfills from '/imports/utils/ios-webview-audio-polyfills'; -import { tryGenerateIceCandidates } from '/imports/utils/safari-webrtc'; import { monitorAudioConnection } from '/imports/utils/stats'; import AudioErrors from './error-codes'; import {Meteor} from "meteor/meteor"; @@ -184,20 +183,6 @@ class AudioManager { inputStream: this.createListenOnlyStream(), }; - // WebRTC restrictions may need a capture device permission to release - // useful ICE candidates on recvonly/no-gUM peers - try { - await tryGenerateIceCandidates(); - } catch (error) { - logger.error({ - logCode: 'listenonly_no_valid_candidate_gum_failure', - extraInfo: { - errorName: error.name, - errorMessage: error.message, - }, - }, `Forced gUM to release additional ICE candidates failed due to ${error.name}.`); - } - // Call polyfills for webrtc client if navigator is "iOS Webview" const userAgent = window.navigator.userAgent.toLocaleLowerCase(); if ((userAgent.indexOf('iphone') > -1 || userAgent.indexOf('ipad') > -1) diff --git a/bigbluebutton-html5/imports/utils/safari-webrtc.js b/bigbluebutton-html5/imports/utils/safari-webrtc.js deleted file mode 100644 index 9d119351d62163438041cf576b4a8f6871841ba1..0000000000000000000000000000000000000000 --- a/bigbluebutton-html5/imports/utils/safari-webrtc.js +++ /dev/null @@ -1,99 +0,0 @@ -import { - fetchWebRTCMappedStunTurnServers, - getMappedFallbackStun, -} from '/imports/utils/fetchStunTurnServers'; -import Auth from '/imports/ui/services/auth'; -import { Session } from 'meteor/session'; -import logger from '/imports/startup/client/logger'; - -const ICE_GATHERING_CHECK_ENABLED = Meteor.settings.public.media.recvonlyIceGatheringCheck; -const getSessionToken = () => Auth.sessionToken; - -export async function getIceServersList() { - try { - const iceServers = await fetchWebRTCMappedStunTurnServers(getSessionToken()); - return iceServers; - } catch (error) { - return getMappedFallbackStun(); - } -} - -export function canGenerateIceCandidates() { - return new Promise((resolve, reject) => { - if (Session.get('canGenerateIceCandidates')) { - resolve(); - return; - } - - getIceServersList().catch((e) => { - reject(e); - }).then((iceServersReceived) => { - const pc = new RTCPeerConnection({ iceServers: iceServersReceived }); - let countIceCandidates = 0; - - try { pc.addTransceiver('audio'); } catch (e) { } - pc.onicecandidate = function (e) { - if (countIceCandidates) return; - if (e.candidate && e.candidate.candidate.indexOf('.local') === -1) { - countIceCandidates++; - Session.set('canGenerateIceCandidates', true); - resolve(); - } - }; - - pc.onicegatheringstatechange = function (e) { - if (e.currentTarget.iceGatheringState === 'complete' && countIceCandidates === 0) { - logger.warn({ logCode: 'no_valid_candidate' }, 'No useful ICE candidate found. Will request gUM permission.'); - reject(new Error('No valid candidate')); - } - }; - - setTimeout(() => { - pc.close(); - if (!countIceCandidates) reject(new Error('Gathering check timeout')); - }, 5000); - - const p = pc.createOffer({ offerToReceiveVideo: true }); - p.then((answer) => { pc.setLocalDescription(answer); }); - }); - }); -} - -/* - * Try to generate candidates for a recvonly RTCPeerConnection without - * a gUM permission and check if there are any candidates generated other than - * a mDNS host candidate. If there aren't, forcefully request gUM permission - * for mic (best chance of a gUM working is mic) to try and make the browser - * generate at least srflx candidates. - * This is a workaround due to a behaviour some browsers display (mainly Safari) - * where they won't generate srflx or relay candidates if no gUM permission is - * given. - * - * - * UPDATE: - * This used to be valid when Kurento wasn't treating prflx candidates properly. - * It is now, so this workaround is being revisited. I've put it under a flag - * so that we can field trial it disabled and gauge the impact of removing it. - * Hopelly we can get rid of it. - * - * prlanzarin 11-11-20 - */ -export function tryGenerateIceCandidates() { - return new Promise((resolve, reject) => { - if (!ICE_GATHERING_CHECK_ENABLED) return resolve(); - canGenerateIceCandidates().then(() => { - resolve(); - }).catch(() => { - navigator.mediaDevices.getUserMedia({ audio: true, video: false }).then(() => { - logger.info({ logCode: 'no_valid_candidate_gum_success' }, 'Forced gUM to release additional ICE candidates succeeded.'); - canGenerateIceCandidates().then(() => { - resolve(); - }).catch((error) => { - reject(error); - }); - }).catch((error) => { - reject(error); - }); - }); - }); -} diff --git a/bigbluebutton-html5/private/config/settings.yml b/bigbluebutton-html5/private/config/settings.yml index 57e5099c8cb9c5959d4024f52e8c796b57f51ea3..f991c75f73fac2abcc1354b3c362a876a7c4f2b2 100755 --- a/bigbluebutton-html5/private/config/settings.yml +++ b/bigbluebutton-html5/private/config/settings.yml @@ -342,7 +342,6 @@ public: stunTurnServersFetchAddress: '/bigbluebutton/api/stuns' cacheStunTurnServers: true fallbackStunServer: '' - recvonlyIceGatheringCheck: true mediaTag: '#remote-media' callTransferTimeout: 5000 callHangupTimeout: 2000