Vinyl
    Preparing search index...

    Interface TrackController<TrackLoadOptionsType>

    Responsible for queuing track load configurations. This is the authority for which is the current track.

    interface TrackController<TrackLoadOptionsType extends TrackLoadOptions> {
        currentTrack: null | ReadonlyTrack;
        queue: readonly TrackLoadOptionsType[];
        clearPrefetch(): void;
        clearQueue(): void;
        clearTrackCache(): void;
        enqueue(...loadOptionsList: readonly TrackLoadOptionsType[]): void;
        getCachedTrack(uri: string): null | ReadonlyTrack;
        getCachedTracks(): IterableIterator<ReadonlyTrack>;
        hasAnyListeners(): boolean;
        hasListeners(
            type: keyof TrackControllerEventMap<TrackLoadOptionsType>,
        ): boolean;
        hasNext(): boolean;
        isTrackCached(uri: string): boolean;
        load(...loadOptionsList: readonly TrackLoadOptionsType[]): void;
        next(): void;
        on<K extends keyof TrackControllerEventMap<TrackLoadOptionsType>>(
            type: K,
            handler: EventHandler<TrackControllerEventMap<TrackLoadOptionsType>[K]>,
            options?: SignalOptions,
        ): Unsubscribe;
        preload(...loadOptionsList: readonly TrackLoadOptionsType[]): void;
        reset(): void;
        unload(): void;
    }

    Type Parameters

    Hierarchy (View Summary)

    Implemented by

    Index

    Properties

    currentTrack: null | ReadonlyTrack

    Returns the current track.

    queue: readonly TrackLoadOptionsType[]

    Returns the current queue of TrackLoadOptions. Observe 'queueChange' for changes to this queue.

    Methods

    • Clears all fetched fragments and source buffers. Playback will be interrupted, and streaming will resume again when data has been fetched and buffered. This should be called if a change has been made where the user would expect an immediate change, for example, changing streaming quality from SD to HD.

      Does not unload manifests.

      Returns void

    • Clears the current queue. Does not stop the current track or affect the prefetched cache.

      Returns void

    • Clears the track cache and unloads the current track.

      Returns void

    • Appends the given tracks to the current queue.

      Parameters

      Returns void

    • Returns true if the event host has any listeners.

      Returns boolean

    • Returns true if there is at least one track in the queue.

      Returns boolean

    • Returns true if the track with the given URI is cached.

      Parameters

      • uri: string

      Returns boolean

    • Sets the current queue to the provided track list. When the track ends, the next will be played.

      load does not begin playback. Call play() after a load to start playback. Browser autoplay policies may require the first call to play() to be in response to a user interaction such as a click, touch, keypress, or voice event.

      Note that if the current track is the first track provided in the list, that track will be restarted. To set the queue without unloading the current track, use clearQueue followed by enqueue.

      Parameters

      • ...loadOptionsList: readonly TrackLoadOptionsType[]

        A list of load configuration objects to set as a playback queue.

      Returns void

    • Activates the next track in the queue. If the media is not paused the next track will begin playing automatically.

      Returns void

      ReadonlyTrackController.hasNext

    • Preloads the given list of tracks. The tracks provided will not be enqueued. The track controller's cache size will automatically increase to accommodate the request.

      Prefetch priority note: Tracks have a prefetch priority, later calls to preload will have a higher precedence than previous calls. Previous tracks given to preload will drop off when they are evicted from the cache. This is dependent on cache size.

      Parameters

      Returns void

    • Resets the current track's error state.

      Returns void

    • Unloads the active track and clears the queue. This is the same as calling load with zero parameters.

      Returns void