feat(player): the YouTube player and the file viewer are named in the address
The player names what it plays in its own history entry (watch, wrel, wtab): a reload or a
bookmark reopens it on the page that hosts it, with that page's list as the queue, or alone
from the catalog (GET /api/videos/{id}/row); a page that hosts none gets the shell's. Back
lands on the page's address without it (useBackToClose's url; ui/Modal passes it on). The
Files viewer and player do the same (fview, fplay). The Plex and channel-manager views are
always written in full, as their fallback is remembered state.
This commit is contained in:
@@ -78,6 +78,7 @@ import {
|
||||
mediaTitleClass,
|
||||
} from "../../components/ui/mediaCardStyles";
|
||||
import RemoteImage from "../../components/ui/RemoteImage";
|
||||
import { useOpenLinkedPlayer } from "../../features/player/useOpenLinkedPlayer";
|
||||
|
||||
// The Home surface — "Mit nézzek most?".
|
||||
//
|
||||
@@ -729,6 +730,12 @@ export default function Home() {
|
||||
window.history.replaceState({ ...window.history.state, [SAVED_KEY]: question }, "");
|
||||
}, [budget, seed, press, seen]);
|
||||
const [player, setPlayer] = useState<{ video: Video; startAt: number | null } | null>(null);
|
||||
// A reload or a bookmark of the player reopens it: the video alone, as Home plays it.
|
||||
useOpenLinkedPlayer(
|
||||
true,
|
||||
() => undefined,
|
||||
(video) => setPlayer({ video, startAt: null }),
|
||||
);
|
||||
|
||||
// A Plex card's title is in the reader's language, so the answer is cached per language.
|
||||
const lang = plexLang(i18n.language);
|
||||
|
||||
Reference in New Issue
Block a user