diff options
author | metamuffin <metamuffin@disroot.org> | 2023-10-27 15:19:02 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-10-27 15:19:02 +0200 |
commit | af39f390c335327297bcd83c303522d750c2bf62 (patch) | |
tree | dda971bf7a1230782549ddecbb7e384539551f59 /web/script/player/profiles.ts | |
parent | 0ed5ae95283c4820a5bf165d0971ba021bed9320 (diff) | |
download | jellything-af39f390c335327297bcd83c303522d750c2bf62.tar jellything-af39f390c335327297bcd83c303522d750c2bf62.tar.bz2 jellything-af39f390c335327297bcd83c303522d750c2bf62.tar.zst |
filter transcoding profiles by support
Diffstat (limited to 'web/script/player/profiles.ts')
-rw-r--r-- | web/script/player/profiles.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/web/script/player/profiles.ts b/web/script/player/profiles.ts index caa46bd..eef28c4 100644 --- a/web/script/player/profiles.ts +++ b/web/script/player/profiles.ts @@ -1,6 +1,6 @@ import { OVar } from "../jshelper/mod.ts"; import { EncodingProfile, JhlsMetadata } from "./jhls.d.ts"; -import { test_media_capability } from "./mediacaps.ts"; +import { profile_to_partial_track, test_media_capability } from "./mediacaps.ts"; import { Player } from "./player.ts"; const PROFILE_UP_FAC = 0.6 @@ -14,8 +14,11 @@ export class ProfileSelector { remux_bandwidth = new Map<number, { size: number, duration: number }>() constructor(private player: Player, private bandwidth: OVar<number>, private metadata: JhlsMetadata) { - for (let id = 0; id < metadata.extra_profiles.length; id++) { - const p = metadata.extra_profiles[id]; + } + async init() { + for (let id = 0; id < this.metadata.extra_profiles.length; id++) { + const p = this.metadata.extra_profiles[id]; + if (!await test_media_capability(profile_to_partial_track(p))) continue if (p.audio) this.profiles_audio.push({ id, order: 0, ...p }) if (p.video) this.profiles_video.push({ id, order: 0, ...p }) if (p.subtitles) this.profiles_subtitles.push({ id, order: 0, ...p }) |