diff options
author | metamuffin <metamuffin@disroot.org> | 2024-01-16 22:58:23 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-01-16 22:58:23 +0100 |
commit | 1c37d32a0985ff7390313833345b9299f9f0b196 (patch) | |
tree | cd46bcbe7df154bf506c083cf0325d44b3f4e0fb /web/script | |
parent | 98b379afb31e455b529d443dcfc5797b8dd6723e (diff) | |
download | jellything-1c37d32a0985ff7390313833345b9299f9f0b196.tar jellything-1c37d32a0985ff7390313833345b9299f9f0b196.tar.bz2 jellything-1c37d32a0985ff7390313833345b9299f9f0b196.tar.zst |
chapter thumbnail display and player seek via url
Diffstat (limited to 'web/script')
-rw-r--r-- | web/script/player/player.ts | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/web/script/player/player.ts b/web/script/player/player.ts index a92ab4b..ea45e9a 100644 --- a/web/script/player/player.ts +++ b/web/script/player/player.ts @@ -107,9 +107,10 @@ export class Player { this.set_pers("Downloading track indecies...") await this.set_track_enabled(0, true, false) await this.set_track_enabled(1, true, false) - + this.set_pers("Downloading initial segments...") - const start_time = get_continue_time(userdata.watched); + const start_time = get_query_start_time() ?? get_continue_time(userdata.watched); + this.update(start_time) this.video.currentTime = start_time @@ -155,3 +156,12 @@ function get_continue_time(w: WatchedState): number { if (typeof w == "string") return 0 else return w.progress } + +function get_query_start_time() { + const u = new URL(window.location.href) + const p = u.searchParams.get("t") + if (!p) return + const x = parseFloat(p) + if (Number.isNaN(x)) return + return x +} |