aboutsummaryrefslogtreecommitdiff
path: root/web/script/player/track/create.ts
blob: e3b0f1761c9d70e7d1160b4b5ad329f0673086fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
    This file is part of jellything (https://codeberg.org/metamuffin/jellything)
    which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
    Copyright (C) 2025 metamuffin <metamuffin.org>
*/
import { VttPlayerTrack } from "./vtt.ts";
import { MSEPlayerTrack } from "./mse.ts";
import { Player } from "../player.ts";
import { PlayerTrack } from "./mod.ts";
import { TrackInfo } from "../types_stream.ts";

export function create_track(player: Player, base_url: string, segment_index: number, track_index: number, track_info: TrackInfo): PlayerTrack | undefined {
    if (track_info.kind == "subtitle") return new VttPlayerTrack(player, base_url, track_index, track_info)
    else return new MSEPlayerTrack(player, base_url, segment_index, track_index, track_info)
}