diff options
author | Maksim Sukharev <antreesy.web@gmail.com> | 2024-03-28 16:24:57 +0100 |
---|---|---|
committer | Maksim Sukharev <antreesy.web@gmail.com> | 2024-03-28 16:24:57 +0100 |
commit | eec8388dc3e5eb31e90da34f42563503759e0092 (patch) | |
tree | fafa9a95d0917c7f6b6ea5fa0f90831008c39710 | |
parent | f93be1d01f8f3c5d8b19b8e5493e74555bce6030 (diff) |
chore(browserCheck): unify ua-parser usage through the utilschore/noid/browser-check
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
-rw-r--r-- | src/utils/browserCheck.js | 10 | ||||
-rw-r--r-- | src/utils/media/pipeline/MediaDevicesSource.js | 13 |
2 files changed, 12 insertions, 11 deletions
diff --git a/src/utils/browserCheck.js b/src/utils/browserCheck.js index ce4039caa..76580cb39 100644 --- a/src/utils/browserCheck.js +++ b/src/utils/browserCheck.js @@ -45,6 +45,16 @@ export const isYandex = browser.name === 'Yandex' export const majorVersion = browser.version ? parseInt(browser.version.split('.')[0], 10) : 0 /** + * Is the browser Chromium-based + */ +export const isChromium = isChrome + || isOpera + || isSafari + || isEdge + || isBrave + || isYandex + +/** * Is the browser fully supported by Talk */ export const isFullySupported = (isFirefox && majorVersion >= 52) diff --git a/src/utils/media/pipeline/MediaDevicesSource.js b/src/utils/media/pipeline/MediaDevicesSource.js index e3160f44c..fa6a3e5ee 100644 --- a/src/utils/media/pipeline/MediaDevicesSource.js +++ b/src/utils/media/pipeline/MediaDevicesSource.js @@ -19,9 +19,8 @@ * */ -import UAParser from 'ua-parser-js' - import TrackSource from './TrackSource.js' +import { isChromium } from '../../browserCheck.js' import { mediaDevicesManager } from '../../webrtc/index.js' /** @@ -250,15 +249,7 @@ export default class MediaDevicesSource extends TrackSource { * @param {object} constraints the constraints to be adjusted */ _adjustVideoConstraintsForChromium(constraints) { - const parser = new UAParser() - const browserName = parser.getBrowser().name - - if (browserName !== 'Chrome' - && browserName !== 'Chromium' - && browserName !== 'Opera' - && browserName !== 'Safari' - && browserName !== 'Mobile Safari' - && browserName !== 'Edge') { + if (!isChromium) { return } |