import { PlayerChannel, VideoInfo } from './PlayerChannel.js'; export type SchedulerEvent = { start: number; duration: number; media: VideoInfo; }; export type SanitizedScheduler = { events: SchedulerEvent[]; }; export declare class PlayerChannelScheduler { /** * Default added media duration when none is provided (i.e. for twitch streams) */ static readonly DEFAULT_DURATION: number; /** * List of past events. * An event is considered in the past if its end timestamp is inferior than the current timestamp. * Past events are sorted from oldest to less-old. */ private pastEvents; /** * List of future events. This includes event that already started and are still in progress. * Once an event is finished, it is taken away from this list and put in pastEvents. * There may be a delay when past events are still in this list due to the current implementation of the scheduler. * Future events are sorted from nearest to farest. */ private futureEvents; /** * Reference to the linked player channel */ readonly playerChannel: PlayerChannel; constructor(playerChannel: PlayerChannel); /** * Get the list of all events */ get events(): SchedulerEvent[]; /** * * @param start Start timestamp in ms * @param media Media information * @param duration Duration in ms */ add(media: VideoInfo, start: number, duration?: number): void; /** * Insert an event. Internally put it in the correct list, and already sorted * @param newEvent */ insertEvent(newEvent: SchedulerEvent): void; /** * Remove a scheduled event * @param start */ remove(start: number): void; /** * @param start Start timestamp in ms * @param end End timestamp in ms * @returns whether a time slot is free or not */ isTimeSlotFree(start: number, end: number): boolean; /** * Tick method */ tick(): void; /** * Returns all the past and future events, sorted by date * @returns */ sanitized(): SanitizedScheduler; }