2021-12-01 04:31:09 +08:00
|
|
|
import browserInfo from '/imports/utils/browserInfo';
|
|
|
|
import deviceInfo from '/imports/utils/deviceInfo';
|
2022-12-19 06:09:30 +08:00
|
|
|
import { hasTurnServer } from '/imports/utils/fetchStunTurnServers';
|
2021-12-01 04:31:09 +08:00
|
|
|
|
2021-12-09 08:08:33 +08:00
|
|
|
const FORCE_RELAY = Meteor.settings.public.media.forceRelay;
|
2021-12-01 04:31:09 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Whether TURN/relay usage should be forced to work around Firefox's lack of
|
|
|
|
* support for regular nomination when dealing with ICE-litee peers (e.g.:
|
|
|
|
* mediasoup). See: https://bugzilla.mozilla.org/show_bug.cgi?id=1034964
|
|
|
|
*
|
|
|
|
* iOS endpoints are ignored from the trigger because _all_ iOS browsers
|
|
|
|
* are either native WebKit or WKWebView based (so they shouldn't be affected)
|
|
|
|
*/
|
|
|
|
const shouldForceRelay = () => {
|
|
|
|
const { isFirefox } = browserInfo;
|
|
|
|
const { isIos } = deviceInfo;
|
|
|
|
|
2022-12-19 06:09:30 +08:00
|
|
|
return FORCE_RELAY || ((isFirefox && !isIos) && hasTurnServer());
|
2021-12-01 04:31:09 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
export {
|
|
|
|
shouldForceRelay,
|
|
|
|
};
|