diff options
author | metamuffin <metamuffin@disroot.org> | 2025-02-11 14:38:03 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-02-11 14:38:03 +0100 |
commit | 545164925f3d724b9313f8e871dbb444fc016168 (patch) | |
tree | efea90a939e217d2bf7ef6093f7b810a77bab9c7 | |
parent | ffe3e9cca5341ff102ac2211e165b908e068be15 (diff) | |
download | jellything-545164925f3d724b9313f8e871dbb444fc016168.tar jellything-545164925f3d724b9313f8e871dbb444fc016168.tar.bz2 jellything-545164925f3d724b9313f8e871dbb444fc016168.tar.zst |
Disable tracks that cant be played
-rw-r--r-- | web/script/player/profiles.ts | 6 | ||||
-rw-r--r-- | web/script/player/track/mse.ts | 3 |
2 files changed, 7 insertions, 2 deletions
diff --git a/web/script/player/profiles.ts b/web/script/player/profiles.ts index 5402721..3344ef6 100644 --- a/web/script/player/profiles.ts +++ b/web/script/player/profiles.ts @@ -40,7 +40,10 @@ export class ProfileSelector { if (!this.is_init) await this.init(), this.is_init = true; const sup_remux = await this.remux_supported(track); - if (!sup_remux && !this.profiles.length) return this.player.logger?.log("None of the available codecs are supported. The Media can't be played back.") + if (!sup_remux && !this.profiles.length) { + this.player.logger?.log("None of the available codecs are supported. This track can't be played back.") + return false + } const min_prof = sup_remux ? -1 : 0 const co = profile.value?.order ?? min_prof // TODO use actual bitrate as a fallback. the server should supply it. @@ -60,6 +63,7 @@ export class ProfileSelector { } // profile.value = profs[0] + return true } log_change(track: number, p: EncodingProfileExt | undefined) { diff --git a/web/script/player/track/mse.ts b/web/script/player/track/mse.ts index b7a31e0..5d1842f 100644 --- a/web/script/player/track/mse.ts +++ b/web/script/player/track/mse.ts @@ -49,7 +49,8 @@ export class MSEPlayerTrack extends PlayerTrack { } this.buffered.value = [] - await this.profile_selector.select_optimal_profile(this.track_index, this.profile); + const canplay = await this.profile_selector.select_optimal_profile(this.track_index, this.profile); + if (!canplay) return this.player.set_track_enabled(this.track_index, false) const ct = track_to_content_type(this.track_from_profile())!; console.log(`track ${this.track_index} source buffer content-type: ${ct}`); this.source_buffer = this.player.media_source.addSourceBuffer(ct); |