/*
    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) 2026 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, 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, track_index, track_info)
}
