diff --git a/dist/better-xcloud.lite.user.js b/dist/better-xcloud.lite.user.js index ad7e8fe..06f07a9 100644 --- a/dist/better-xcloud.lite.user.js +++ b/dist/better-xcloud.lite.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Better xCloud (Lite) // @namespace https://github.com/redphx -// @version 5.8.5 +// @version 5.8.6-beta // @description Improve Xbox Cloud Gaming (xCloud) experience // @author redphx // @license MIT @@ -111,7 +111,7 @@ function deepClone(obj) { if (!obj) return {}; return JSON.parse(JSON.stringify(obj)); } -var SCRIPT_VERSION = "5.8.5", SCRIPT_VARIANT = "lite", AppInterface = window.AppInterface; +var SCRIPT_VERSION = "5.8.6-beta", SCRIPT_VARIANT = "lite", AppInterface = window.AppInterface; UserAgent.init(); var userAgent = window.navigator.userAgent.toLowerCase(), isTv = userAgent.includes("smart-tv") || userAgent.includes("smarttv") || /\baft.*\b/.test(userAgent), isVr = window.navigator.userAgent.includes("VR") && window.navigator.userAgent.includes("OculusBrowser"), browserHasTouchSupport = "ontouchstart" in window || navigator.maxTouchPoints > 0, userAgentHasTouchSupport = !isTv && !isVr && browserHasTouchSupport, supportMkb = AppInterface || !userAgent.match(/(android|iphone|ipad)/), STATES = { supportedRegion: !0, @@ -5219,11 +5219,14 @@ class StreamPlayer { if (isNativeTouchGame && this.playerType == "webgl2") window.BX_EXPOSED.streamSession.updateDimensions(); } setPlayerType(type, refreshPlayer = !1) { - if (this.playerType !== type) if (type === "webgl2") { + if (this.playerType !== type) { + const videoClass = BX_FLAGS.DeviceInfo.deviceType === "android-tv" ? "bx-pixel" : "bx-gone"; + if (type === "webgl2") { if (!this.webGL2Player) this.webGL2Player = new WebGL2Player(this.$video); else this.webGL2Player.resume(); - this.$videoCss.textContent = "", this.$video.classList.add("bx-pixel"); - } else this.webGL2Player?.stop(), this.$video.classList.remove("bx-pixel"); + this.$videoCss.textContent = "", this.$video.classList.add(videoClass); + } else this.webGL2Player?.stop(), this.$video.classList.remove(videoClass); + } this.playerType = type, refreshPlayer && this.refreshPlayer(); } setOptions(options, refreshPlayer = !1) { diff --git a/dist/better-xcloud.user.js b/dist/better-xcloud.user.js index 26b78ee..5953302 100644 --- a/dist/better-xcloud.user.js +++ b/dist/better-xcloud.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Better xCloud // @namespace https://github.com/redphx -// @version 5.8.5 +// @version 5.8.6-beta // @description Improve Xbox Cloud Gaming (xCloud) experience // @author redphx // @license MIT @@ -113,7 +113,7 @@ function deepClone(obj) { if (!obj) return {}; return JSON.parse(JSON.stringify(obj)); } -var SCRIPT_VERSION = "5.8.5", SCRIPT_VARIANT = "full", AppInterface = window.AppInterface; +var SCRIPT_VERSION = "5.8.6-beta", SCRIPT_VARIANT = "full", AppInterface = window.AppInterface; UserAgent.init(); var userAgent = window.navigator.userAgent.toLowerCase(), isTv = userAgent.includes("smart-tv") || userAgent.includes("smarttv") || /\baft.*\b/.test(userAgent), isVr = window.navigator.userAgent.includes("VR") && window.navigator.userAgent.includes("OculusBrowser"), browserHasTouchSupport = "ontouchstart" in window || navigator.maxTouchPoints > 0, userAgentHasTouchSupport = !isTv && !isVr && browserHasTouchSupport, supportMkb = AppInterface || !userAgent.match(/(android|iphone|ipad)/), STATES = { supportedRegion: !0, @@ -7124,11 +7124,14 @@ class StreamPlayer { if (isNativeTouchGame && this.playerType == "webgl2") window.BX_EXPOSED.streamSession.updateDimensions(); } setPlayerType(type, refreshPlayer = !1) { - if (this.playerType !== type) if (type === "webgl2") { + if (this.playerType !== type) { + const videoClass = BX_FLAGS.DeviceInfo.deviceType === "android-tv" ? "bx-pixel" : "bx-gone"; + if (type === "webgl2") { if (!this.webGL2Player) this.webGL2Player = new WebGL2Player(this.$video); else this.webGL2Player.resume(); - this.$videoCss.textContent = "", this.$video.classList.add("bx-pixel"); - } else this.webGL2Player?.stop(), this.$video.classList.remove("bx-pixel"); + this.$videoCss.textContent = "", this.$video.classList.add(videoClass); + } else this.webGL2Player?.stop(), this.$video.classList.remove(videoClass); + } this.playerType = type, refreshPlayer && this.refreshPlayer(); } setOptions(options, refreshPlayer = !1) { diff --git a/src/modules/stream-player.ts b/src/modules/stream-player.ts index 21f4cc8..0aed8e7 100644 --- a/src/modules/stream-player.ts +++ b/src/modules/stream-player.ts @@ -7,6 +7,7 @@ import { StreamPlayerType, StreamVideoProcessing } from "@enums/stream-player"; import { STATES } from "@/utils/global"; import { PrefKey } from "@/enums/pref-keys"; import { getPref } from "@/utils/settings-storages/global-settings-storage"; +import { BX_FLAGS } from "@/utils/bx-flags"; export type StreamPlayerOptions = Partial<{ processing: string, @@ -173,6 +174,8 @@ export class StreamPlayer { setPlayerType(type: StreamPlayerType, refreshPlayer: boolean = false) { if (this.playerType !== type) { + const videoClass = BX_FLAGS.DeviceInfo.deviceType === 'android-tv' ? 'bx-pixel' : 'bx-gone'; + // Switch from Video -> WebGL2 if (type === StreamPlayerType.WEBGL2) { // Initialize WebGL2 player @@ -184,12 +187,12 @@ export class StreamPlayer { this.$videoCss!.textContent = ''; - this.$video.classList.add('bx-pixel'); + this.$video.classList.add(videoClass); } else { // Cleanup WebGL2 Player this.webGL2Player?.stop(); - this.$video.classList.remove('bx-pixel'); + this.$video.classList.remove(videoClass); } }