Release Kaleido Desktop 0.1.0-beta.10
All checks were successful
Validate Kaleido Desktop / validate (push) Successful in 1m22s
All checks were successful
Validate Kaleido Desktop / validate (push) Successful in 1m22s
- Player controls centred under the timeline: previous episode, back 10 s, play/pause, forward 10 s, next episode; volume and time on the left. - Previous episode button and Shift+P. - Draggable miniplayer, kept inside the window and remembered. - Fix the next-episode card's buttons and the skip button being covered by the player's title row, and skip buttons also pausing playback. - Drop the "Highly rated"/"Recommended" label from the hero and restore the gap between its logo and the details line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
10103d0e77
commit
a38db53161
15 changed files with 220 additions and 61 deletions
11
CHANGELOG.md
11
CHANGELOG.md
|
|
@ -1,5 +1,16 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.1.0-beta.10
|
||||||
|
|
||||||
|
A redesigned player control bar, previous episode, and a movable miniplayer.
|
||||||
|
|
||||||
|
- The player's controls are rearranged the way most media players lay them out: play/pause sits in the centre under the timeline, with 10-second skips either side and previous/next episode beyond those. Volume and the time are on the left; subtitles, settings and full screen stay on the right.
|
||||||
|
- New previous-episode button (and Shift+P) to go back an episode. For episodes both buttons always show, dimmed at the start or end of a show, so play/pause stays put.
|
||||||
|
- The miniplayer can be dragged anywhere in the window. It stays inside the window when it's resized, and remembers where you left it.
|
||||||
|
- Fixed: the Play now and Cancel buttons on the next-episode card during the credits couldn't be clicked (the player's title row covered them). The Skip intro/credits button had the same problem with tall show logos.
|
||||||
|
- Fixed: clicking Skip intro or Skip credits also paused the video.
|
||||||
|
- The featured titles at the top of Home, Movies and TV Shows no longer carry a "Highly rated" / "Recommended" label, and their logo has room above the details line instead of touching it.
|
||||||
|
|
||||||
## 0.1.0-beta.9
|
## 0.1.0-beta.9
|
||||||
|
|
||||||
Fixes for the Mac version.
|
Fixes for the Mac version.
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ place (see [Architecture](docs/architecture.md)). Linux builds browse but don't
|
||||||
| Enter / Space | Open / play | ↑ / ↓, wheel | Volume |
|
| Enter / Space | Open / play | ↑ / ↓, wheel | Volume |
|
||||||
| Menu or Shift+F10 | Title actions | F, double-click | Full screen |
|
| Menu or Shift+F10 | Title actions | F, double-click | Full screen |
|
||||||
| Alt+← (⌘[) / mouse back | Back | C | Next subtitle |
|
| Alt+← (⌘[) / mouse back | Back | C | Next subtitle |
|
||||||
| / | Focus search | Shift+N | Next episode |
|
| / | Focus search | Shift+P / N | Previous / next episode |
|
||||||
| F11 (⌃⌘F) | Full screen | Esc | Exit full screen, then player |
|
| F11 (⌃⌘F) | Full screen | Esc | Exit full screen, then player |
|
||||||
|
|
||||||
Keys in brackets are the macOS equivalents.
|
Keys in brackets are the macOS equivalents.
|
||||||
|
|
|
||||||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "kaleido-desktop",
|
"name": "kaleido-desktop",
|
||||||
"version": "0.1.0-beta.9",
|
"version": "0.1.0-beta.10",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "kaleido-desktop",
|
"name": "kaleido-desktop",
|
||||||
"version": "0.1.0-beta.9",
|
"version": "0.1.0-beta.10",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fontsource-variable/inter": "^5.3.0",
|
"@fontsource-variable/inter": "^5.3.0",
|
||||||
"@tanstack/react-query": "^5.105.0",
|
"@tanstack/react-query": "^5.105.0",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "kaleido-desktop",
|
"name": "kaleido-desktop",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.1.0-beta.9",
|
"version": "0.1.0-beta.10",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|
|
||||||
2
src-tauri/Cargo.lock
generated
2
src-tauri/Cargo.lock
generated
|
|
@ -2173,7 +2173,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kaleido"
|
name = "kaleido"
|
||||||
version = "0.1.0-beta.9"
|
version = "0.1.0-beta.10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"fs2",
|
"fs2",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "kaleido"
|
name = "kaleido"
|
||||||
version = "0.1.0-beta.9"
|
version = "0.1.0-beta.10"
|
||||||
description = "Kaleido — a Plex client for Windows"
|
description = "Kaleido — a Plex client for Windows"
|
||||||
authors = ["Elijah"]
|
authors = ["Elijah"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://schema.tauri.app/config/2",
|
"$schema": "https://schema.tauri.app/config/2",
|
||||||
"productName": "Kaleido",
|
"productName": "Kaleido",
|
||||||
"version": "0.1.0-beta.9",
|
"version": "0.1.0-beta.10",
|
||||||
"identifier": "tv.kaleido.desktop",
|
"identifier": "tv.kaleido.desktop",
|
||||||
"build": {
|
"build": {
|
||||||
"beforeDevCommand": "npm run dev",
|
"beforeDevCommand": "npm run dev",
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { useCallback, useEffect, useRef, useState, type ReactNode } from 'react';
|
import { useCallback, useEffect, useRef, useState, type PointerEvent as ReactPointerEvent, type ReactNode } from 'react';
|
||||||
import { usePlayer } from './store';
|
import { usePlayer } from './store';
|
||||||
import { useSession } from '../app/session';
|
import { useSession } from '../app/session';
|
||||||
import { useSettings, QUALITY_LABEL, UPSCALING, type Quality, type SubtitleBox, type Upscaling } from '../app/settings';
|
import { useSettings, QUALITY_LABEL, UPSCALING, type Quality, type SubtitleBox, type Upscaling } from '../app/settings';
|
||||||
|
|
@ -512,7 +512,14 @@ function SkipButton() {
|
||||||
if (!marker || mode === 'off' || countdown !== null) return null;
|
if (!marker || mode === 'off' || countdown !== null) return null;
|
||||||
if (marker.type === 'credits' && nextUp) return null;
|
if (marker.type === 'credits' && nextUp) return null;
|
||||||
return (
|
return (
|
||||||
<button className="skip-button" onClick={() => seek(marker.end / 1000)}>
|
<button
|
||||||
|
className="skip-button"
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
seek(marker.end / 1000);
|
||||||
|
}}
|
||||||
|
onDoubleClick={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
{marker.type === 'intro' ? 'Skip intro' : 'Skip credits'}
|
{marker.type === 'intro' ? 'Skip intro' : 'Skip credits'}
|
||||||
<Icon name="skipNext" size={16} />
|
<Icon name="skipNext" size={16} />
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -583,18 +590,62 @@ function TitleBlock({ item }: { item: Item }) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Where the miniplayer was dragged to: its distance from the window's right and bottom edges. */
|
||||||
|
type MiniPos = { x: number; y: number };
|
||||||
|
const MINI_POS_KEY = 'kaleido.miniPosition';
|
||||||
|
const MINI_MARGIN = 8;
|
||||||
|
let miniPos: MiniPos | null | undefined;
|
||||||
|
|
||||||
|
function savedMiniPos(): MiniPos | null {
|
||||||
|
if (miniPos === undefined) {
|
||||||
|
try {
|
||||||
|
const p = JSON.parse(localStorage.getItem(MINI_POS_KEY) ?? 'null');
|
||||||
|
miniPos = p && Number.isFinite(p.x) && Number.isFinite(p.y) ? p : null;
|
||||||
|
} catch {
|
||||||
|
miniPos = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return miniPos ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Keeps the whole box inside the window. */
|
||||||
|
function clampMini(el: HTMLElement, pos: MiniPos): MiniPos {
|
||||||
|
const cs = getComputedStyle(el);
|
||||||
|
const maxX = window.innerWidth - parseFloat(cs.width) - MINI_MARGIN;
|
||||||
|
const maxY = window.innerHeight - parseFloat(cs.height) - MINI_MARGIN;
|
||||||
|
return { x: Math.round(Math.max(MINI_MARGIN, Math.min(maxX, pos.x))), y: Math.round(Math.max(MINI_MARGIN, Math.min(maxY, pos.y))) };
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The box and the page's hole for the video (base.css) both follow these. */
|
||||||
|
function applyMiniPos(pos: MiniPos | null) {
|
||||||
|
const root = document.documentElement.style;
|
||||||
|
if (!pos) {
|
||||||
|
root.removeProperty('--mini-x');
|
||||||
|
root.removeProperty('--mini-y');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
root.setProperty('--mini-x', `${pos.x}px`);
|
||||||
|
root.setProperty('--mini-y', `${pos.y}px`);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Playing in the corner while browsing. The native video is drawn into this
|
* Playing in the corner while browsing, and draggable anywhere in the window.
|
||||||
* box's rectangle and the page has a matching hole (see `html.player-mini`).
|
* The native video is drawn into this box's rectangle and the page has a
|
||||||
|
* matching hole (see `html.player-mini`).
|
||||||
*/
|
*/
|
||||||
function MiniPlayer() {
|
function MiniPlayer() {
|
||||||
const st = usePlayer();
|
const st = usePlayer();
|
||||||
const box = useRef<HTMLDivElement>(null);
|
const box = useRef<HTMLDivElement>(null);
|
||||||
|
const placeVideo = useRef(() => {});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const el = box.current;
|
const el = box.current;
|
||||||
if (!el) return;
|
if (!el) return;
|
||||||
let frame = 0;
|
let frame = 0;
|
||||||
|
const fit = () => {
|
||||||
|
const saved = savedMiniPos();
|
||||||
|
applyMiniPos(saved && clampMini(el, saved));
|
||||||
|
};
|
||||||
const place = () => {
|
const place = () => {
|
||||||
cancelAnimationFrame(frame);
|
cancelAnimationFrame(frame);
|
||||||
frame = requestAnimationFrame(() => {
|
frame = requestAnimationFrame(() => {
|
||||||
|
|
@ -610,23 +661,64 @@ function MiniPlayer() {
|
||||||
if (isNative) mpv.rect({ x: x * dpr - 1, y: y * dpr - 1, width: width * dpr + 2, height: height * dpr + 2 }).catch(() => {});
|
if (isNative) mpv.rect({ x: x * dpr - 1, y: y * dpr - 1, width: width * dpr + 2, height: height * dpr + 2 }).catch(() => {});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
place();
|
placeVideo.current = place;
|
||||||
|
const onResize = () => {
|
||||||
|
fit();
|
||||||
|
place();
|
||||||
|
};
|
||||||
|
onResize();
|
||||||
const ro = new ResizeObserver(place);
|
const ro = new ResizeObserver(place);
|
||||||
ro.observe(el);
|
ro.observe(el);
|
||||||
window.addEventListener('resize', place);
|
window.addEventListener('resize', onResize);
|
||||||
return () => {
|
return () => {
|
||||||
cancelAnimationFrame(frame);
|
cancelAnimationFrame(frame);
|
||||||
ro.disconnect();
|
ro.disconnect();
|
||||||
window.removeEventListener('resize', place);
|
window.removeEventListener('resize', onResize);
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const startDrag = (e: ReactPointerEvent) => {
|
||||||
|
const el = box.current;
|
||||||
|
if (e.button !== 0 || !el) return;
|
||||||
|
const cs = getComputedStyle(el);
|
||||||
|
const start = { px: e.clientX, py: e.clientY, x: parseFloat(cs.right), y: parseFloat(cs.bottom) };
|
||||||
|
let dragging = false;
|
||||||
|
const move = (ev: PointerEvent) => {
|
||||||
|
const dx = ev.clientX - start.px;
|
||||||
|
const dy = ev.clientY - start.py;
|
||||||
|
if (!dragging && Math.hypot(dx, dy) < 5) return;
|
||||||
|
dragging = true;
|
||||||
|
el.classList.add('dragging');
|
||||||
|
miniPos = clampMini(el, { x: start.x - dx, y: start.y - dy });
|
||||||
|
applyMiniPos(miniPos);
|
||||||
|
placeVideo.current();
|
||||||
|
};
|
||||||
|
const up = () => {
|
||||||
|
window.removeEventListener('pointermove', move);
|
||||||
|
window.removeEventListener('pointerup', up);
|
||||||
|
window.removeEventListener('pointercancel', up);
|
||||||
|
if (!dragging) return;
|
||||||
|
el.classList.remove('dragging');
|
||||||
|
localStorage.setItem(MINI_POS_KEY, JSON.stringify(miniPos));
|
||||||
|
// Letting go after a drag isn't a click on the button under the pointer.
|
||||||
|
const swallow = (c: MouseEvent) => {
|
||||||
|
c.stopPropagation();
|
||||||
|
c.preventDefault();
|
||||||
|
};
|
||||||
|
window.addEventListener('click', swallow, { capture: true, once: true });
|
||||||
|
setTimeout(() => window.removeEventListener('click', swallow, { capture: true }), 0);
|
||||||
|
};
|
||||||
|
window.addEventListener('pointermove', move);
|
||||||
|
window.addEventListener('pointerup', up);
|
||||||
|
window.addEventListener('pointercancel', up);
|
||||||
|
};
|
||||||
|
|
||||||
if (!st.item) return null;
|
if (!st.item) return null;
|
||||||
const item = st.item;
|
const item = st.item;
|
||||||
const loading = !st.firstFrame && !st.error;
|
const loading = !st.firstFrame && !st.error;
|
||||||
const pct = st.duration ? Math.min(100, (st.position / st.duration) * 100) : 0;
|
const pct = st.duration ? Math.min(100, (st.position / st.duration) * 100) : 0;
|
||||||
return (
|
return (
|
||||||
<div ref={box} className={`mini-player${loading || st.error ? ' loading' : ''}`} onDoubleClick={() => st.expand()}>
|
<div ref={box} className={`mini-player${loading || st.error ? ' loading' : ''}`} onPointerDown={startDrag} onDoubleClick={() => st.expand()}>
|
||||||
<div className="mini-scrim" />
|
<div className="mini-scrim" />
|
||||||
<div className="mini-top">
|
<div className="mini-top">
|
||||||
<button className="mini-icon" aria-label="Back to full screen player" title="Expand" onClick={() => st.expand()}>
|
<button className="mini-icon" aria-label="Back to full screen player" title="Expand" onClick={() => st.expand()}>
|
||||||
|
|
@ -732,6 +824,11 @@ export function PlayerOverlay() {
|
||||||
if (e.shiftKey && p.nextUp) p.playNext();
|
if (e.shiftKey && p.nextUp) p.playNext();
|
||||||
else handled = false;
|
else handled = false;
|
||||||
break;
|
break;
|
||||||
|
case 'p':
|
||||||
|
case 'P':
|
||||||
|
if (e.shiftKey && p.prevUp) p.playPrevious();
|
||||||
|
else handled = false;
|
||||||
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
case 'U': {
|
case 'U': {
|
||||||
const prefs = useSettings.getState();
|
const prefs = useSettings.getState();
|
||||||
|
|
@ -887,25 +984,45 @@ export function PlayerOverlay() {
|
||||||
<Timeline onScrub={setScrubbing} />
|
<Timeline onScrub={setScrubbing} />
|
||||||
<div className="player-controls">
|
<div className="player-controls">
|
||||||
<div className="player-controls-left">
|
<div className="player-controls-left">
|
||||||
<button className="player-icon big" aria-label={st.paused ? 'Play' : 'Pause'} onClick={() => st.togglePause()}>
|
|
||||||
<Icon name={st.paused || st.ended ? 'play' : 'pause'} size={26} />
|
|
||||||
</button>
|
|
||||||
<button className="player-icon" aria-label="Back 10 seconds" onClick={() => st.seekBy(-10)}>
|
|
||||||
<Icon name="replay10" size={24} />
|
|
||||||
</button>
|
|
||||||
<button className="player-icon" aria-label="Forward 10 seconds" onClick={() => st.seekBy(10)}>
|
|
||||||
<Icon name="forward10" size={24} />
|
|
||||||
</button>
|
|
||||||
{st.nextUp && (
|
|
||||||
<button className="player-icon" aria-label="Next episode" title={`Next: ${episodeLabel(st.nextUp)} ${st.nextUp.title}`} onClick={() => st.playNext()}>
|
|
||||||
<Icon name="skipNext" size={22} />
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
<Volume />
|
<Volume />
|
||||||
<span className="player-time">
|
<span className="player-time">
|
||||||
{clock(st.position, st.duration >= 3600)} <span className="dim">/ {clock(st.duration, st.duration >= 3600)}</span>
|
{clock(st.position, st.duration >= 3600)} <span className="dim">/ {clock(st.duration, st.duration >= 3600)}</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="player-controls-center">
|
||||||
|
{/* Both episode buttons stay for episodes (dimmed at either end) so play/pause holds its place. */}
|
||||||
|
{item.type === 'episode' && (
|
||||||
|
<button
|
||||||
|
className="player-icon"
|
||||||
|
aria-label="Previous episode"
|
||||||
|
title={st.prevUp ? `Previous: ${episodeLabel(st.prevUp)} ${st.prevUp.title}` : undefined}
|
||||||
|
disabled={!st.prevUp}
|
||||||
|
onClick={() => st.playPrevious()}
|
||||||
|
>
|
||||||
|
<Icon name="skipPrev" size={22} />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
<button className="player-icon" aria-label="Back 10 seconds" onClick={() => st.seekBy(-10)}>
|
||||||
|
<Icon name="replay10" size={24} />
|
||||||
|
</button>
|
||||||
|
<button className="player-icon big" aria-label={st.paused ? 'Play' : 'Pause'} onClick={() => st.togglePause()}>
|
||||||
|
<Icon name={st.paused || st.ended ? 'play' : 'pause'} size={28} />
|
||||||
|
</button>
|
||||||
|
<button className="player-icon" aria-label="Forward 10 seconds" onClick={() => st.seekBy(10)}>
|
||||||
|
<Icon name="forward10" size={24} />
|
||||||
|
</button>
|
||||||
|
{item.type === 'episode' && (
|
||||||
|
<button
|
||||||
|
className="player-icon"
|
||||||
|
aria-label="Next episode"
|
||||||
|
title={st.nextUp ? `Next: ${episodeLabel(st.nextUp)} ${st.nextUp.title}` : undefined}
|
||||||
|
disabled={!st.nextUp}
|
||||||
|
onClick={() => st.playNext()}
|
||||||
|
>
|
||||||
|
<Icon name="skipNext" size={22} />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
<div className="player-controls-right">
|
<div className="player-controls-right">
|
||||||
<button className={`player-icon${panel === 'tracks' ? ' on' : ''}${st.subKey ? ' lit' : ''}`} aria-label="Audio and subtitles" onClick={() => setPanel(panel === 'tracks' ? '' : 'tracks')}>
|
<button className={`player-icon${panel === 'tracks' ? ' on' : ''}${st.subKey ? ' lit' : ''}`} aria-label="Audio and subtitles" onClick={() => setPanel(panel === 'tracks' ? '' : 'tracks')}>
|
||||||
<Icon name="captions" size={23} />
|
<Icon name="captions" size={23} />
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,8 @@ interface PlayerState {
|
||||||
video: { width: number; height: number; hwdec: string; codec: string } | null;
|
video: { width: number; height: number; hwdec: string; codec: string } | null;
|
||||||
ended: boolean;
|
ended: boolean;
|
||||||
nextUp: Item | null;
|
nextUp: Item | null;
|
||||||
|
/** The episode before this one, for the previous-episode button. */
|
||||||
|
prevUp: Item | null;
|
||||||
countdown: number | null;
|
countdown: number | null;
|
||||||
postPlayDismissed: boolean;
|
postPlayDismissed: boolean;
|
||||||
fullscreen: boolean;
|
fullscreen: boolean;
|
||||||
|
|
@ -89,6 +91,7 @@ interface PlayerState {
|
||||||
setQuality(q: Quality): Promise<void>;
|
setQuality(q: Quality): Promise<void>;
|
||||||
selectVersion(index: number): Promise<void>;
|
selectVersion(index: number): Promise<void>;
|
||||||
playNext(): Promise<void>;
|
playNext(): Promise<void>;
|
||||||
|
playPrevious(): Promise<void>;
|
||||||
cancelCountdown(): void;
|
cancelCountdown(): void;
|
||||||
toggleFullscreen(): Promise<void>;
|
toggleFullscreen(): Promise<void>;
|
||||||
previewAt(seconds: number): string;
|
previewAt(seconds: number): string;
|
||||||
|
|
@ -271,15 +274,17 @@ function checkScrobble() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function findNext(item: Item): Promise<Item | null> {
|
/** The episodes either side of this one in the show. */
|
||||||
|
async function findNeighbours(item: Item): Promise<{ prevUp: Item | null; nextUp: Item | null }> {
|
||||||
|
const none = { prevUp: null, nextUp: null };
|
||||||
const s = server();
|
const s = server();
|
||||||
if (!s || item.type !== 'episode' || !item.grandparentId) return null;
|
if (!s || item.type !== 'episode' || !item.grandparentId) return none;
|
||||||
try {
|
try {
|
||||||
const leaves = await api.allLeaves(s, item.grandparentId);
|
const leaves = await api.allLeaves(s, item.grandparentId);
|
||||||
const i = leaves.findIndex((e) => e.id === item.id);
|
const i = leaves.findIndex((e) => e.id === item.id);
|
||||||
return i >= 0 ? (leaves[i + 1] ?? null) : null;
|
return i >= 0 ? { prevUp: leaves[i - 1] ?? null, nextUp: leaves[i + 1] ?? null } : none;
|
||||||
} catch {
|
} catch {
|
||||||
return null;
|
return none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -547,6 +552,7 @@ export const usePlayer = create<PlayerState>((set, get) => ({
|
||||||
video: null,
|
video: null,
|
||||||
ended: false,
|
ended: false,
|
||||||
nextUp: null,
|
nextUp: null,
|
||||||
|
prevUp: null,
|
||||||
countdown: null,
|
countdown: null,
|
||||||
postPlayDismissed: false,
|
postPlayDismissed: false,
|
||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
|
|
@ -587,6 +593,7 @@ export const usePlayer = create<PlayerState>((set, get) => ({
|
||||||
buffering: true,
|
buffering: true,
|
||||||
ended: false,
|
ended: false,
|
||||||
nextUp: null,
|
nextUp: null,
|
||||||
|
prevUp: null,
|
||||||
countdown: null,
|
countdown: null,
|
||||||
postPlayDismissed: false,
|
postPlayDismissed: false,
|
||||||
chapters: [],
|
chapters: [],
|
||||||
|
|
@ -674,7 +681,7 @@ export const usePlayer = create<PlayerState>((set, get) => ({
|
||||||
const st = get();
|
const st = get();
|
||||||
if (st.open && !st.ended) report(st.paused ? 'paused' : st.buffering ? 'buffering' : 'playing');
|
if (st.open && !st.ended) report(st.paused ? 'paused' : st.buffering ? 'buffering' : 'playing');
|
||||||
}, 10000);
|
}, 10000);
|
||||||
findNext(item).then((next) => token === loadToken && set({ nextUp: next }));
|
findNeighbours(item).then((n) => token === loadToken && set(n));
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
if (token !== loadToken) return;
|
if (token !== loadToken) return;
|
||||||
set({ error: e?.message ?? String(e), buffering: false });
|
set({ error: e?.message ?? String(e), buffering: false });
|
||||||
|
|
@ -696,7 +703,7 @@ export const usePlayer = create<PlayerState>((set, get) => ({
|
||||||
await mpv.command('stop').catch(() => {});
|
await mpv.command('stop').catch(() => {});
|
||||||
await mpv.show(false).catch(() => {});
|
await mpv.show(false).catch(() => {});
|
||||||
}
|
}
|
||||||
set({ open: false, mini: false, item: null, delivery: null, error: '', terminated: false, countdown: null, nextUp: null, firstFrame: false });
|
set({ open: false, mini: false, item: null, delivery: null, error: '', terminated: false, countdown: null, nextUp: null, prevUp: null, firstFrame: false });
|
||||||
const fs = await win.isFullscreen().catch(() => false);
|
const fs = await win.isFullscreen().catch(() => false);
|
||||||
if (fs && !wasFullscreenBeforePlay) win.setFullscreen(false);
|
if (fs && !wasFullscreenBeforePlay) win.setFullscreen(false);
|
||||||
if (st.item) invalidateLibrary();
|
if (st.item) invalidateLibrary();
|
||||||
|
|
@ -815,6 +822,12 @@ export const usePlayer = create<PlayerState>((set, get) => ({
|
||||||
await st.play(st.nextUp, { resume: true, quality: st.quality });
|
await st.play(st.nextUp, { resume: true, quality: st.quality });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async playPrevious() {
|
||||||
|
const st = get();
|
||||||
|
if (!st.prevUp) return;
|
||||||
|
await st.play(st.prevUp, { resume: true, quality: st.quality });
|
||||||
|
},
|
||||||
|
|
||||||
cancelCountdown() {
|
cancelCountdown() {
|
||||||
stopCountdown();
|
stopCountdown();
|
||||||
set({ countdown: null, postPlayDismissed: true });
|
set({ countdown: null, postPlayDismissed: true });
|
||||||
|
|
|
||||||
|
|
@ -16,26 +16,21 @@ function shuffled<T>(list: T[], salt = 0): T[] {
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FEATURE_SOURCES: [RegExp, string][] = [
|
/** Recently released, highly rated, recently added, start watching, recommended. */
|
||||||
[/recentlyreleased|recentlyaired/, 'Recently released'],
|
const FEATURE_SOURCES: RegExp[] = [/recentlyreleased|recentlyaired/, /topunwatched|toprated/, /recentlyadded/, /startwatching/, /curated|genre|by\.actor|moreingenre/];
|
||||||
[/topunwatched|toprated/, 'Highly rated'],
|
|
||||||
[/recentlyadded/, 'Recently added'],
|
|
||||||
[/startwatching/, 'Start watching'],
|
|
||||||
[/curated|genre|by\.actor|moreingenre/, 'Recommended'],
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Features interleave recently released, highly rated unwatched and
|
* Features interleave recently released, highly rated unwatched and
|
||||||
* Plex-recommended titles; they need artwork and skip in-progress titles.
|
* Plex-recommended titles; they need artwork and skip in-progress titles.
|
||||||
*/
|
*/
|
||||||
export function buildFeatures(hubs: Hub[], limit = 8, salt = 0): Feature[] {
|
export function buildFeatures(hubs: Hub[], limit = 8, salt = 0): Feature[] {
|
||||||
const pools: Feature[][] = FEATURE_SOURCES.map(([re, eyebrow]) =>
|
const pools: Feature[][] = FEATURE_SOURCES.map((re) =>
|
||||||
shuffled(
|
shuffled(
|
||||||
hubs
|
hubs
|
||||||
.filter((h) => re.test(h.id))
|
.filter((h) => re.test(h.id))
|
||||||
.flatMap((h) => h.items)
|
.flatMap((h) => h.items)
|
||||||
.filter((i) => (i.type === 'movie' || i.type === 'show') && i.art && !i.viewOffset && i.summary)
|
.filter((i) => (i.type === 'movie' || i.type === 'show') && i.art && !i.viewOffset && i.summary)
|
||||||
.map((item) => ({ item, eyebrow })),
|
.map((item) => ({ item })),
|
||||||
salt,
|
salt,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ const SHORTCUTS: [string, string][][] = [
|
||||||
['C', 'Next subtitle track'],
|
['C', 'Next subtitle track'],
|
||||||
['U', 'Cycle upscaling'],
|
['U', 'Cycle upscaling'],
|
||||||
['B', 'Compare with enhancement off'],
|
['B', 'Compare with enhancement off'],
|
||||||
['Shift + N', 'Next episode'],
|
['Shift + P / N', 'Previous / next episode'],
|
||||||
['0–9', 'Jump to 0–90%'],
|
['0–9', 'Jump to 0–90%'],
|
||||||
['Esc or Backspace', 'Exit full screen, then keep playing in the corner'],
|
['Esc or Backspace', 'Exit full screen, then keep playing in the corner'],
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -612,11 +612,9 @@ html.splash-arrival .auth-screen {
|
||||||
transform: none;
|
transform: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.hero-eyebrow {
|
/* Scoped so the later `.title-art { margin: 0 }` can't cancel the gap above the facts. */
|
||||||
margin-bottom: 16px;
|
.hero-content .hero-title {
|
||||||
}
|
margin: 0 0 22px;
|
||||||
.hero-title {
|
|
||||||
margin: 0 0 18px;
|
|
||||||
}
|
}
|
||||||
.hero-episode {
|
.hero-episode {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ html.player-mini.video-active .app-shell {
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
-webkit-mask-image: linear-gradient(#000 0 0), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 90'%3E%3Crect width='160' height='90' rx='3.6'/%3E%3C/svg%3E");
|
-webkit-mask-image: linear-gradient(#000 0 0), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 90'%3E%3Crect width='160' height='90' rx='3.6'/%3E%3C/svg%3E");
|
||||||
-webkit-mask-size: 100% 100%, var(--mini-w) var(--mini-h);
|
-webkit-mask-size: 100% 100%, var(--mini-w) var(--mini-h);
|
||||||
-webkit-mask-position: 0 0, right var(--mini-gap) bottom var(--mini-gap);
|
-webkit-mask-position: 0 0, right var(--mini-x, var(--mini-gap)) bottom var(--mini-y, var(--mini-gap));
|
||||||
-webkit-mask-repeat: no-repeat;
|
-webkit-mask-repeat: no-repeat;
|
||||||
-webkit-mask-composite: xor;
|
-webkit-mask-composite: xor;
|
||||||
mask-composite: exclude;
|
mask-composite: exclude;
|
||||||
|
|
|
||||||
|
|
@ -328,17 +328,31 @@ html.os-macos:not(.window-fullscreen) .player-top {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Controls */
|
/* Controls */
|
||||||
|
/* Volume and time | playback, centred under the timeline | tracks and window. */
|
||||||
.player-controls {
|
.player-controls {
|
||||||
display: flex;
|
display: grid;
|
||||||
|
grid-template-columns: 1fr auto 1fr;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
gap: 16px;
|
||||||
margin-top: 6px;
|
margin-top: 6px;
|
||||||
}
|
}
|
||||||
.player-controls-left,
|
.player-controls-left,
|
||||||
|
.player-controls-center,
|
||||||
.player-controls-right {
|
.player-controls-right {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
.player-controls-right {
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
.player-controls-center {
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
.player-icon:disabled {
|
||||||
|
opacity: 0.32;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
.player-icon {
|
.player-icon {
|
||||||
width: 44px;
|
width: 44px;
|
||||||
|
|
@ -364,11 +378,12 @@ html.os-macos:not(.window-fullscreen) .player-top {
|
||||||
color: var(--accent-strong);
|
color: var(--accent-strong);
|
||||||
}
|
}
|
||||||
.player-icon.big {
|
.player-icon.big {
|
||||||
width: 48px;
|
width: 54px;
|
||||||
height: 48px;
|
height: 54px;
|
||||||
}
|
}
|
||||||
.player-time {
|
.player-time {
|
||||||
margin-left: 12px;
|
margin-left: 8px;
|
||||||
|
white-space: nowrap;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-variant-numeric: tabular-nums;
|
font-variant-numeric: tabular-nums;
|
||||||
color: #f0f2f2;
|
color: #f0f2f2;
|
||||||
|
|
@ -410,6 +425,8 @@ html.os-macos:not(.window-fullscreen) .player-top {
|
||||||
/* Panels */
|
/* Panels */
|
||||||
.player-panel {
|
.player-panel {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
/* Above the skip and post-play cards. */
|
||||||
|
z-index: 2;
|
||||||
right: clamp(24px, 3.5vw, 56px);
|
right: clamp(24px, 3.5vw, 56px);
|
||||||
bottom: 84px;
|
bottom: 84px;
|
||||||
min-width: 300px;
|
min-width: 300px;
|
||||||
|
|
@ -638,7 +655,11 @@ html.os-macos:not(.window-fullscreen) .player-top {
|
||||||
min-width: 340px;
|
min-width: 340px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skip & post-play */
|
/* Skip & post-play: above the bottom chrome, whose title row spans the full width behind them. */
|
||||||
|
.skip-button,
|
||||||
|
.post-play {
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
.skip-button {
|
.skip-button {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: clamp(24px, 3.5vw, 56px);
|
right: clamp(24px, 3.5vw, 56px);
|
||||||
|
|
@ -765,10 +786,11 @@ html.os-macos:not(.window-fullscreen) .player-top {
|
||||||
--mini-h: calc(var(--mini-w) * 9 / 16);
|
--mini-h: calc(var(--mini-w) * 9 / 16);
|
||||||
--mini-gap: 24px;
|
--mini-gap: 24px;
|
||||||
}
|
}
|
||||||
|
/* --mini-x/-y: where it was dragged to, from the right and bottom (PlayerOverlay). */
|
||||||
.mini-player {
|
.mini-player {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
right: var(--mini-gap);
|
right: var(--mini-x, var(--mini-gap));
|
||||||
bottom: var(--mini-gap);
|
bottom: var(--mini-y, var(--mini-gap));
|
||||||
z-index: 600;
|
z-index: 600;
|
||||||
width: var(--mini-w);
|
width: var(--mini-w);
|
||||||
height: var(--mini-h);
|
height: var(--mini-h);
|
||||||
|
|
@ -781,6 +803,9 @@ html.os-macos:not(.window-fullscreen) .player-top {
|
||||||
.mini-player.loading {
|
.mini-player.loading {
|
||||||
background: #000;
|
background: #000;
|
||||||
}
|
}
|
||||||
|
.mini-player.dragging {
|
||||||
|
cursor: grabbing;
|
||||||
|
}
|
||||||
/* Opacity only: the video beneath can't follow a transform. */
|
/* Opacity only: the video beneath can't follow a transform. */
|
||||||
@keyframes mini-in {
|
@keyframes mini-in {
|
||||||
from {
|
from {
|
||||||
|
|
@ -804,6 +829,8 @@ html.os-macos:not(.window-fullscreen) .player-top {
|
||||||
.mini-player:hover .mini-top,
|
.mini-player:hover .mini-top,
|
||||||
.mini-player:hover .mini-center,
|
.mini-player:hover .mini-center,
|
||||||
.mini-player:hover .mini-caption,
|
.mini-player:hover .mini-caption,
|
||||||
|
.mini-player.dragging .mini-scrim,
|
||||||
|
.mini-player.dragging .mini-caption,
|
||||||
.mini-player.loading .mini-center,
|
.mini-player.loading .mini-center,
|
||||||
.mini-player:focus-within .mini-top,
|
.mini-player:focus-within .mini-top,
|
||||||
.mini-player:focus-within .mini-center {
|
.mini-player:focus-within .mini-center {
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ const ROTATE_MS = 8000;
|
||||||
|
|
||||||
export interface Feature {
|
export interface Feature {
|
||||||
item: Item;
|
item: Item;
|
||||||
eyebrow: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -75,7 +74,6 @@ export function Hero({ features, variant = 'home' }: { features: Feature[]; vari
|
||||||
<section ref={root} className={`hero ${variant}`} onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}>
|
<section ref={root} className={`hero ${variant}`} onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)}>
|
||||||
<Backdrop item={item} className="hero-backdrop" />
|
<Backdrop item={item} className="hero-backdrop" />
|
||||||
<div className="hero-content" key={copyKey}>
|
<div className="hero-content" key={copyKey}>
|
||||||
<div className="micro hero-eyebrow">{feature.eyebrow}</div>
|
|
||||||
<TitleArt item={item} className="hero-title" maxWidth={variant === 'home' ? 420 : 380} maxHeight={variant === 'home' ? 128 : 108} />
|
<TitleArt item={item} className="hero-title" maxWidth={variant === 'home' ? 420 : 380} maxHeight={variant === 'home' ? 128 : 108} />
|
||||||
{item.type === 'episode' && (
|
{item.type === 'episode' && (
|
||||||
<div className="hero-episode">
|
<div className="hero-episode">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue