mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-11 13:56:16 +00:00
fix: hotfixing video player
This commit is contained in:
@@ -20,13 +20,6 @@ import {
|
|||||||
WSClient,
|
WSClient,
|
||||||
} from "@main/services";
|
} from "@main/services";
|
||||||
import { migrateDownloadSources } from "./helpers/migrate-download-sources";
|
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 () => {
|
export const loadState = async () => {
|
||||||
await Lock.acquireLock();
|
await Lock.acquireLock();
|
||||||
|
|||||||
@@ -100,20 +100,48 @@ export function GallerySlider() {
|
|||||||
src?: string;
|
src?: string;
|
||||||
poster?: string;
|
poster?: string;
|
||||||
videoSrc?: string;
|
videoSrc?: string;
|
||||||
|
videoType?: string;
|
||||||
alt: string;
|
alt: string;
|
||||||
}> = [];
|
}> = [];
|
||||||
|
|
||||||
if (shopDetails?.movies) {
|
if (shopDetails?.movies) {
|
||||||
shopDetails.movies.forEach((video, index) => {
|
shopDetails.movies.forEach((video, index) => {
|
||||||
|
// 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({
|
items.push({
|
||||||
id: String(video.id),
|
id: String(video.id),
|
||||||
type: "video",
|
type: "video",
|
||||||
poster: video.thumbnail,
|
poster: video.thumbnail,
|
||||||
videoSrc: video.mp4.max.startsWith("http://")
|
videoSrc: videoSrc.startsWith("http://")
|
||||||
? video.mp4.max.replace("http://", "https://")
|
? videoSrc.replace("http://", "https://")
|
||||||
: video.mp4.max,
|
: videoSrc,
|
||||||
alt: t("video", { number: String(index + 1) }),
|
videoType,
|
||||||
|
alt: video.name || t("video", { number: String(index + 1) }),
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,7 +200,9 @@ export function GallerySlider() {
|
|||||||
autoPlay={autoplayEnabled}
|
autoPlay={autoplayEnabled}
|
||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
>
|
>
|
||||||
<source src={item.videoSrc} />
|
{item.videoSrc && (
|
||||||
|
<source src={item.videoSrc} type={item.videoType} />
|
||||||
|
)}
|
||||||
</video>
|
</video>
|
||||||
) : (
|
) : (
|
||||||
<img
|
<img
|
||||||
|
|||||||
@@ -16,8 +16,11 @@ export interface SteamVideoSource {
|
|||||||
|
|
||||||
export interface SteamMovies {
|
export interface SteamMovies {
|
||||||
id: number;
|
id: number;
|
||||||
mp4: SteamVideoSource;
|
dash_av1?: string;
|
||||||
webm: SteamVideoSource;
|
dash_h264?: string;
|
||||||
|
hls_h264?: string;
|
||||||
|
mp4?: SteamVideoSource;
|
||||||
|
webm?: SteamVideoSource;
|
||||||
thumbnail: string;
|
thumbnail: string;
|
||||||
name: string;
|
name: string;
|
||||||
highlight: boolean;
|
highlight: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user