diff options
Diffstat (limited to 'web/script/player/mod.ts')
-rw-r--r-- | web/script/player/mod.ts | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/web/script/player/mod.ts b/web/script/player/mod.ts index f290db4..1c4b87c 100644 --- a/web/script/player/mod.ts +++ b/web/script/player/mod.ts @@ -12,7 +12,6 @@ import { TrackKind, get_track_kind } from "./mediacaps.ts"; import { Player } from "./player.ts"; import { Popup } from "./popup.ts"; import { Playersync, playersync_controls } from "./sync.ts" -import { MSEPlayerTrack } from "./track/mse.ts"; globalThis.addEventListener("DOMContentLoaded", () => { if (document.body.classList.contains("player")) { @@ -218,10 +217,10 @@ function initialize_player(el: HTMLElement, node_id: string) { player.video, show_stats.map(do_show => e("div", player.active_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")} | ${show.metric(b * 8, "b/s")}`)), - ...tracks.map((t, i) => t instanceof MSEPlayerTrack ? t.profile.map(p => - e("pre", `mse track ${i}: ` + (p ? `profile ${p.id} (${show_profile(p)})` : `remux`)) - ) : e("pre", `vtt track ${i}: native jvtt`)) + player.downloader.bandwidth_avail.map(b => e("pre", `estimated available bandwidth: ${show.metric(b, "B/s")} | ${show.metric(b * 8, "b/s")}`)), + player.downloader.bandwidth_used.map(b => e("pre", `estimated used bandwidth: ${show.metric(b, "B/s")} | ${show.metric(b * 8, "b/s")}`)), + player.downloader.total_downloaded.map(b => e("pre", `downloaded bytes total: ${show.metric(b, "B")}`)), + ...tracks.map(t => t.debug()) ) ))), logger.element, @@ -329,13 +328,13 @@ function mouse_idle(e: HTMLElement, timeout: number): OVar<boolean> { return idle } -function show_profile(profile: EncodingProfile): string { +export function show_profile(profile: EncodingProfile): string { if (profile.audio) return `codec=${profile.audio.codec} br=${show.metric(profile.audio.bitrate, "b/s")}${profile.audio.sample_rate ? ` sr=${show.metric(profile.audio.sample_rate, "Hz")}` : ""}` if (profile.video) return `codec=${profile.video.codec} br=${show.metric(profile.video.bitrate, "b/s")} w=${profile.video.width} preset=${profile.video.preset}` if (profile.subtitles) return `codec=${profile.subtitles.codec}` return `???` } -function show_volume(v: number): string { +export function show_volume(v: number): string { return `${(v * 100).toFixed(2)}% | ${v == 0 ? "-∞" : (Math.log2(v) * 10).toFixed(2)}dB` } |