18 changed files with 157 additions and 30 deletions
@ -1,4 +1,4 @@ |
|||||||
export const DISCORD_LINK = "https://discord.gg/Jhqt4Xzpfb"; |
export const DISCORD_LINK = "https://discord.gg/Jhqt4Xzpfb"; |
||||||
export const GITHUB_LINK = "https://github.com/movie-web/movie-web"; |
export const GITHUB_LINK = "https://github.com/movie-web/movie-web"; |
||||||
export const APP_VERSION = "3.0.5"; |
export const APP_VERSION = "3.0.6"; |
||||||
export const GA_ID = "G-44YVXRL61C"; |
export const GA_ID = "G-44YVXRL61C"; |
||||||
|
@ -0,0 +1,59 @@ |
|||||||
|
import { MWCaption } from "@/backend/helpers/streams"; |
||||||
|
import { DetailedMeta } from "@/backend/metadata/getmeta"; |
||||||
|
import { useVideoPlayerDescriptor } from "@/video/state/hooks"; |
||||||
|
import { useMeta } from "@/video/state/logic/meta"; |
||||||
|
import { useProgress } from "@/video/state/logic/progress"; |
||||||
|
import { useEffect } from "react"; |
||||||
|
|
||||||
|
export type WindowMeta = { |
||||||
|
meta: DetailedMeta; |
||||||
|
captions: MWCaption[]; |
||||||
|
episode?: { |
||||||
|
episodeId: string; |
||||||
|
seasonId: string; |
||||||
|
}; |
||||||
|
seasons?: { |
||||||
|
id: string; |
||||||
|
number: number; |
||||||
|
title: string; |
||||||
|
episodes?: { id: string; number: number; title: string }[]; |
||||||
|
}[]; |
||||||
|
progress: { |
||||||
|
time: number; |
||||||
|
duration: number; |
||||||
|
}; |
||||||
|
} | null; |
||||||
|
|
||||||
|
declare global { |
||||||
|
interface Window { |
||||||
|
meta?: Record<string, WindowMeta>; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
export function MetaAction() { |
||||||
|
const descriptor = useVideoPlayerDescriptor(); |
||||||
|
const meta = useMeta(descriptor); |
||||||
|
const progress = useProgress(descriptor); |
||||||
|
|
||||||
|
useEffect(() => { |
||||||
|
if (!window.meta) window.meta = {}; |
||||||
|
if (meta) { |
||||||
|
window.meta[descriptor] = { |
||||||
|
meta: meta.meta, |
||||||
|
captions: meta.captions, |
||||||
|
seasons: meta.seasons, |
||||||
|
episode: meta.episode, |
||||||
|
progress: { |
||||||
|
time: progress.time, |
||||||
|
duration: progress.duration, |
||||||
|
}, |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
return () => { |
||||||
|
if (window.meta) delete window.meta[descriptor]; |
||||||
|
}; |
||||||
|
}, [meta, descriptor, progress]); |
||||||
|
|
||||||
|
return null; |
||||||
|
} |
Loading…
Reference in new issue