diff options
author | metamuffin <metamuffin@disroot.org> | 2023-12-11 00:21:13 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-12-11 00:21:13 +0100 |
commit | b42ded3fcaf2088e464c5d4861449879a90c6ba0 (patch) | |
tree | eff66c1c39a8e2ec61f121d446964d61c24ac7e7 /web/script/player/mod.ts | |
parent | b050eb5c37e68a6fdd57068d4e73748bea3b0a11 (diff) | |
download | jellything-b42ded3fcaf2088e464c5d4861449879a90c6ba0.tar jellything-b42ded3fcaf2088e464c5d4861449879a90c6ba0.tar.bz2 jellything-b42ded3fcaf2088e464c5d4861449879a90c6ba0.tar.zst |
horrible midnight fixes and some fancy popups in the player
Diffstat (limited to 'web/script/player/mod.ts')
-rw-r--r-- | web/script/player/mod.ts | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/web/script/player/mod.ts b/web/script/player/mod.ts index 11690b6..4e4a4cc 100644 --- a/web/script/player/mod.ts +++ b/web/script/player/mod.ts @@ -7,7 +7,7 @@ import { OVar, show } from "../jshelper/mod.ts"; import { e } from "../jshelper/mod.ts"; import { Logger } from "../jshelper/src/log.ts"; import { EncodingProfile } from "./jhls.d.ts"; -import { TrackKind } from "./mediacaps.ts"; +import { TrackKind, get_track_kind } from "./mediacaps.ts"; import { Player } from "./player.ts"; import { Popup } from "./popup.ts"; @@ -53,7 +53,14 @@ function initialize_player(el: HTMLElement, node_id: string) { } }) new Popup(button, popups, () => - e("div", { class: "jsp-track-select-popup" }, "This is some text") + e("div", { class: "jsp-track-select-popup" }, + ...(player.tracks ?? []) + .filter(t => get_track_kind(t.info.kind) == kind) + .map(t => e("div", + e("span", { class: "jsp-track-name" }, t.info.name), " ", + e("span", { class: "jsp-track-lang" }, t.info.language) + )) + ) ) return button } @@ -68,7 +75,7 @@ function initialize_player(el: HTMLElement, node_id: string) { ), pri = e("div", { class: "jsp-pri" }, pri_current = e("div", { class: "jsp-pri-current" }), - player.tracks.map( + player.active_tracks.map( tracks => e("div", ...tracks.map((t, i) => t.buffered.map( ranges => e("div", ...ranges.map( r => e("div", { @@ -101,7 +108,7 @@ function initialize_player(el: HTMLElement, node_id: string) { const pel = e("div", { class: "jsp" }, player.video, - show_stats.map(do_show => e("div", player.tracks.map(tracks => + 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.profile.map(p => |