diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ef98c0..4a221d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## 0.1.0-beta.14 + +Full screen stays on with the miniplayer, a smoother colour wash, and a round of playback and download fixes. + +- Going back from the full-screen player to the miniplayer now keeps Kaleido in full screen, so you can browse full screen while the video plays in the corner. Press Esc to go back to a window, or on Windows use the new Exit full screen button beside the window controls. Closing the miniplayer leaves the window as it is. +- The colour wash behind the featured titles and title pages now blends into the next title's colours instead of jumping when the artwork changes. Clicking quickly through featured titles no longer blanks the background for a moment. +- Playback stays with the server it started on: progress and watched marks never go to a server you switch to later, and switching account, profile or server ends playback from the old one. Downloads report only to their own server. +- When Plex converts a video, the audio and subtitle tracks you chose (and your language preferences) are now applied, and kept when you change quality. +- Watching a download offline now saves where you stopped and marks it watched. +- Fixed: playing something offline could crash the player. +- Fixed: closing or switching titles while a video was still starting could start it anyway. +- Fixed: Home and the libraries could still show the previous account's or profile's titles after switching. +- Fixed: titles split into several files were downloaded only in part; Kaleido now picks a single-file version, or says it can't download the title. +- Fixed: episodes downloaded into the same season folder could overwrite or delete each other's artwork, and pause or remove could stop working after a download restarted. +- Library grids refresh fully when something changes, slow server responses time out properly, and the featured titles start rotating again when you scroll back to them. + ## 0.1.0-beta.13 A gentler automatic intro skip, and home screens that keep up with your other Plex apps. diff --git a/package-lock.json b/package-lock.json index 71aea19..99a279c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "kaleido-desktop", - "version": "0.1.0-beta.13", + "version": "0.1.0-beta.14", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "kaleido-desktop", - "version": "0.1.0-beta.13", + "version": "0.1.0-beta.14", "dependencies": { "@fontsource-variable/inter": "^5.3.0", "@tanstack/react-query": "^5.105.0", diff --git a/package.json b/package.json index 758ab7c..6455aba 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "kaleido-desktop", "private": true, - "version": "0.1.0-beta.13", + "version": "0.1.0-beta.14", "type": "module", "scripts": { "dev": "vite", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index d21aa89..c83e472 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -2173,7 +2173,7 @@ dependencies = [ [[package]] name = "kaleido" -version = "0.1.0-beta.13" +version = "0.1.0-beta.14" dependencies = [ "fs2", "futures-util", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 6205fe5..b9dbab1 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "kaleido" -version = "0.1.0-beta.13" +version = "0.1.0-beta.14" 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 9b74fde..e084031 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.13", + "version": "0.1.0-beta.14", "identifier": "tv.kaleido.desktop", "build": { "beforeDevCommand": "npm run dev", diff --git a/src/app/App.tsx b/src/app/App.tsx index 6623697..c0e8786 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -11,7 +11,7 @@ import { PageLoader } from '../ui/primitives'; import { Splash } from '../screens/Splash'; import { SignIn } from '../screens/SignIn'; import { ServerPicker } from '../screens/ServerPicker'; -import { isMac, win } from '../platform/native'; +import { isMac, isNative, win } from '../platform/native'; import { usePlayer } from '../player/store'; import { PlayerOverlay } from '../player/PlayerOverlay'; import { DialogHost } from '../screens/dialogs/DialogHost'; @@ -111,7 +111,9 @@ function useGlobalShortcuts() { win.isFullscreen().then((fs) => win.setFullscreen(!fs)); } else if ((e.key === 'Escape' || e.key === 'Backspace') && !isTyping(e.target) && !document.querySelector('.menu-layer, .dialog-layer')) { if (e.key === 'Escape' && document.fullscreenElement) return; - useRouter.getState().back(); + // Esc leaves full screen first (kept from the player when it went to the corner). + if (e.key === 'Escape' && isNative) win.isFullscreen().then((fs) => (fs ? win.setFullscreen(false) : useRouter.getState().back())); + else useRouter.getState().back(); } else if ((e.ctrlKey || e.metaKey) && e.key === ',') { e.preventDefault(); navigate({ name: 'settings', mode: 'app', tab: 'general' }); diff --git a/src/app/TopBar.tsx b/src/app/TopBar.tsx index 3c538fc..6007226 100644 --- a/src/app/TopBar.tsx +++ b/src/app/TopBar.tsx @@ -19,13 +19,21 @@ const NAV = [ /** Caption buttons drawn by the page; macOS shows its own traffic lights instead. */ export function WindowControls() { const [maximized, setMaximized] = useState(false); + const [fullscreen, setFullscreen] = useState(false); useEffect(() => { if (!isNative || isMac) return; let off: (() => void) | undefined; - const sync = () => win.isMaximized().then(setMaximized); + let gone = false; + const sync = () => { + win.isMaximized().then((m) => !gone && setMaximized(m)); + win.isFullscreen().then((f) => !gone && setFullscreen(f)); + }; sync(); - win.onResized(sync).then((u) => (off = u)); - return () => off?.(); + win.onResized(sync).then((u) => (gone ? u() : (off = u))); + return () => { + gone = true; + off?.(); + }; }, []); if (!isNative || isMac) return null; return ( @@ -33,9 +41,15 @@ export function WindowControls() { - + {fullscreen ? ( + + ) : ( + + )} diff --git a/src/app/format.ts b/src/app/format.ts index 47d138a..a41b82d 100644 --- a/src/app/format.ts +++ b/src/app/format.ts @@ -174,17 +174,24 @@ export function plural(n: number, word: string, pluralWord = `${word}s`) { return `${n.toLocaleString()} ${n === 1 ? word : pluralWord}`; } -/** Hex UltraBlur colors → CSS gradient layers for the artwork colour wash. */ -export function washGradient(u: Item['ultraBlur'], strength = 1): string { - if (!u) return ''; +/** Hex UltraBlur colors → the wash's four corner colours, each at its own strength. */ +export function washColors(u: Item['ultraBlur'], strength = 1) { + if (!u) return null; const c = (hex: string, a: number) => { const n = parseInt(hex, 16); return `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, ${(a * strength).toFixed(3)})`; }; + return { topRight: c(u.topRight, 0.95), topLeft: c(u.topLeft, 0.7), bottomRight: c(u.bottomRight, 0.55), bottomLeft: c(u.bottomLeft, 0.45) }; +} + +/** Hex UltraBlur colors → CSS gradient layers for the artwork colour wash. */ +export function washGradient(u: Item['ultraBlur'], strength = 1): string { + const c = washColors(u, strength); + if (!c) return ''; return [ - `radial-gradient(ellipse at 100% 0%, ${c(u.topRight, 0.95)} 0%, transparent 62%)`, - `radial-gradient(ellipse at 0% 0%, ${c(u.topLeft, 0.7)} 0%, transparent 55%)`, - `radial-gradient(ellipse at 100% 100%, ${c(u.bottomRight, 0.55)} 0%, transparent 60%)`, - `radial-gradient(ellipse at 0% 100%, ${c(u.bottomLeft, 0.45)} 0%, transparent 60%)`, + `radial-gradient(ellipse at 100% 0%, ${c.topRight} 0%, transparent 62%)`, + `radial-gradient(ellipse at 0% 0%, ${c.topLeft} 0%, transparent 55%)`, + `radial-gradient(ellipse at 100% 100%, ${c.bottomRight} 0%, transparent 60%)`, + `radial-gradient(ellipse at 0% 100%, ${c.bottomLeft} 0%, transparent 60%)`, ].join(', '); } diff --git a/src/player/store.ts b/src/player/store.ts index 3b1439d..ca60b1e 100644 --- a/src/player/store.ts +++ b/src/player/store.ts @@ -702,10 +702,12 @@ export const usePlayer = create((set, get) => ({ playServer = s; playDownload = download; localScrobbled = false; + // From the miniplayer the window may have gone full screen (or left it) since. + const fullscreenNow = await win.isFullscreen().catch(() => false); + if (stale()) return; if (!previous.open) { triedFallback = false; - wasFullscreenBeforePlay = await win.isFullscreen().catch(() => false); - if (stale()) return; + wasFullscreenBeforePlay = fullscreenNow; } set({ open: true, @@ -730,7 +732,7 @@ export const usePlayer = create((set, get) => ({ audioKey: opts.tracks?.audioKey ?? '', subKey: opts.tracks?.subKey ?? '__init', video: null, - fullscreen: wasFullscreenBeforePlay, + fullscreen: fullscreenNow, mini: false, videoGamma: '', enhance: { ...previous.enhance, bypass: false, preparing: false }, @@ -856,8 +858,12 @@ export const usePlayer = create((set, get) => ({ await mpv.show(false).catch(() => {}); } 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); - if (fs && !wasFullscreenBeforePlay) win.setFullscreen(false); + // Closing the full player hands back the window it found; closing the + // miniplayer leaves browsing as it is, full screen or not. + if (!st.mini) { + const fs = await win.isFullscreen().catch(() => false); + if (fs && !wasFullscreenBeforePlay) win.setFullscreen(false); + } if (st.item) invalidateLibrary(); }, @@ -913,12 +919,8 @@ export const usePlayer = create((set, get) => ({ async minimize() { const st = get(); if (!st.open || st.mini) return; + // Full screen stays for browsing; Esc or the window controls leave it. set({ mini: true }); - // Full screen was for the video; browsing goes back to the window. - if (st.fullscreen && !wasFullscreenBeforePlay) { - await win.setFullscreen(false).catch(() => {}); - set({ fullscreen: false }); - } if (separateMini) { // Once the page is opaque again (no video in it), the video moves into // the miniplayer's own window (miniWindow.ts). @@ -1025,6 +1027,13 @@ usePlayer.subscribe((st, prev) => { bridgeMiniWindow(usePlayer); +// Full screen can change outside the player (Esc or the window controls while +// browsing with the miniplayer, the OS): the player's controls follow it. +win.onResized(() => { + if (!usePlayer.getState().open) return; + win.isFullscreen().then((fs) => usePlayer.getState().fullscreen !== fs && usePlayer.setState({ fullscreen: fs }), () => {}); +}); + /** * Signing out, or switching server or profile, ends a stream from the old one: its * progress belongs to that account. A download keeps playing, without reporting. diff --git a/src/styles/app.css b/src/styles/app.css index a1d258e..8f670c6 100644 --- a/src/styles/app.css +++ b/src/styles/app.css @@ -515,6 +515,12 @@ html.splash-arrival .auth-screen { .backdrop-layer.ready { opacity: 1; } +/* The outgoing art fades too, a beat behind the incoming, so nothing of it is + left to vanish through the new art's faded edges. */ +.backdrop-layer.ready.leaving { + opacity: 0; + transition-delay: 180ms; +} /* The colour wash lives outside the clipped backdrop so it can carry on down the page behind the rows, fading out as it goes. */ .backdrop-tint { @@ -528,14 +534,42 @@ html.splash-arrival .auth-screen { -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.75) 45%, transparent 100%); mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.75) 45%, transparent 100%); } +/* Registered as colours so a change of title blends the wash from one set of + colours to the next, instead of swapping the gradient outright. */ +@property --wash-tr { + syntax: ''; + inherits: false; + initial-value: transparent; +} +@property --wash-tl { + syntax: ''; + inherits: false; + initial-value: transparent; +} +@property --wash-br { + syntax: ''; + inherits: false; + initial-value: transparent; +} +@property --wash-bl { + syntax: ''; + inherits: false; + initial-value: transparent; +} .backdrop-wash { position: absolute; inset: 0; - opacity: 0; - transition: opacity 420ms var(--ease); -} -.backdrop-wash.ready { opacity: 0.5; + background: + radial-gradient(ellipse at 100% 0%, var(--wash-tr) 0%, transparent 62%), + radial-gradient(ellipse at 0% 0%, var(--wash-tl) 0%, transparent 55%), + radial-gradient(ellipse at 100% 100%, var(--wash-br) 0%, transparent 60%), + radial-gradient(ellipse at 0% 100%, var(--wash-bl) 0%, transparent 60%); + transition: + --wash-tr 700ms var(--ease), + --wash-tl 700ms var(--ease), + --wash-br 700ms var(--ease), + --wash-bl 700ms var(--ease); } .backdrop-art { position: absolute; diff --git a/src/ui/Backdrop.tsx b/src/ui/Backdrop.tsx index 15116b6..f3338a9 100644 --- a/src/ui/Backdrop.tsx +++ b/src/ui/Backdrop.tsx @@ -1,21 +1,25 @@ -import { useEffect, useRef, useState } from 'react'; +import { useEffect, useRef, useState, type CSSProperties } from 'react'; import type { Item } from '../plex/types'; import { useServer } from '../app/session'; import { useSettings } from '../app/settings'; -import { art, washGradient } from '../app/format'; +import { art, washColors } from '../app/format'; interface Layer { key: number; src: string; - wash: string; + blur: Item['ultraBlur']; ready: boolean; } +/** How long an outgoing layer lingers: its fade (with delay) plus a margin. */ +const LEAVE_MS = 700; + /** * Artwork-led page background. The image sits top-right and fades into the * page toward its left and bottom edges; the UltraBlur colour wash tints the - * page beneath it and carries on down behind the rows. Changes crossfade; the - * outgoing layer stays until the new image has decoded. + * page beneath it and carries on down behind the rows. Artwork crossfades + * once the new image has decoded, and the wash's colours blend into the new + * title's at the same moment (registered custom properties, app.css). */ export function Backdrop({ item, className = '', width = 1600, height = 900, wash: forceWash }: { item: Item | null | undefined; className?: string; width?: number; height?: number; wash?: Item['ultraBlur'] }) { const server = useServer(); @@ -25,39 +29,50 @@ export function Backdrop({ item, className = '', width = 1600, height = 900, was const path = item ? art.backdrop(item) : ''; const src = path ? server.image(path, width, height) : ''; const blur = forceWash ?? item?.ultraBlur ?? null; - const wash = colorWash && blur ? washGradient(blur) : ''; + const blurKey = blur ? `${blur.topLeft}${blur.topRight}${blur.bottomRight}${blur.bottomLeft}` : ''; useEffect(() => { - if (!src && !wash) return; + if (!src && !blur) return; setLayers((prev) => { - if (prev.length && prev[prev.length - 1].src === src) { - // Same art, maybe new wash. - return prev.map((l, i) => (i === prev.length - 1 ? { ...l, wash } : l)); - } - return [...prev.slice(-1), { key: ++counter.current, src, wash, ready: !src }]; + const last = prev[prev.length - 1]; + // Same art, maybe new colours: the wash blends to them in place. + if (last && last.src === src) return prev.map((l) => (l === last ? { ...l, blur } : l)); + // Keep only what is on screen (the newest layer that has shown) under the new one. + const shown = prev.filter((l) => l.ready).slice(-1); + return [...shown, { key: ++counter.current, src, blur, ready: !src }]; }); - }, [src, wash]); + }, [src, blurKey]); - const onReady = (key: number) => - setLayers((prev) => { - const idx = prev.findIndex((l) => l.key === key); - if (idx < 0) return prev; - const next = prev.map((l) => (l.key === key ? { ...l, ready: true } : l)); - // Drop older layers once the newest is visible (after its fade). - setTimeout(() => setLayers((p) => (p.length > 1 && p[p.length - 1].key === key ? p.slice(-1) : p)), 500); - return next; - }); + const onReady = (key: number) => setLayers((prev) => (prev.some((l) => l.key === key && !l.ready) ? prev.map((l) => (l.key === key ? { ...l, ready: true } : l)) : prev)); + + // Once the newest layer is in, the ones beneath fade out and then go. + const newest = layers[layers.length - 1]; + useEffect(() => { + if (!newest?.ready || layers.length < 2) return; + const t = setTimeout(() => setLayers((p) => (p[p.length - 1]?.key === newest.key ? p.slice(-1) : p)), LEAVE_MS); + return () => clearTimeout(t); + }, [newest?.key, newest?.ready, layers.length]); + + let top = -1; + layers.forEach((l, i) => l.ready && (top = i)); + const colors = top >= 0 ? washColors(layers[top].blur) : null; + const washStyle = { + '--wash-tr': colors?.topRight ?? 'transparent', + '--wash-tl': colors?.topLeft ?? 'transparent', + '--wash-br': colors?.bottomRight ?? 'transparent', + '--wash-bl': colors?.bottomLeft ?? 'transparent', + } as CSSProperties; return ( <> {colorWash && (