Vinyl
    Preparing search index...

    Interface ReadonlySegmentController

    The SegmentController provides segments to buffer for the given time. It is expected to prefetch segments based on the expectation of when the segments will be needed next.

    interface ReadonlySegmentController {
        error: null | Error;
        fetchedRanges: ReadonlyRanges;
        streamingQuality: null | MediaQualityMetadata;
        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;
    }

    Hierarchy (View Summary)

    Index

    Properties

    error: null | Error
    fetchedRanges: ReadonlyRanges

    The time ranges currently fetched.

    streamingQuality: null | MediaQualityMetadata

    The most recently requested quality metadata.

    Methods

    • 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