diff options
Diffstat (limited to 'web')
| -rw-r--r-- | web/script/player/jhls.d.ts | 20 | ||||
| -rw-r--r-- | web/script/player/mediacaps.ts | 18 | ||||
| -rw-r--r-- | web/style/forms.css | 3 | ||||
| -rw-r--r-- | web/style/nodepage.css | 5 | 
4 files changed, 28 insertions, 18 deletions
| diff --git a/web/script/player/jhls.d.ts b/web/script/player/jhls.d.ts index 9030a88..9642c66 100644 --- a/web/script/player/jhls.d.ts +++ b/web/script/player/jhls.d.ts @@ -61,19 +61,21 @@ export interface SourceTrack {      codec: string,      language: string,  } -export interface SourceTrackKind { -    video?: { +export type SourceTrackKind = { +    video: {          width: number,          height: number,          fps: number, -    }, -    audio?: { -        channels: number, -        sample_rate: number, -        bit_depth: number, -    }, -    subtitles?: boolean, // incorrect but lazy rn +    }  } +    | { +        audio: { +            channels: number, +            sample_rate: number, +            bit_depth: number, +        } +    } | "subtitles"; +  export interface EncodingProfile {      video?: {          codec: string, diff --git a/web/script/player/mediacaps.ts b/web/script/player/mediacaps.ts index 77a210e..ad1a037 100644 --- a/web/script/player/mediacaps.ts +++ b/web/script/player/mediacaps.ts @@ -21,13 +21,15 @@ export async function test_media_capability(track: SourceTrack): Promise<boolean      return r  }  async function test_media_capability_inner(track: SourceTrack) { -    if (track.kind.subtitles) { -        return track.codec == "V_TEXT/WEBVTT" // TODO: actually implement it +    console.log(track); +    if (track.kind == "subtitles") { +        // TODO do we need to check this? +        return track.codec == "V_TEXT/WEBVTT" || track.codec == "D_WEBVTT/SUBTITLES"      }      let res;      const codec = MASTROSKA_CODEC_MAP[track.codec]      if (!codec) return console.warn(`unknown codec: ${track.codec}`), false -    if (track.kind.audio) { +    if ("audio" in track.kind) {          res = await navigator.mediaCapabilities.decodingInfo({              type: "media-source",              audio: { @@ -38,7 +40,7 @@ async function test_media_capability_inner(track: SourceTrack) {              }          })      } -    if (track.kind.video) { +    if ("video" in track.kind) {          res = await navigator.mediaCapabilities.decodingInfo({              type: "media-source",              video: { @@ -54,6 +56,7 @@ async function test_media_capability_inner(track: SourceTrack) {  }  export function track_to_content_type(track: SourceTrack): string | undefined { +    if (track.kind == "subtitles") return "video/webm"      const codec = MASTROSKA_CODEC_MAP[track.codec]      if (!codec) return      return `${get_track_kind(track.kind)}/webm; codecs="${codec}"` @@ -76,7 +79,7 @@ export function profile_to_partial_track(profile: EncodingProfile): SourceTrack      } else if (profile.subtitles) {          return {              codec: FFMPEG_ENCODER_CODEC_MAP[profile.subtitles.codec], -            kind: { subtitles: true }, +            kind: "subtitles",              language: "en",              name: "test subtitle"          } @@ -92,6 +95,7 @@ const MASTROSKA_CODEC_MAP: { [key: string]: string } = {      "A_OPUS": "opus",      "A_VORBIS": "vorbis",      "S_TEXT/WEBVTT": "webvtt", +    "D_WEBVTT/SUBTITLES": "webvtt",  }  const FFMPEG_ENCODER_CODEC_MAP: { [key: string]: string } = { @@ -104,10 +108,10 @@ const FFMPEG_ENCODER_CODEC_MAP: { [key: string]: string } = {  export type TrackKind = "audio" | "video" | "subtitles"  export function get_track_kind(track: SourceTrackKind): TrackKind { -    if (track.audio) return "audio" -    if (track.video) return "video"      //@ts-ignore // TODO clean this mess up please      // TODO why is the subtitle encoded diffenrently sometimes?!      if (track == "subtitles" || track["subtitles"]) return "subtitles" +    if ("audio" in track) return "audio" +    if ("video" in track) return "video"      throw new Error("invalid track");  } diff --git a/web/style/forms.css b/web/style/forms.css index fca6648..f020eb6 100644 --- a/web/style/forms.css +++ b/web/style/forms.css @@ -35,6 +35,7 @@ fieldset {  }  input[type="submit"], +.play,  button {      color: var(--font-highlight);      padding: 0.5em; @@ -46,10 +47,12 @@ button {      cursor: pointer;  }  input[type="submit"]:disabled, +.play,  button:disabled {      background-color: var(--background-disable);  }  input[type="submit"]:hover, +.play,  button:hover {      filter: brightness(150%);  } diff --git a/web/style/nodepage.css b/web/style/nodepage.css index 67642e8..2b76ede 100644 --- a/web/style/nodepage.css +++ b/web/style/nodepage.css @@ -47,7 +47,8 @@  }  .page.node .title .play {      display: inline-block; -    font-stretch: 200%; +    font-size: small; +    background-color: #52b83340;  }  .page.node .title .play::before {      content: "play_arrow"; @@ -89,4 +90,4 @@      .page.node .bigposter {          margin: 1.5em;      } -}
\ No newline at end of file +} | 
