From 74b296aa379ffc104858fc1d4d8c26014a1d443c Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Tue, 20 Aug 2024 10:11:21 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(frontend)=20add=20utils=20to=20determ?= =?UTF-8?q?ine=20user's=20browser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copied from LiveKit utils functions. Using LiveKit client, determine whether the user's browser is Safari, chromium based, or firefox. --- src/frontend/src/utils/livekit.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/utils/livekit.ts b/src/frontend/src/utils/livekit.ts index 84c713b6..ae1c6d86 100644 --- a/src/frontend/src/utils/livekit.ts +++ b/src/frontend/src/utils/livekit.ts @@ -1,5 +1,17 @@ -import { LogLevel, setLogLevel } from 'livekit-client' +import { getBrowser, LogLevel, setLogLevel } from 'livekit-client' export const silenceLiveKitLogs = (shouldSilenceLogs: boolean) => { setLogLevel(shouldSilenceLogs ? LogLevel.silent : LogLevel.debug) } + +export function isFireFox(): boolean { + return getBrowser()?.name === 'Firefox' +} + +export function isChromiumBased(): boolean { + return getBrowser()?.name === 'Chrome' +} + +export function isSafari(): boolean { + return getBrowser()?.name === 'Safari' +}