mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-25 08:53:04 +02:00
Fix crashing with GainNode when the stream has no sound
This commit is contained in:
parent
18027ed1c5
commit
567770c86e
@ -4,6 +4,7 @@ import { BxEvent } from "@utils/bx-event";
|
||||
import { STATES } from "@utils/global";
|
||||
import { getPref, PrefKey } from "@utils/preferences";
|
||||
import { UserAgent } from "@utils/user-agent";
|
||||
import { BxLogger } from "./bx-logger";
|
||||
|
||||
export enum InputType {
|
||||
CONTROLLER = 'Controller',
|
||||
@ -107,11 +108,15 @@ export const BxExposed = {
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const audioCtx = STATES.currentStream.audioContext!;
|
||||
const source = audioCtx.createMediaStreamSource(audioStream);
|
||||
|
||||
const gainNode = audioCtx.createGain(); // call monkey-patched createGain() in BxAudioContext
|
||||
source.connect(gainNode).connect(audioCtx.destination);
|
||||
} catch (e) {
|
||||
BxLogger.error('setupGainNode', e);
|
||||
}
|
||||
},
|
||||
|
||||
handleControllerShortcut: ControllerShortcut.handle,
|
||||
|
Loading…
x
Reference in New Issue
Block a user