mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 07:37:19 +02:00
Move MicrophoneState to shortcut-microphone
This commit is contained in:
parent
774a822e69
commit
90df5d655f
@ -3,15 +3,8 @@ import { BxIcon } from "@utils/bx-icon";
|
|||||||
import { createButton, ButtonStyle, CE } from "@utils/html";
|
import { createButton, ButtonStyle, CE } from "@utils/html";
|
||||||
import { t } from "@utils/translation";
|
import { t } from "@utils/translation";
|
||||||
import { BaseGameBarAction } from "./action-base";
|
import { BaseGameBarAction } from "./action-base";
|
||||||
import { MicrophoneShortcut } from "../shortcuts/shortcut-microphone";
|
import { MicrophoneShortcut, MicrophoneState } from "../shortcuts/shortcut-microphone";
|
||||||
|
|
||||||
enum MicrophoneState {
|
|
||||||
REQUESTED = 'Requested',
|
|
||||||
ENABLED = 'Enabled',
|
|
||||||
MUTED = 'Muted',
|
|
||||||
NOT_ALLOWED = 'NotAllowed',
|
|
||||||
NOT_FOUND = 'NotFound',
|
|
||||||
}
|
|
||||||
|
|
||||||
export class MicrophoneAction extends BaseGameBarAction {
|
export class MicrophoneAction extends BaseGameBarAction {
|
||||||
$content: HTMLElement;
|
$content: HTMLElement;
|
||||||
|
@ -1,6 +1,15 @@
|
|||||||
import { t } from "@utils/translation";
|
import { t } from "@utils/translation";
|
||||||
import { Toast } from "@utils/toast";
|
import { Toast } from "@utils/toast";
|
||||||
|
|
||||||
|
|
||||||
|
export enum MicrophoneState {
|
||||||
|
REQUESTED = 'Requested',
|
||||||
|
ENABLED = 'Enabled',
|
||||||
|
MUTED = 'Muted',
|
||||||
|
NOT_ALLOWED = 'NotAllowed',
|
||||||
|
NOT_FOUND = 'NotFound',
|
||||||
|
}
|
||||||
|
|
||||||
export class MicrophoneShortcut {
|
export class MicrophoneShortcut {
|
||||||
static toggle(showToast: boolean = true): boolean {
|
static toggle(showToast: boolean = true): boolean {
|
||||||
if (!window.BX_EXPOSED.streamSession) {
|
if (!window.BX_EXPOSED.streamSession) {
|
||||||
@ -8,7 +17,7 @@ export class MicrophoneShortcut {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const state = window.BX_EXPOSED.streamSession._microphoneState;
|
const state = window.BX_EXPOSED.streamSession._microphoneState;
|
||||||
const enableMic = state === 'Enabled' ? false : true;
|
const enableMic = state === MicrophoneState.ENABLED ? false : true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
window.BX_EXPOSED.streamSession.tryEnableChatAsync(enableMic);
|
window.BX_EXPOSED.streamSession.tryEnableChatAsync(enableMic);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user