aboutsummaryrefslogtreecommitdiff
path: root/web/script/player/mod.ts
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-10-02 22:35:53 +0200
committermetamuffin <metamuffin@disroot.org>2023-10-02 22:35:53 +0200
commitf50a0e48df9ee2ffdfccd013cb4165c7994f8ee4 (patch)
treece647bbda7a0b34aa1448cdf2f53844d3eff2ed4 /web/script/player/mod.ts
parent7450134996a94c4629f1e112e90ad458a84c0c04 (diff)
downloadjellything-f50a0e48df9ee2ffdfccd013cb4165c7994f8ee4.tar
jellything-f50a0e48df9ee2ffdfccd013cb4165c7994f8ee4.tar.bz2
jellything-f50a0e48df9ee2ffdfccd013cb4165c7994f8ee4.tar.zst
prepare automatic track selection
Diffstat (limited to 'web/script/player/mod.ts')
-rw-r--r--web/script/player/mod.ts17
1 files changed, 15 insertions, 2 deletions
diff --git a/web/script/player/mod.ts b/web/script/player/mod.ts
index bf294aa..9c1b060 100644
--- a/web/script/player/mod.ts
+++ b/web/script/player/mod.ts
@@ -5,6 +5,7 @@
*/
import { OVar, show } from "../jshelper/mod.ts";
import { e } from "../jshelper/mod.ts";
+import { EncodingProfile } from "./jhls.d.ts";
import { Player } from "./player.ts";
document.addEventListener("DOMContentLoaded", () => {
@@ -66,8 +67,13 @@ function initialize_player(el: HTMLElement, node_id: string) {
player.buffering_status.map(b => e("div", { class: "jsp-overlay" },
b ? e("p", { class: "jsp-buffering" }, b) : undefined
)),
- show_stats.map(do_show => !do_show ? e("div") : e("div", {class: "jsp-stats"},
- player.downloader.bandwidth.map(b => e("pre", `estimated bandwidth: ${show.byte_size(b)}`))
+ show_stats.map(do_show => player.tracks.map(tracks =>
+ !do_show ? e("div") : e("div", { class: "jsp-stats" },
+ player.downloader.bandwidth.map(b => e("pre", `estimated bandwidth: ${show.metric(b, "B/s")}`)),
+ ...tracks.map((t, i) => t.profile.map(p =>
+ e("pre", `track ${i}: ` + (p ? `profile ${p.id} (${show_profile(p)})` : `remux`))
+ ))
+ )
)),
controls,
)
@@ -114,3 +120,10 @@ function mouse_idle(e: HTMLElement, timeout: number, cb: (b: boolean) => unknown
}, timeout)
}
}
+
+function show_profile(profile: EncodingProfile): string {
+ if (profile.audio) return `codec=${profile.audio.codec} ar=${show.metric(profile.audio.sample_rate ?? -1, "Hz")} abr=${show.metric(profile.audio.bitrate, "b/s")}`
+ if (profile.video) return `codec=${profile.video.codec} vw=${show.metric(profile.video.width ?? -1, "Hz")} vbr=${show.metric(profile.video.bitrate, "b/s")} preset=${profile.video.preset}`
+ if (profile.subtitles) return `codec=${profile.subtitles.codec}`
+ return `???`
+} \ No newline at end of file