mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 15:47:18 +02:00
Remove "exposeEventTarget" patch
This commit is contained in:
parent
99a9396d5b
commit
5e1c5c5420
@ -55,17 +55,14 @@ export class MicrophoneAction extends BaseGameBarAction {
|
|||||||
|
|
||||||
this.reset();
|
this.reset();
|
||||||
|
|
||||||
window.addEventListener(BxEvent.STREAM_EVENT_TARGET_READY, e => {
|
window.addEventListener(BxEvent.MICROPHONE_STATE_CHANGED, e => {
|
||||||
const eventTarget = window.BX_EXPOSED.eventTarget as EventTarget;
|
const microphoneState = (e as any).microphoneState;
|
||||||
eventTarget.addEventListener(XcloudEvent.MICROPHONE_STATE_CHANGED, e => {
|
const enabled = microphoneState === MicrophoneState.ENABLED;
|
||||||
const state = window.BX_EXPOSED.streamSession.microphoneState as MicrophoneState;
|
|
||||||
const enabled = state === MicrophoneState.ENABLED;
|
|
||||||
|
|
||||||
this.$content.setAttribute('data-enabled', enabled.toString());
|
this.$content.setAttribute('data-enabled', enabled.toString());
|
||||||
|
|
||||||
// Show the button in Game Bar if the mic is enabled
|
// Show the button in Game Bar if the mic is enabled
|
||||||
this.$content.classList.remove('bx-gone');
|
this.$content.classList.remove('bx-gone');
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,6 +516,7 @@ BxLogger.info('patchRemotePlayMkb', ${configsVar});
|
|||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/*
|
||||||
exposeEventTarget(str: string) {
|
exposeEventTarget(str: string) {
|
||||||
const text ='this._eventTarget=new EventTarget';
|
const text ='this._eventTarget=new EventTarget';
|
||||||
if (!str.includes(text)) {
|
if (!str.includes(text)) {
|
||||||
@ -530,6 +531,7 @@ window.dispatchEvent(new Event('${BxEvent.STREAM_EVENT_TARGET_READY}'))
|
|||||||
str = str.replace(text, newCode);
|
str = str.replace(text, newCode);
|
||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
|
//*/
|
||||||
|
|
||||||
// Class with: connectAsync(), doConnectAsync(), setPlayClient()
|
// Class with: connectAsync(), doConnectAsync(), setPlayClient()
|
||||||
exposeStreamSession(str: string) {
|
exposeStreamSession(str: string) {
|
||||||
@ -542,9 +544,13 @@ window.dispatchEvent(new Event('${BxEvent.STREAM_EVENT_TARGET_READY}'))
|
|||||||
window.BX_EXPOSED.streamSession = this;
|
window.BX_EXPOSED.streamSession = this;
|
||||||
|
|
||||||
const orgSetMicrophoneState = this.setMicrophoneState.bind(this);
|
const orgSetMicrophoneState = this.setMicrophoneState.bind(this);
|
||||||
this.setMicrophoneState = (e) => {
|
this.setMicrophoneState = state => {
|
||||||
console.log(e);
|
orgSetMicrophoneState(state);
|
||||||
orgSetMicrophoneState(e);
|
|
||||||
|
const evt = new Event('${BxEvent.MICROPHONE_STATE_CHANGED}');
|
||||||
|
evt.microphoneState = state;
|
||||||
|
|
||||||
|
window.dispatchEvent(evt);
|
||||||
};
|
};
|
||||||
|
|
||||||
window.dispatchEvent(new Event('${BxEvent.STREAM_SESSION_READY}'))
|
window.dispatchEvent(new Event('${BxEvent.STREAM_SESSION_READY}'))
|
||||||
@ -598,7 +604,7 @@ let PLAYING_PATCH_ORDERS: PatchArray = [
|
|||||||
'patchStreamHud',
|
'patchStreamHud',
|
||||||
'playVibration',
|
'playVibration',
|
||||||
|
|
||||||
'exposeEventTarget',
|
// 'exposeEventTarget',
|
||||||
|
|
||||||
// Patch volume control for normal stream
|
// Patch volume control for normal stream
|
||||||
getPref(PrefKey.AUDIO_ENABLE_VOLUME_CONTROL) && !getPref(PrefKey.STREAM_COMBINE_SOURCES) && 'patchAudioMediaStream',
|
getPref(PrefKey.AUDIO_ENABLE_VOLUME_CONTROL) && !getPref(PrefKey.STREAM_COMBINE_SOURCES) && 'patchAudioMediaStream',
|
||||||
|
@ -19,7 +19,7 @@ export enum BxEvent {
|
|||||||
STREAM_WEBRTC_CONNECTED = 'bx-stream-webrtc-connected',
|
STREAM_WEBRTC_CONNECTED = 'bx-stream-webrtc-connected',
|
||||||
STREAM_WEBRTC_DISCONNECTED = 'bx-stream-webrtc-disconnected',
|
STREAM_WEBRTC_DISCONNECTED = 'bx-stream-webrtc-disconnected',
|
||||||
|
|
||||||
STREAM_EVENT_TARGET_READY = 'bx-stream-event-target-ready',
|
// STREAM_EVENT_TARGET_READY = 'bx-stream-event-target-ready',
|
||||||
STREAM_SESSION_READY = 'bx-stream-session-ready',
|
STREAM_SESSION_READY = 'bx-stream-session-ready',
|
||||||
|
|
||||||
CUSTOM_TOUCH_LAYOUTS_LOADED = 'bx-custom-touch-layouts-loaded',
|
CUSTOM_TOUCH_LAYOUTS_LOADED = 'bx-custom-touch-layouts-loaded',
|
||||||
@ -33,6 +33,7 @@ export enum BxEvent {
|
|||||||
DATA_CHANNEL_CREATED = 'bx-data-channel-created',
|
DATA_CHANNEL_CREATED = 'bx-data-channel-created',
|
||||||
|
|
||||||
GAME_BAR_ACTION_ACTIVATED = 'bx-game-bar-action-activated',
|
GAME_BAR_ACTION_ACTIVATED = 'bx-game-bar-action-activated',
|
||||||
|
MICROPHONE_STATE_CHANGED = 'bx-microphone-state-changed',
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum XcloudEvent {
|
export enum XcloudEvent {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user