mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 18:13:31 +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) {
|
||||
const setSink = async () => {
|
||||
try {
|
||||
if (audioDeviceId !== 'default') {
|
||||
if (webAudio.context.state !== 'closed') {
|
||||
await (webAudio.context as any).setSinkId(audioDeviceId);
|
||||
} else {
|
||||
await (webAudio.context as any).setSinkId('');
|
||||
}
|
||||
} catch (error) {
|
||||
toast.error({ message: `Error setting sink: ${(error as Error).message}` });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue