fix(player): keep playing the current video when it leaves the live feed queue
Auto-marking a video watched near its end invalidates the feed query; the refetched/reordered queue can no longer contain the playing item, so findIndex returned -1 and the active item fell back to queue[0] — silently jumping playback to an unrelated video and defeating Loop "One" (and auto-advance:off). Pin the last resolved video in a ref and keep playing it when it drops out of the queue instead of snapping to queue[0].
This commit is contained in:
parent
2ee4d563f6
commit
0fff5ad35d
3 changed files with 21 additions and 4 deletions
2
VERSION
2
VERSION
|
|
@ -1 +1 @@
|
||||||
0.23.1
|
0.23.2
|
||||||
|
|
@ -93,9 +93,18 @@ export default function PlayerModal({
|
||||||
// `video` in the queue (the feed passes its whole list + the clicked video, no index).
|
// `video` in the queue (the feed passes its whole list + the clicked video, no index).
|
||||||
startIndex != null ? queue?.[startIndex]?.id ?? video.id : video.id
|
startIndex != null ? queue?.[startIndex]?.id ?? video.id : video.id
|
||||||
);
|
);
|
||||||
let index = queue ? queue.findIndex((v) => v.id === playingId) : 0;
|
// Resolve the playing item from the LIVE queue so prev/next + the N/M counter track it. But
|
||||||
if (index < 0) index = 0;
|
// the feed query reorders/refetches under us — e.g. auto-marking the current video watched near
|
||||||
const active = queue && queue[index] ? queue[index] : video;
|
// its end invalidates the feed — and the playing item can drop OUT of the loaded queue. When
|
||||||
|
// that happens we must KEEP PLAYING it, not snap back to queue[0] (which would silently jump to
|
||||||
|
// an unrelated video mid-playback, ignoring loop/auto-advance). So pin the last resolved video
|
||||||
|
// in a ref and fall back to it; neighbour stepping just treats it as sitting before queue[0].
|
||||||
|
const foundIndex = queue ? queue.findIndex((v) => v.id === playingId) : -1;
|
||||||
|
const inQueue = foundIndex >= 0;
|
||||||
|
const activeRef = useRef<Video>(video);
|
||||||
|
const active = inQueue ? queue![foundIndex] : activeRef.current;
|
||||||
|
activeRef.current = active;
|
||||||
|
const index = inQueue ? foundIndex : 0;
|
||||||
const hasQueue = !!queue && queue.length > 1;
|
const hasQueue = !!queue && queue.length > 1;
|
||||||
// startAt only applies to the item we opened with; advanced items resume their own pos.
|
// startAt only applies to the item we opened with; advanced items resume their own pos.
|
||||||
const resumeAt =
|
const resumeAt =
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,14 @@ export interface ReleaseEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const RELEASE_NOTES: ReleaseEntry[] = [
|
export const RELEASE_NOTES: ReleaseEntry[] = [
|
||||||
|
{
|
||||||
|
version: "0.23.2",
|
||||||
|
date: "2026-07-05",
|
||||||
|
summary: "Fixed the player jumping to a different video when the current one is marked watched.",
|
||||||
|
fixes: [
|
||||||
|
"Player: watching a video to the end (or otherwise marking it watched) no longer makes playback jump to an unrelated video. This also fixes Loop “One”, which the jump could override — the current video now correctly repeats even after it drops out of the live feed order.",
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
version: "0.23.1",
|
version: "0.23.1",
|
||||||
date: "2026-07-05",
|
date: "2026-07-05",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue