aboutsummaryrefslogtreecommitdiff
path: root/web/script/player/profiles.ts
diff options
context:
space:
mode:
Diffstat (limited to 'web/script/player/profiles.ts')
-rw-r--r--web/script/player/profiles.ts9
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 })