feat(playback): add configurable timeout for initial playback start

Introduces a race condition between the primary playback source (URL or Torrent) and a configurable timeout. If the primary source fails to reach the 'playing' state within the timeout window, the system automatically falls back to the alternative source.

- Adds `DEFAULT_PLAYBACK_START_TIMEOUT` to instance config (3000ms).
- Updates `PlaybackService` to implement timeout logic using `withTimeout` wrapper.
- Ensures proper cleanup of stalled attempts (resetting video element, destroying torrent client).
This commit is contained in:
google-labs-jules[bot] committed 2026-01-26 15:55:11 +00:00
1 parent e795c74a8e
commit 7921ab6a2e
4 files changed
+87 -7

No files matched your search

+2
View File
@@ -42,6 +42,7 @@ import {
VIEW_COUNT_CACHE_TTL_MS,
ENSURE_PRESENCE_REBROADCAST_COOLDOWN_SECONDS,
DEFAULT_PLAYBACK_SOURCE,
DEFAULT_PLAYBACK_START_TIMEOUT,
} from "../config/instance-config.js";
export const WATCH_HISTORY_VERSION_TAG_VALUE = "2";
@@ -135,3 +136,4 @@ export { VIEW_COUNT_BACKFILL_MAX_DAYS };
export { VIEW_COUNT_CACHE_TTL_MS };
export { ENSURE_PRESENCE_REBROADCAST_COOLDOWN_SECONDS };
export { DEFAULT_PLAYBACK_SOURCE };
export { DEFAULT_PLAYBACK_START_TIMEOUT };