diff options
author | metamuffin <metamuffin@disroot.org> | 2024-05-14 00:24:58 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-05-14 00:24:58 +0200 |
commit | 8752a12e954600152e9eaa60ed29af585ed06c64 (patch) | |
tree | 700fedf7d82e940b256ca828e5c98bd1ce0ada44 /web/script/player/track/vtt.ts | |
parent | 07fc74f4d8fcd3137e3cdbc462c06c50acccb31e (diff) | |
download | jellything-8752a12e954600152e9eaa60ed29af585ed06c64.tar jellything-8752a12e954600152e9eaa60ed29af585ed06c64.tar.bz2 jellything-8752a12e954600152e9eaa60ed29af585ed06c64.tar.zst |
better jsp debuggability
Diffstat (limited to 'web/script/player/track/vtt.ts')
-rw-r--r-- | web/script/player/track/vtt.ts | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/web/script/player/track/vtt.ts b/web/script/player/track/vtt.ts index 02a7792..8301457 100644 --- a/web/script/player/track/vtt.ts +++ b/web/script/player/track/vtt.ts @@ -1,3 +1,4 @@ +import { e } from "../../jshelper/src/element.ts"; import { SourceTrack, JvttCue } from "../jhls.d.ts"; import { Player } from "../player.ts"; import { PlayerTrack } from "./mod.ts"; @@ -48,6 +49,10 @@ export class VttPlayerTrack extends PlayerTrack { } this.on_ready() } + + public debug(): HTMLElement { + return e("pre", `vtt track ${this.track_index}\n\t${this.cues?.length} cues loaded`) + } } function create_cue(cue: JvttCue): VTTCue { @@ -55,15 +60,16 @@ function create_cue(cue: JvttCue): VTTCue { const props = parse_layout_properties(cue.content.split("\n")[0]) if (props) { c.text = cue.content.split("\n").slice(1).join("\n") - // TODO this does not work at all... - const region = new VTTRegion() - if ("position" in props && props.position.endsWith("%")) - region.regionAnchorX = parseFloat(props.position.replace("%", "")) - if ("line" in props && props.line.endsWith("%")) - region.regionAnchorY = parseFloat(props.line.replace("%", "")) - if ("align" in props) - c.align = props.align as AlignSetting - c.region = region + // TODO re-enable when it works + // // TODO this does not work at all... + // const region = new VTTRegion() + // if ("position" in props && props.position.endsWith("%")) + // region.regionAnchorX = parseFloat(props.position.replace("%", "")) + // if ("line" in props && props.line.endsWith("%")) + // region.regionAnchorY = parseFloat(props.line.replace("%", "")) + // if ("align" in props) + // c.align = props.align as AlignSetting + // c.region = region } else { c.line = -2; } |