Skip to content

Commit 5489e63

Browse files
committed
fix(safari): verify that AudioContext supports setSinkId
1 parent fe41a34 commit 5489e63

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/client/src/devices/devices.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
} from 'rxjs';
1212
import { BrowserPermission } from './BrowserPermission';
1313
import { lazy } from '../helpers/lazy';
14-
import { isFirefox } from '../helpers/browsers';
14+
import { isFirefox, isSafari } from '../helpers/browsers';
1515
import { dumpStream, Tracer } from '../stats';
1616
import { getCurrentValue } from '../store/rxUtils';
1717
import { videoLoggerSystem } from '../logger';
@@ -61,6 +61,8 @@ const getDevices = (
6161
*/
6262
export const checkIfAudioOutputChangeSupported = () => {
6363
if (typeof document === 'undefined') return false;
64+
// Safari uses WebAudio API for playing audio, so we check the AudioContext prototype
65+
if (isSafari()) return 'setSinkId' in AudioContext.prototype;
6466
const element = document.createElement('audio');
6567
return 'setSinkId' in element;
6668
};

0 commit comments

Comments
 (0)