From 82ab889dad9514bf8b4fc141b41c2ec21decebab Mon Sep 17 00:00:00 2001 From: Chubby Granny Chaser Date: Tue, 25 Nov 2025 23:54:36 +0000 Subject: [PATCH] fix: hotfixing video player --- src/main/main.ts | 7 --- .../gallery-slider/gallery-slider.tsx | 50 +++++++++++++++---- src/types/steam.types.ts | 7 ++- 3 files changed, 45 insertions(+), 19 deletions(-) diff --git a/src/main/main.ts b/src/main/main.ts index 295c0d75..1cadcebd 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -20,13 +20,6 @@ import { WSClient, } from "@main/services"; import { migrateDownloadSources } from "./helpers/migrate-download-sources"; -import path from "node:path"; - -const helloAddon = require( - path.join(__dirname, "..", "..", "native_build", "hello_napi.node") -); - -console.log(helloAddon.hello()); export const loadState = async () => { await Lock.acquireLock(); diff --git a/src/renderer/src/pages/game-details/gallery-slider/gallery-slider.tsx b/src/renderer/src/pages/game-details/gallery-slider/gallery-slider.tsx index c9658636..56912fcc 100644 --- a/src/renderer/src/pages/game-details/gallery-slider/gallery-slider.tsx +++ b/src/renderer/src/pages/game-details/gallery-slider/gallery-slider.tsx @@ -100,20 +100,48 @@ export function GallerySlider() { src?: string; poster?: string; videoSrc?: string; + videoType?: string; alt: string; }> = []; if (shopDetails?.movies) { shopDetails.movies.forEach((video, index) => { - items.push({ - id: String(video.id), - type: "video", - poster: video.thumbnail, - videoSrc: video.mp4.max.startsWith("http://") - ? video.mp4.max.replace("http://", "https://") - : video.mp4.max, - alt: t("video", { number: String(index + 1) }), - }); + // Prefer new formats: HLS (best browser support), then DASH H264, then DASH AV1 + // Fallback to old format: mp4/webm if new formats are not available + let videoSrc: string | undefined; + let videoType: string | undefined; + + if (video.hls_h264) { + videoSrc = video.hls_h264; + videoType = "application/x-mpegURL"; + } else if (video.dash_h264) { + videoSrc = video.dash_h264; + videoType = "application/dash+xml"; + } else if (video.dash_av1) { + videoSrc = video.dash_av1; + videoType = "application/dash+xml"; + } else if (video.mp4?.max) { + // Fallback to old format + videoSrc = video.mp4.max; + videoType = "video/mp4"; + } else if (video.webm?.max) { + // Fallback to webm if mp4 is not available + videoSrc = video.webm.max; + videoType = "video/webm"; + } + + if (videoSrc) { + items.push({ + id: String(video.id), + type: "video", + poster: video.thumbnail, + videoSrc: videoSrc.startsWith("http://") + ? videoSrc.replace("http://", "https://") + : videoSrc, + videoType, + alt: video.name || t("video", { number: String(index + 1) }), + }); + } }); } @@ -172,7 +200,9 @@ export function GallerySlider() { autoPlay={autoplayEnabled} tabIndex={-1} > - + {item.videoSrc && ( + + )} ) : (