diff --git a/CHANGELOG.md b/CHANGELOG.md index fe77357..f811990 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 0.1.0-beta.19 + +Up Next fixes. + +- Up Next now opens every time the credits start: going back to the credits and seeking into the episode brings it back when they come round again, and it always opens when an episode reaches the end. +- The back arrow and a full-screen button are back at the top of Up Next, so you can return to browsing (playback continues in the miniplayer) or leave full screen. +- Click the show's logo to go to its page, with playback moving to the miniplayer. +- The Play next episode countdown fills smoothly. +- The episode rows are sized to fill the screen instead of leaving a gap at the bottom. +- The backdrop now shows the next episode, and its description is easier to read over bright artwork. + ## 0.1.0-beta.18 A rebuilt Up Next screen that looks and works like the rest of Kaleido. diff --git a/package-lock.json b/package-lock.json index 0d3af2a..c2b9033 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "kaleido-desktop", - "version": "0.1.0-beta.18", + "version": "0.1.0-beta.19", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "kaleido-desktop", - "version": "0.1.0-beta.18", + "version": "0.1.0-beta.19", "dependencies": { "@fontsource-variable/inter": "^5.3.0", "@tanstack/react-query": "^5.105.0", diff --git a/package.json b/package.json index 22fdfd0..db9e07a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "kaleido-desktop", "private": true, - "version": "0.1.0-beta.18", + "version": "0.1.0-beta.19", "type": "module", "scripts": { "dev": "vite", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 1b9a740..c87ca4a 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -2173,7 +2173,7 @@ dependencies = [ [[package]] name = "kaleido" -version = "0.1.0-beta.18" +version = "0.1.0-beta.19" dependencies = [ "fs2", "futures-util", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index b8c8d87..0b163b6 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "kaleido" -version = "0.1.0-beta.18" +version = "0.1.0-beta.19" description = "Kaleido — a Plex client for Windows" authors = ["Elijah"] edition = "2021" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 951df20..5286972 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "Kaleido", - "version": "0.1.0-beta.18", + "version": "0.1.0-beta.19", "identifier": "tv.kaleido.desktop", "build": { "beforeDevCommand": "npm run dev", diff --git a/src/player/PostPlay.tsx b/src/player/PostPlay.tsx index 6241093..33840c6 100644 --- a/src/player/PostPlay.tsx +++ b/src/player/PostPlay.tsx @@ -1,4 +1,4 @@ -import { useEffect, useLayoutEffect, useRef, type CSSProperties } from 'react'; +import { useEffect, useLayoutEffect, useMemo, useRef } from 'react'; import { useQuery } from '@tanstack/react-query'; import { usePlayer } from './store'; import { mpv } from './engine'; @@ -73,11 +73,25 @@ export function PostPlay() { }, []); const backToVideo = () => usePlayer.getState().dismissPostPlay(); + // As in the player: the show page opens with playback moving to the miniplayer. + const openShow = () => { + usePlayer.getState().minimize(); + navigate({ name: 'item', id: item.grandparentId }); + }; + // The next episode's own still, as on Android TV: darker than most show art, so the copy reads. + const scene = upcoming ?? item; + const sceneArt = useMemo(() => ({ ...scene, grandparentArt: scene.thumb || scene.grandparentArt }), [scene]); return (
-
{server && }
-
+
{server && }
+
+ + {!fullscreen && }
@@ -90,7 +104,13 @@ export function PostPlay() { {upcoming || !contextReady ? 'Up next' : 'More to watch'} - + {item.grandparentId ? ( + + ) : ( + + )} {upcoming ? ( <>

{upcoming.title}

@@ -165,19 +185,36 @@ function NowPlaying({ item }: { item: Item }) { ); } -/** Play next episode. While autoplay counts down, a lighter fill sweeps across it. */ +/** + * Play next episode. While autoplay counts down, a lighter fill sweeps across it. + * The store counts in 50 ms steps; the fill is drawn every frame between them. + */ function PlayNext({ ref }: { ref: React.Ref }) { - const countdown = usePlayer((s) => s.countdown); - const total = usePlayer((s) => s.countdownTotal); - const counting = countdown !== null && total > 0; - const fill = counting ? (1 - countdown / total) * 100 : 0; + const counting = usePlayer((s) => s.countdown !== null && s.countdownTotal > 0); + const fill = useRef(null); + useEffect(() => { + if (!counting) return; + let last = { value: usePlayer.getState().countdown ?? 0, at: performance.now() }; + const unsubscribe = usePlayer.subscribe((s, prev) => { + if (s.countdown !== prev.countdown && s.countdown !== null) last = { value: s.countdown, at: performance.now() }; + }); + let raf = 0; + const draw = () => { + const { countdownTotal: total } = usePlayer.getState(); + // Run on from the last step, but never more than a couple of steps ahead (a held countdown stays held). + const remaining = Math.max(0, last.value - Math.min(performance.now() - last.at, 120) / 1000); + if (fill.current && total) fill.current.style.transform = `scaleX(${1 - remaining / total})`; + raf = requestAnimationFrame(draw); + }; + draw(); + return () => { + unsubscribe(); + cancelAnimationFrame(raf); + }; + }, [counting]); return ( - diff --git a/src/player/store.test.ts b/src/player/store.test.ts index 26169bc..5cfb452 100644 --- a/src/player/store.test.ts +++ b/src/player/store.test.ts @@ -109,13 +109,27 @@ describe('Up Next playback lifecycle', () => { vi.advanceTimersByTime(10000); expect(usePlayer.getState()).toMatchObject({ postPlay: true, countdown: null, postPlayDismissed: true }); }); - it('returns to credits without reopening on the next time event or EOF', () => { + it('returns to credits without reopening while they play', () => { time(81); usePlayer.getState().dismissPostPlay(); time(82); - eof(); expect(usePlayer.getState()).toMatchObject({ postPlay: false, countdown: null }); }); + it('reopens at the end after returning to the credits', () => { + time(81); + usePlayer.getState().dismissPostPlay(); + eof(); + expect(usePlayer.getState()).toMatchObject({ postPlay: true, countdown: 5 }); + }); + it('reopens when the credits start again after seeking back into the episode', () => { + time(81); + usePlayer.getState().dismissPostPlay(); + usePlayer.getState().seek(40); + time(40); + expect(usePlayer.getState().postPlay).toBe(false); + time(80); + expect(usePlayer.getState()).toMatchObject({ postPlay: true, countdown: 5 }); + }); it.each(['hidden', 'mini'] as const)('holds the countdown while %s', (reason) => { time(81); if (reason === 'hidden') Object.assign(document, { hidden: true }); diff --git a/src/player/store.ts b/src/player/store.ts index 5107db3..40a18a6 100644 --- a/src/player/store.ts +++ b/src/player/store.ts @@ -647,8 +647,12 @@ function fallbackAfterError() { function maybeCredits(pos: number) { const st = usePlayer.getState(); - if (st.item?.type !== 'episode' || !st.firstFrame || st.postPlayDismissed) return; - if (st.item.markers.some((m) => m.type === 'credits' && pos * 1000 >= m.start && pos * 1000 < m.end)) openPostPlay(); + if (st.item?.type !== 'episode' || !st.firstFrame) return; + const inCredits = st.item.markers.some((m) => m.type === 'credits' && pos * 1000 >= m.start && pos * 1000 < m.end); + // Leaving the credits (seeking back into the episode) re-arms Up Next for the next time they start. + if (!inCredits) { + if (st.postPlayDismissed && !st.postPlay && !st.ended) usePlayer.setState({ postPlayDismissed: false }); + } else if (!st.postPlayDismissed) openPostPlay(); } function onEnded() { @@ -657,7 +661,11 @@ function onEnded() { usePlayer.setState({ ended: true }); report('stopped'); checkScrobble(); - if (st.item?.type === 'episode') openPostPlay(); + // Reaching the end always offers Up Next, as on Android, even after watching the credits. + if (st.item?.type === 'episode' && !st.postPlay) { + usePlayer.setState({ postPlayDismissed: false }); + openPostPlay(); + } } export const usePlayer = create((set, get) => ({ diff --git a/src/styles/player.css b/src/styles/player.css index b292de6..0ca1f70 100644 --- a/src/styles/player.css +++ b/src/styles/player.css @@ -711,11 +711,8 @@ html.os-macos:not(.window-fullscreen) .player-top { .up-next { display: flex; flex-direction: column; - --up-top: 44px; - --up-video-w: clamp(320px, 34vw, 640px); -} -html.os-macos:not(.window-fullscreen) .up-next { --up-top: 64px; + --up-video-w: clamp(320px, 34vw, 640px); } .up-next-scene { position: absolute; @@ -745,28 +742,30 @@ html.os-macos:not(.window-fullscreen) .up-next { .up-next-backdrop .backdrop-scrim, .up-next-backdrop.washed .backdrop-scrim { background: - linear-gradient(90deg, rgba(9, 10, 12, 0.95) 0%, rgba(9, 10, 12, 0.86) 36%, rgba(9, 10, 12, 0.6) 64%, rgba(9, 10, 12, 0.28) 100%), + linear-gradient(90deg, rgba(9, 10, 12, 0.96) 0%, rgba(9, 10, 12, 0.9) 38%, rgba(9, 10, 12, 0.74) 62%, rgba(9, 10, 12, 0.55) 100%), linear-gradient(0deg, var(--bg) 0%, rgba(9, 10, 12, 0.6) 22%, transparent 55%); } .up-next-top { - position: absolute; - top: 0; - left: 0; - right: 0; - height: 34px; + height: 60px; z-index: 3; } -.up-next-top .window-controls { - position: absolute; - top: 0; - right: 0; - height: 34px; - margin: 0; +.up-next-fullscreen { + margin-left: auto; } -.up-next-top .window-controls button { +/* Beside the window's own buttons (Windows, outside full screen), it takes + their size and line so the four read as one group. */ +.up-next-top:has(> .window-controls) .up-next-fullscreen { + align-self: flex-start; + width: 46px; height: 34px; + margin-right: 110px; + border-radius: 0; color: #e4e8e9; } +.up-next-top:has(> .window-controls) .up-next-fullscreen svg { + width: 15px; + height: 15px; +} .up-next-head { position: relative; z-index: 1; @@ -860,7 +859,8 @@ html.os-macos:not(.window-fullscreen) .up-next { } .up-next-summary { margin: 14px 0 0; - color: #d0d5d8; + color: #e3e7e9; + text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6), 0 1px 14px rgba(0, 0, 0, 0.55); font-size: 14px; line-height: 1.62; display: -webkit-box; @@ -880,13 +880,14 @@ html.os-macos:not(.window-fullscreen) .up-next { .up-next-play.counting:hover:not(:disabled) { background: #a3a8a9; } -.up-next-play.counting::before { - content: ''; +.up-next-play-fill { position: absolute; - inset: 0 auto 0 0; + inset: 0; z-index: -1; - width: var(--fill); background: #f6f7f7; + transform: scaleX(0); + transform-origin: left; + will-change: transform; } .up-next-play:focus-visible { outline: 2px solid #fff; @@ -905,8 +906,21 @@ html.os-macos:not(.window-fullscreen) .up-next { .up-next-shelf { margin-bottom: 22px; } +/* Cards are sized from the space below the header, so the season and related + rows fill it (--up-row: a row's height besides its artwork). In a short, + wide window they keep a sensible size and the related row runs off the + bottom, as on Android TV. */ +.up-next-rows { + container-type: size; + --up-row: 128px; +} .up-next-shelf .shelf .card.landscape { - width: clamp(200px, 15.5vw, 290px); + width: clamp(15vw, calc((50cqh - var(--up-row)) * 16 / 9), 26vw); +} +@media (max-width: 1333px) { + .up-next-shelf .shelf .card.landscape { + width: clamp(200px, calc((50cqh - var(--up-row)) * 16 / 9), 26vw); + } } .up-next-shelf .card { scroll-margin-left: 0;