Vinyl
    Preparing search index...

    Interface SegmentController

    Provides segments for a given time. Handles segment prefetching and caching.

    interface SegmentController {
        error: null | Error;
        fetchedRanges: ReadonlyRanges;
        streamingQuality: null | MediaQualityMetadata;
        activate(): void;
        clear(): void;
        configure(options: Partial<PrefetchOptions>): void;
        deactivate(): void;
        dispose(): void;
        getDuration(): Promise<null | number>;
        getSegment(
            time: number,
            abort?: ReadonlyAbort,
        ): Promise<null | SegmentReference<ArrayBuffer>>;
        hasAnyListeners(): boolean;
        hasListeners(type: keyof SegmentControllerEventMap): boolean;
        on<K extends keyof SegmentControllerEventMap>(
            type: K,
            handler: EventHandler<SegmentControllerEventMap[K]>,
            options?: SignalOptions,
        ): Unsubscribe;
        reset(): void;
    }

    Hierarchy (View Summary)

    Implemented by

    Index

    Properties

    error: null | Error
    fetchedRanges: ReadonlyRanges

    The time ranges currently fetched.

    streamingQuality: null | MediaQualityMetadata

    The most recently requested quality metadata.

    Methods

    • Indicates that this segment provider is providing segments for an active track and should be prioritized accordingly.

      Returns void

    • Clears the cached segments. Currently pending segment promises will be rejected with an abort reason.

      Returns void

    • Configures this segment provider.

      Parameters

      Returns void

    • Indicates that this segment provider is providing segments for an inactive track.

      Returns void

    • Returns void

    • The duration of the media, in seconds. Returns null if duration cannot be determined.

      Returns Promise<null | number>

    • Returns a Promise for a segment for the given time and currently selected media. The returned promise may abort with an AbortError if a seek occurs to outside the prefetch window.

      Parameters

      • time: number

        The time, in seconds, the requested segment should span.

      • Optionalabort: ReadonlyAbort

        Aborts the returned promise and releases the lock on prefetching. The segment request will not be interrupted unless the time goes out of prefetch ranges.

      Returns Promise<null | SegmentReference<ArrayBuffer>>

    • Returns true if the event host has any listeners.

      Returns boolean

    • Resets failed segments to a pending state.

      Returns void