mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 10:23:33 +00:00
don't set sink on closed context
This commit is contained in:
parent
176a95a946
commit
caa9448200
1 changed files with 1 additions and 3 deletions
|
|
@ -322,10 +322,8 @@ export const AudioPlayer = forwardRef<AudioPlayerRef, AudioPlayerProps>((props,
|
||||||
if (isElectron() && webAudio && 'setSinkId' in webAudio.context && audioDeviceId) {
|
if (isElectron() && webAudio && 'setSinkId' in webAudio.context && audioDeviceId) {
|
||||||
const setSink = async () => {
|
const setSink = async () => {
|
||||||
try {
|
try {
|
||||||
if (audioDeviceId !== 'default') {
|
if (webAudio.context.state !== 'closed') {
|
||||||
await (webAudio.context as any).setSinkId(audioDeviceId);
|
await (webAudio.context as any).setSinkId(audioDeviceId);
|
||||||
} else {
|
|
||||||
await (webAudio.context as any).setSinkId('');
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error({ message: `Error setting sink: ${(error as Error).message}` });
|
toast.error({ message: `Error setting sink: ${(error as Error).message}` });
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue