diff options
Diffstat (limited to 'web/script/player/track.ts')
-rw-r--r-- | web/script/player/track.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/web/script/player/track.ts b/web/script/player/track.ts index cc21763..c7d90da 100644 --- a/web/script/player/track.ts +++ b/web/script/player/track.ts @@ -32,7 +32,7 @@ export class PlayerTrack { async init() { await this.player.profile_selector.select_optimal_profile(this.track_index, this.profile); const ct = track_to_content_type(this.track_from_profile())! - console.log("source buffer content-type: " + ct); + console.log(`track ${this.track_index} source buffer content-type: ${ct}`); this.source_buffer = this.player.media_source.addSourceBuffer(ct); this.source_buffer.mode = "segments"; this.source_buffer.addEventListener("updateend", () => { @@ -51,6 +51,10 @@ export class PlayerTrack { console.error("sourcebuffer abort", e); }); } + destroy() { + console.log(`destroy source buffer for track ${this.track_index}`); + this.player.media_source.removeSourceBuffer(this.source_buffer) + } track_from_profile(): SourceTrack { if (this.profile.value) return profile_to_partial_track(this.profile.value) |