diff options
Diffstat (limited to 'web/script/player/track.ts')
-rw-r--r-- | web/script/player/track.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/web/script/player/track.ts b/web/script/player/track.ts index fe4c3c1..bcff607 100644 --- a/web/script/player/track.ts +++ b/web/script/player/track.ts @@ -3,7 +3,7 @@ import { JhlsTrack, TimeRange } from "./jhls.d.ts"; import { BufferRange, Player } from "./player.ts"; import { EncodingProfileExt } from "./profiles.ts"; -const TARGET_BUFFER_DURATION = 15 +const TARGET_BUFFER_DURATION = 5 const MIN_BUFFER_DURATION = 1 export interface AppendRange extends TimeRange { buf: ArrayBuffer, index: number, cb: () => void } @@ -79,7 +79,7 @@ export class PlayerTrack { async load(index: number) { this.loading.add(index) this.player.profile_selector.select_optimal_profile(this.track_index, this.profile) - const url = `/n/${encodeURIComponent(this.node_id)}/stream?format=hlsseg&tracks=${this.track_index}&index=${index}${this.profile.value ? `profile=${this.profile.value.id}` : ""}`; + const url = `/n/${encodeURIComponent(this.node_id)}/stream?format=hlsseg&tracks=${this.track_index}&index=${index}${this.profile.value ? `&profile=${this.profile.value.id}` : ""}`; const buf = await this.player.downloader.download(url) await new Promise<void>(cb => { this.append_queue.push({ buf, ...this.metadata.segments[index], index, cb }) @@ -91,6 +91,7 @@ export class PlayerTrack { if (this.append_queue.length) { const seg = this.append_queue[0]; this.source_buffer.timestampOffset = seg.start + // TODO why is pushing so unreliable?! sometimes it does not add it this.source_buffer.appendBuffer(seg.buf); this.append_queue.splice(0, 1) this.current_load = seg |