mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
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:
1 parent
e795c74a8e
commit
7921ab6a2e
4 files changed
+87
-7
No files matched your search
@@ -436,3 +436,13 @@ export const ENSURE_PRESENCE_REBROADCAST_COOLDOWN_SECONDS = 5 * 60;
|
||||
* - "torrent": Try WebTorrent first, fall back to CDN/URL.
|
||||
*/
|
||||
export const DEFAULT_PLAYBACK_SOURCE = "url";
|
||||
|
||||
/**
|
||||
* Timeout (in milliseconds) for the initial playback attempt.
|
||||
*
|
||||
* If the preferred source (URL or Torrent) does not reach the "playing" state
|
||||
* within this window, the player will automatically switch to the fallback
|
||||
* source. This prevents users from staring at a loading spinner indefinitely
|
||||
* if the primary source is slow or stalled.
|
||||
*/
|
||||
export const DEFAULT_PLAYBACK_START_TIMEOUT = 3000;
|
||||
Reference in new issue
Block a user