diff --git a/frontend/src/components/files/LyricsList.vue b/frontend/src/components/files/LyricsList.vue
index d71823f7e..370631bd1 100644
--- a/frontend/src/components/files/LyricsList.vue
+++ b/frontend/src/components/files/LyricsList.vue
@@ -16,14 +16,14 @@
("scrollLocked");
@@ -76,6 +76,7 @@ const activeLyricIndex = ref(-1);
const activeWordIndex = ref(-1);
const syncedLyrics = computed(() => isSyncedLyrics(props.lyrics));
+const isSeekable = (line: LyricLine) => syncedLyrics.value && !line.untimed;
// "Title - Artist" shown above the lyrics from the [ti:] [ar:] tags on lyrics (if present)
const meta = computed(() => [props.lyrics.lrcMeta?.title, props.lyrics.lrcMeta?.artist].filter(Boolean).join(" - "));
const lockLabel = computed(() => (scrollLocked.value ? t("player.unlockLyrics") : t("player.lockLyrics")));
diff --git a/frontend/src/components/player/AudioPlayer.vue b/frontend/src/components/player/AudioPlayer.vue
index 33b1c85bb..736056893 100644
--- a/frontend/src/components/player/AudioPlayer.vue
+++ b/frontend/src/components/player/AudioPlayer.vue
@@ -244,7 +244,6 @@ const playbackQueueState = usePlaybackQueue({
});
const {
queueCount,
- playbackQueue,
loop,
toastVisible,
toastType,
@@ -260,7 +259,7 @@ const {
resetPlaybackMenuState,
} = playbackQueueState;
-const shouldAutoplay = computed(() => props.autoPlayEnabled || playbackQueue.value.length > 1);
+const shouldAutoplay = computed(() => props.autoPlayEnabled);
let seekOnReleaseCleanup: (() => void) | null = null;
diff --git a/frontend/src/components/player/__tests__/AudioPlayer.fileSwap.test.ts b/frontend/src/components/player/__tests__/AudioPlayer.fileSwap.test.ts
index 0bc773c86..8c7ff05f8 100644
--- a/frontend/src/components/player/__tests__/AudioPlayer.fileSwap.test.ts
+++ b/frontend/src/components/player/__tests__/AudioPlayer.fileSwap.test.ts
@@ -149,7 +149,7 @@ describe("AudioPlayer file swap", () => {
session = installMediaSession();
vi.stubGlobal(
"URL",
- Object.assign(URL, {
+ Object.assign(class extends URL {}, {
createObjectURL: vi.fn(() => {
const url = `blob:art-${created.length}`;
created.push(url);
diff --git a/frontend/src/components/player/__tests__/VideoPlayer.fileSwap.test.ts b/frontend/src/components/player/__tests__/VideoPlayer.fileSwap.test.ts
index 306186f61..114443d11 100644
--- a/frontend/src/components/player/__tests__/VideoPlayer.fileSwap.test.ts
+++ b/frontend/src/components/player/__tests__/VideoPlayer.fileSwap.test.ts
@@ -466,6 +466,8 @@ describe("VideoPlayer file swap", () => {
hoisted.offerGate = null;
await swapTo(FILE_B);
+ expect(fakePlayers).toHaveLength(1);
+ expect(video().getAttribute("src")).toBe("/raw/b.mp4");
release();
await settle();
diff --git a/frontend/src/components/prompts/Prompts.vue b/frontend/src/components/prompts/Prompts.vue
index 143ed435e..2379b934a 100644
--- a/frontend/src/components/prompts/Prompts.vue
+++ b/frontend/src/components/prompts/Prompts.vue
@@ -22,6 +22,7 @@
zIndex: 5 + prompts.indexOf(prompt),
}"
:aria-label="`${prompt.name}-prompt`"
+ :data-prompt-id="prompt.id"
tabindex="-1"
>
p.id === id);
if (!prompt) return null;
- const label = `${prompt.name}-prompt`;
return Array.isArray(windows)
- ? windows.find(w => w?.getAttribute('aria-label') === label)
+ ? windows.find(w => w?.dataset.promptId === String(id))
: windows;
},
onPointerDown(e, id, type) {
@@ -685,8 +685,7 @@ export default {
});
// Find the element for this prompt
- const windows = this.$refs.promptWindow;
- const el = Array.isArray(windows) ? windows.find(w => w?.getAttribute('aria-label') === `${this.prompts.find(p => p.id === id)?.name}-prompt`) : windows;
+ const el = this.getPromptElement(id);
if (el) this.clampDragOffset(id, el);
},
onPointerEnd(_e, id, type, moveHandler, endHandler) {
@@ -707,10 +706,7 @@ export default {
const pos = this.getPointerPos(e, type);
if (!pos) return;
// Find the window
- const windows = this.$refs.promptWindow;
- const el = Array.isArray(windows)
- ? windows.find(w => w?.getAttribute('aria-label') === `${this.prompts.find(p => p.id === id)?.name}-prompt`)
- : windows;
+ const el = this.getPromptElement(id);
if (!el) return;
// Capture current size (if not already fixed, set it)
let sizes = this.sizes;
@@ -819,10 +815,7 @@ export default {
y: start.offsetY + deltaOffsetY,
});
// Clamp to viewport
- const windows = this.$refs.promptWindow;
- const el = Array.isArray(windows)
- ? windows.find(w => w?.getAttribute('aria-label') === `${this.prompts.find(p => p.id === id)?.name}-prompt`)
- : windows;
+ const el = this.getPromptElement(id);
if (el) this.clampDragOffset(id, el);
},
onResizeEnd(_e, type, moveHandler, endHandler) {
diff --git a/frontend/src/composables/player/__tests__/useSwipeNavigationGestures.test.ts b/frontend/src/composables/player/__tests__/useSwipeNavigationGestures.test.ts
index 7bd913d62..43cc53e90 100644
--- a/frontend/src/composables/player/__tests__/useSwipeNavigationGestures.test.ts
+++ b/frontend/src/composables/player/__tests__/useSwipeNavigationGestures.test.ts
@@ -6,7 +6,7 @@ import { useSwipeNavigationGestures } from "../useSwipeNavigationGestures.ts";
import { withSetup } from "./mediaTestUtils.ts";
vi.mock("@/store/index.ts", () => ({
- state: reactive({ navigation: { enabled: false, previousLink: "", nextLink: "" } }),
+ state: reactive({ prompts: [], navigation: { enabled: false, previousLink: "", nextLink: "" } }),
getters: {
currentPrompt: () => null,
isPreviewPlaybackQueueNavMode: () => false,
diff --git a/frontend/src/composables/player/useDoubleTapSeek.ts b/frontend/src/composables/player/useDoubleTapSeek.ts
index 2d12146cb..0283af80b 100644
--- a/frontend/src/composables/player/useDoubleTapSeek.ts
+++ b/frontend/src/composables/player/useDoubleTapSeek.ts
@@ -166,7 +166,7 @@ export function useDoubleTapSeek({
ignoreClickUntil = Date.now() + 500;
return;
}
- gestures.clearEdgeTapGestureState();
+ handleCenterTap(event);
ignoreClickUntil = Date.now() + 500;
};
let edgeClickToggleTimer: ReturnType | null = null;
diff --git a/frontend/src/composables/player/useMediaKeyboard.ts b/frontend/src/composables/player/useMediaKeyboard.ts
index 31c5d591f..55fa8b465 100644
--- a/frontend/src/composables/player/useMediaKeyboard.ts
+++ b/frontend/src/composables/player/useMediaKeyboard.ts
@@ -33,7 +33,7 @@ export function useMediaKeyboard(options: MediaKeyboardOptions) {
}
// left/right arrows for seek feedback
if (key === "arrowleft" || key === "arrowright") {
- if (!options.player.value) return;
+ if (!options.player.value || state.prompts.length > 0) return;
event.preventDefault();
options.flashSkipFeedback(key === "arrowleft");
return;
diff --git a/frontend/src/composables/player/useSwipeNavigationGestures.ts b/frontend/src/composables/player/useSwipeNavigationGestures.ts
index e9db2c874..f5b7c2380 100644
--- a/frontend/src/composables/player/useSwipeNavigationGestures.ts
+++ b/frontend/src/composables/player/useSwipeNavigationGestures.ts
@@ -330,6 +330,7 @@ export function useSwipeNavigationGestures({
// Normal close preview
dismissCloseTimer = setTimeout(() => {
dismissCloseTimer = null;
+ if (state.prompts.length > 0) return;
onClosePreview();
}, 120);
dismissHintTimer = setTimeout(() => {
@@ -480,7 +481,8 @@ export function useSwipeNavigationGestures({
}
}
- if (!swipeGesturesActive.value || event.targetTouches.length !== 1) {
+ if (!swipeGesturesActive.value || event.touches.length !== 1) {
+ if (event.touches.length > 1) swipeActiveTouchId = null;
if (edgeKind || edgeDx || edgeDy) {
resetEdgeGestureImmediate();
}
@@ -560,6 +562,10 @@ export function useSwipeNavigationGestures({
event.preventDefault();
return;
}
+ if (event.touches.length > 0) {
+ resetEdgeGestureImmediate();
+ return;
+ }
// Normal swipe gesture
edgeDx = t.pageX - edgeStartX;
edgeDy = t.pageY - edgeStartY;
diff --git a/frontend/src/composables/player/useTranscodePlayback.ts b/frontend/src/composables/player/useTranscodePlayback.ts
index 10da75177..1e2f51f48 100644
--- a/frontend/src/composables/player/useTranscodePlayback.ts
+++ b/frontend/src/composables/player/useTranscodePlayback.ts
@@ -182,6 +182,16 @@ export function useTranscodePlayback(options: UseTranscodePlaybackOptions) {
let startPreparationId = 0;
let transcodeFallbackAttempted = false;
let transcodeOfferEmitted = false;
+ interface PendingModeRequest {
+ mode: string;
+ playPrime?: ReturnType | null;
+ }
+ let pendingModeRequest: PendingModeRequest | null = null;
+ function takePendingModeRequest(): PendingModeRequest | null {
+ const request = pendingModeRequest;
+ pendingModeRequest = null;
+ return request;
+ }
let resumeOnGestureArmed = false;
let resumeOnGestureHandler: (() => void) | null = null;
@@ -648,7 +658,7 @@ export function useTranscodePlayback(options: UseTranscodePlaybackOptions) {
}
offerLookupPending = false;
console.error("Failed to check transcode sessions:", err);
- showTranscodeOffer({ enabled: false, canStart: false, sessions: [] });
+ showTranscodeOffer({ enabled: true, canStart: true, sessions: [] });
}
}
/** Looks up the session status and shows the offer for it */
@@ -673,7 +683,7 @@ export function useTranscodePlayback(options: UseTranscodePlaybackOptions) {
}
offerLookupPending = false;
console.error("Failed to check transcode sessions:", err);
- showTranscodeOffer({ enabled: false, canStart: false, sessions: [] });
+ showTranscodeOffer({ enabled: true, canStart: true, sessions: [] });
}
}
@@ -688,7 +698,7 @@ export function useTranscodePlayback(options: UseTranscodePlaybackOptions) {
if (!Number.isFinite(video.duration) || video.duration <= 0) {
return;
}
- void offerTranscodePlayback();
+ void offerTranscodePlayback({ confirmedFailure: true });
}
function syncPlayerAfterTranscodeReady(): void {
@@ -1098,9 +1108,21 @@ export function useTranscodePlayback(options: UseTranscodePlaybackOptions) {
if (!TRANSCODE_MODES.includes(mode)) {
return;
}
- if (mode === transcodeMode.value || transcodeSwitchInProgress.value) {
+ if (transcodeSwitchInProgress.value) {
+ pendingModeRequest = { mode, playPrime };
return;
}
+ if (mode === transcodeMode.value) {
+ return;
+ }
+ if (
+ TRANSCODE_HLS_MODES.includes(mode) &&
+ (!getReq()?.source || !getReq()?.path || !transcodeEnabled.value || !resolveViewTokenForTranscode())
+ ) {
+ syncPlaybackUrl({ transcodeMode: transcodeMode.value });
+ return;
+ }
+ pendingModeRequest = null;
invalidateOfferRequest();
const previousMode = transcodeMode.value;
const wasPlaying = !!player.value?.playing;
@@ -1137,7 +1159,7 @@ export function useTranscodePlayback(options: UseTranscodePlaybackOptions) {
}
try {
if (TRANSCODE_HLS_MODES.includes(mode)) {
- await startTranscodePlayback({
+ const started = await startTranscodePlayback({
replaceSessionId,
startSec: player.value?.currentTime ?? 0,
mode,
@@ -1145,6 +1167,12 @@ export function useTranscodePlayback(options: UseTranscodePlaybackOptions) {
playPrime: wasPlaying ? playPrime : null,
manageSwitchState: false,
});
+ if (!started.ok && started.reason === "preconditions" && generation === fileGeneration) {
+ transcodeMode.value = previousMode;
+ if (previousMode === "native") {
+ await switchToNativePlayback({ autoplay: wasPlaying });
+ }
+ }
} else if (needsTranscodeFirst(transcodeProbeParams())) {
let status: TranscodeStatus | null = null;
try {
@@ -1187,6 +1215,10 @@ export function useTranscodePlayback(options: UseTranscodePlaybackOptions) {
if (generation === fileGeneration) {
syncPlaybackUrl({ transcodeMode: transcodeMode.value });
}
+ const next = takePendingModeRequest();
+ if (next && generation === fileGeneration && next.mode !== transcodeMode.value) {
+ void switchTranscodeMode(next.mode, { playPrime: next.playPrime });
+ }
transcodeLog("switchTranscodeMode done", {
mode: transcodeMode.value,
transcodeActive: transcodeActive.value,
@@ -1333,6 +1365,7 @@ export function useTranscodePlayback(options: UseTranscodePlaybackOptions) {
invalidateOfferRequest();
startPreparationId++;
modeSwitchToken = null;
+ pendingModeRequest = null;
transcodeSwitchOwner = null;
transcodeSwitchInProgress.value = false;
videoStreamAttached.value = false;
diff --git a/frontend/src/player/hlsAdapter.js b/frontend/src/player/hlsAdapter.js
index 72a3ea686..f78864ef1 100644
--- a/frontend/src/player/hlsAdapter.js
+++ b/frontend/src/player/hlsAdapter.js
@@ -211,7 +211,9 @@ function attachNativeHls({
return new Promise((resolve, reject) => {
const deadlineMs = resolveAttachDeadlineMs(initialStart, budgetMs);
let settled = false;
+ let hasPlayed = false;
let timeoutId = null;
+ const originalPreload = video.getAttribute('preload');
const removeListeners = () => {
clearTimeout(timeoutId);
@@ -221,11 +223,17 @@ function attachNativeHls({
};
const releaseSource = () => {
video.removeAttribute('src');
+ if (originalPreload === null) {
+ video.removeAttribute('preload');
+ } else {
+ video.setAttribute('preload', originalPreload);
+ }
video.load();
};
const cleanup = () => {
removeListeners();
video.removeEventListener('error', onError);
+ video.removeEventListener('playing', onPlaying);
releaseSource();
};
const fail = (error) => {
@@ -262,7 +270,7 @@ function attachNativeHls({
function reportPostReadyError(error) {
const data = { fatal: true, type: 'mediaError', details: 'nativeHlsError', code: error.code, reason: error.message };
const startSec = Number.isFinite(video.currentTime) ? video.currentTime : 0;
- const shouldAutoplay = !video.paused && !video.ended;
+ const shouldAutoplay = hasPlayed ? !video.paused && !video.ended : undefined;
cleanup();
if (error.code === MediaError.MEDIA_ERR_NETWORK && onRecoverPlayback) {
void onRecoverPlayback({ startSec, sessionId, shouldAutoplay })
@@ -278,6 +286,9 @@ function attachNativeHls({
}
onFatal?.(data);
}
+ function onPlaying() {
+ hasPlayed = true;
+ }
function onTimeout() {
transcodeError('native hls attach timed out waiting for readiness', {
playlistURL,
@@ -309,6 +320,7 @@ function attachNativeHls({
video.addEventListener('loadeddata', onReady);
video.addEventListener('canplay', onReady);
video.addEventListener('error', onError);
+ video.addEventListener('playing', onPlaying);
timeoutId = setTimeout(onTimeout, deadlineMs);
video.preload = 'auto';
video.src = playlistURL;
diff --git a/frontend/src/player/transcodePlaybackController.js b/frontend/src/player/transcodePlaybackController.js
index 7081745fc..066bc88c4 100644
--- a/frontend/src/player/transcodePlaybackController.js
+++ b/frontend/src/player/transcodePlaybackController.js
@@ -334,13 +334,13 @@ export class TranscodePlaybackController {
});
break;
} catch (attachErr) {
- const retryable = attachErr?.name === 'AttachTimeoutError'
+ const retryable = (attachErr?.name === 'AttachTimeoutError' || attachErr?.name === 'NativeHlsError')
&& attachAttempt < MAX_ATTACH_RETRIES
&& this.isCurrentAttempt(attempt);
if (!retryable) {
throw attachErr;
}
- transcodeWarn('HLS attach timed out — reattaching', {
+ transcodeWarn('HLS attach failed before ready — reattaching', {
sessionId: controller.session?.id,
attachAttempt,
});
diff --git a/frontend/src/utils/lyrics.ts b/frontend/src/utils/lyrics.ts
index ec0e543e9..986d4f037 100644
--- a/frontend/src/utils/lyrics.ts
+++ b/frontend/src/utils/lyrics.ts
@@ -23,10 +23,7 @@ export interface LyricsMeta {
export type LyricLines = LyricLine[] & { lrcMeta?: LyricsMeta };
export function isSyncedLyrics(lyrics: LyricLine[]): boolean {
- return (
- lyrics.length > 0 &&
- !lyrics.every((line) => line.timestamp === 0 && !line.words?.some((word) => word.timestamp !== 0))
- );
+ return lyrics.some((line) => !line.untimed);
}
const INLINE_TAG_RE = /<[^>]*>/g;