mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-08-09 06:37:43 +02:00
Fix global vars
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { t } from "../translation";
|
||||
import { BxEvent } from "../bx-event";
|
||||
import { CE } from "../../utils/html";
|
||||
import { States } from "../../utils/global";
|
||||
|
||||
enum StreamBadge {
|
||||
PLAYTIME = 'playtime',
|
||||
@@ -85,7 +86,7 @@ export class StreamBadges {
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
const stats = await STREAM_WEBRTC.getStats();
|
||||
const stats = await States.currentStream.peerConnection?.getStats()!;
|
||||
let totalIn = 0;
|
||||
let totalOut = 0;
|
||||
stats.forEach(stat => {
|
||||
|
@@ -1,9 +1,10 @@
|
||||
import { PrefKey, Preferences } from "../preferences"
|
||||
import { PrefKey } from "../preferences"
|
||||
import { BxEvent } from "../bx-event"
|
||||
import { getPref } from "../preferences"
|
||||
import { StreamBadges } from "./stream-badges"
|
||||
import { CE } from "../../utils/html"
|
||||
import { t } from "../translation"
|
||||
import { States } from "../../utils/global"
|
||||
|
||||
export enum StreamStat {
|
||||
PING = 'ping',
|
||||
@@ -105,13 +106,13 @@ export class StreamStats {
|
||||
}
|
||||
|
||||
static update() {
|
||||
if (StreamStats.isHidden() || !STREAM_WEBRTC) {
|
||||
if (StreamStats.isHidden() || !States.currentStream.peerConnection) {
|
||||
StreamStats.onStoppedPlaying();
|
||||
return;
|
||||
}
|
||||
|
||||
const PREF_STATS_CONDITIONAL_FORMATTING = getPref(PrefKey.STATS_CONDITIONAL_FORMATTING);
|
||||
STREAM_WEBRTC.getStats().then(stats => {
|
||||
States.currentStream.peerConnection.getStats().then(stats => {
|
||||
stats.forEach(stat => {
|
||||
let grade = '';
|
||||
if (stat.type === 'inbound-rtp' && stat.kind === 'video') {
|
||||
@@ -213,7 +214,7 @@ export class StreamStats {
|
||||
}
|
||||
|
||||
static getServerStats() {
|
||||
STREAM_WEBRTC && STREAM_WEBRTC.getStats().then(stats => {
|
||||
States.currentStream.peerConnection && States.currentStream.peerConnection.getStats().then(stats => {
|
||||
const allVideoCodecs: {[index: string]: RTCBasicStat} = {};
|
||||
let videoCodecId;
|
||||
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import { States } from "../../utils/global";
|
||||
import { Icon } from "../../utils/html";
|
||||
import { BxEvent } from "../bx-event";
|
||||
import { PrefKey, getPref } from "../preferences";
|
||||
@@ -44,6 +45,7 @@ class MouseHoldEvent {
|
||||
this.#$elm.addEventListener('touchend', this.#onMouseUp.bind(this));
|
||||
}
|
||||
|
||||
/*
|
||||
#clearEventLiseners = () => {
|
||||
this.#$elm.removeEventListener('mousedown', this.#onMouseDown);
|
||||
this.#$elm.removeEventListener('click', this.#onMouseUp);
|
||||
@@ -51,6 +53,7 @@ class MouseHoldEvent {
|
||||
this.#$elm.removeEventListener('touchstart', this.#onMouseDown);
|
||||
this.#$elm.removeEventListener('touchend', this.#onMouseUp);
|
||||
}
|
||||
*/
|
||||
|
||||
constructor($elm: HTMLElement, callback: any, duration=1000) {
|
||||
this.#$elm = $elm;
|
||||
|
Reference in New Issue
Block a user