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
|
|
@ -61,6 +61,8 @@ interface PlayerState {
|
|||
video: { width: number; height: number; hwdec: string; codec: string } | null;
|
||||
ended: boolean;
|
||||
nextUp: Item | null;
|
||||
/** The episode before this one, for the previous-episode button. */
|
||||
prevUp: Item | null;
|
||||
countdown: number | null;
|
||||
postPlayDismissed: boolean;
|
||||
fullscreen: boolean;
|
||||
|
|
@ -89,6 +91,7 @@ interface PlayerState {
|
|||
setQuality(q: Quality): Promise<void>;
|
||||
selectVersion(index: number): Promise<void>;
|
||||
playNext(): Promise<void>;
|
||||
playPrevious(): Promise<void>;
|
||||
cancelCountdown(): void;
|
||||
toggleFullscreen(): Promise<void>;
|
||||
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();
|
||||
if (!s || item.type !== 'episode' || !item.grandparentId) return null;
|
||||
if (!s || item.type !== 'episode' || !item.grandparentId) return none;
|
||||
try {
|
||||
const leaves = await api.allLeaves(s, item.grandparentId);
|
||||
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 {
|
||||
return null;
|
||||
return none;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -547,6 +552,7 @@ export const usePlayer = create<PlayerState>((set, get) => ({
|
|||
video: null,
|
||||
ended: false,
|
||||
nextUp: null,
|
||||
prevUp: null,
|
||||
countdown: null,
|
||||
postPlayDismissed: false,
|
||||
fullscreen: false,
|
||||
|
|
@ -587,6 +593,7 @@ export const usePlayer = create<PlayerState>((set, get) => ({
|
|||
buffering: true,
|
||||
ended: false,
|
||||
nextUp: null,
|
||||
prevUp: null,
|
||||
countdown: null,
|
||||
postPlayDismissed: false,
|
||||
chapters: [],
|
||||
|
|
@ -674,7 +681,7 @@ export const usePlayer = create<PlayerState>((set, get) => ({
|
|||
const st = get();
|
||||
if (st.open && !st.ended) report(st.paused ? 'paused' : st.buffering ? 'buffering' : 'playing');
|
||||
}, 10000);
|
||||
findNext(item).then((next) => token === loadToken && set({ nextUp: next }));
|
||||
findNeighbours(item).then((n) => token === loadToken && set(n));
|
||||
} catch (e: any) {
|
||||
if (token !== loadToken) return;
|
||||
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.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);
|
||||
if (fs && !wasFullscreenBeforePlay) win.setFullscreen(false);
|
||||
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 });
|
||||
},
|
||||
|
||||
async playPrevious() {
|
||||
const st = get();
|
||||
if (!st.prevUp) return;
|
||||
await st.play(st.prevUp, { resume: true, quality: st.quality });
|
||||
},
|
||||
|
||||
cancelCountdown() {
|
||||
stopCountdown();
|
||||
set({ countdown: null, postPlayDismissed: true });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue