Vinyl
    Preparing search index...

    Class TrackBase<EventMap, LoadOptionsType>Abstract

    A base class for all tracks.

    Type Parameters

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    _error: null | Error

    Sets on handleError, cleared on 'reset'.

    disposer: Disposer
    drmSessionAbort: AbortSlot
    errorHandler: (error: any) => void
    loadOptions: null | LoadOptionsType

    The current load options, if this is an active track.

    logPrefix: string

    A string prefix for all log statements made by this target.

    type: string

    The track type.

    uri: string

    The identifier of this track, used as the key in the track cache.

    Accessors

    • get "[toStringTag]"(): string

      Returns string

    • get active(): boolean

      True if the track is the currently playing track.

      Returns boolean

    • get contentTypes(): Readonly<Omit<Set<ContentType>, "clear" | "delete" | "add">>

      The current content types for the active streams, e.g. Set(['audio', 'video'])

      Returns Readonly<Omit<Set<ContentType>, "clear" | "delete" | "add">>

    • get disposed(): boolean

      True if the track has been disposed.

      Returns boolean

    • get error(): null | Error

      The last error that occurred in this track, or null if no error.

      Returns null | Error

    • get extra(): any

      Returns the extra object from the load configuration's config when this track is active, or null if this track is not active.

      Returns any

    • get fetchedRanges(): ReadonlyRanges

      The time ranges the track has fetched. This will be a snapshot of the fetched ranges at the time this property is accessed.

      Returns ReadonlyRanges

    Methods

    • Sets this track as active, deactivating any currently active track. This should set sources on the playback source and add any listeners needed for shared resources.

      Parameters

      • loadOptions: LoadOptionsType

        Configuration from TrackLoadOptions.config, provided by the Application.

      Returns void

    • Clears any buffered or prefetched data, if applicable.

      Returns void

    • Returns void

    • Sets this track as inactive. This should unset sources, and remove any listeners. Tracks do not implement disposable, when they are deactivated they are expected to be free for garbage collection if there are no longer references to the track.

      Returns void

    • Dispatches an event.

      Type Parameters

      • K extends string | number | symbol

      Parameters

      • type: K

        The key of the event within EventMap

      • event: EventMap[K]

        If the passed event is read-only, then it may be re-used/cached. Otherwise, it should be a new event object every dispatch. If no target property is set on the event, the target will be set to this host.

      Returns void

    • Returns true if the event host has any listeners for the given type.

      Parameters

      Returns boolean

    • Adds an event handler for the given typed event.

      Type Parameters

      • K extends string | number | symbol

      Parameters

      • type: K

        The key representing the event type to listen for.

      • handler: EventHandler<EventMap[K]>

        A callback to invoke when the event with the given type is dispatched.

      • Optionaloptions: SignalOptions

        Options for changing listening behavior.

      Returns Unsubscribe

      Returns a method, when invoked, removes the handler.

    • The track has been activated. Operations on shared resources such as the playback controller may only be done while the track is currently active. For example if there is a loading operation before the playback source is set, isActive must be checked before the property is changed.

      Parameters

      Returns void

    • Returns void

    • Provides configuration to the track and begins preloading (if applicable).

      Parameters

      • _trackOptions: TrackPreloadOptions

        Configuration provided by the TrackController.

      • _loadOptions: LoadOptionsType

        Configuration from TrackLoadOptions.config, provided by the Application.

      Returns void

    • Resets the track to recover from error states. Base implementation does nothing.

      Overrides should dispatch 'reset' after resetting error state.

      Returns void

    • Returns a string representation of an object.

      Returns string