Skip to content

Commit 6f02e9f

Browse files
authored
fix(core): prevent audio output switching on safari based browsers (#1190)
1 parent 12e8ed2 commit 6f02e9f

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.changeset/green-monkeys-act.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@livekit/components-core": patch
3+
---
4+
5+
fix(core): prevent audio output switching on safari based browsers

packages/core/src/components/mediaDeviceSelect.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
type LocalVideoTrack,
55
type Room,
66
type LocalTrack,
7+
getBrowser,
78
} from 'livekit-client';
89
import { BehaviorSubject } from 'rxjs';
910
import { log } from '../logger';
@@ -35,6 +36,11 @@ export function setupDeviceSelector(
3536
id === 'default' && localTrack.mediaStreamTrack.label.startsWith('Default') ? id : actualId,
3637
);
3738
} else if (room) {
39+
const browser = getBrowser();
40+
if (kind === 'audiooutput' && (browser?.name === 'Safari' || browser?.os === 'iOS')) {
41+
log.warn(`Switching audio output device is not supported on Safari and iOS.`);
42+
return;
43+
}
3844
log.debug(`Switching active device of kind "${kind}" with id ${id}.`);
3945
await room.switchActiveDevice(kind, id, options.exact);
4046
const actualDeviceId: string | undefined = room.getActiveDevice(kind) ?? id;

0 commit comments

Comments
 (0)