Vinyl
    Preparing search index...

    Class VinylAmznPlayer<TrackLoadOptionsType, OptionsType>

    A Vinyl Media Player with Amazon implementations.

    Type Parameters

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    client: Client

    Provides information about the client, such as device and browser capabilities.

    disposer: Disposer
    logPrefix: string

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

    Amazon business metrics events and state.

    Accessors

    • get "[toStringTag]"(): string

      Returns string

    • get buffered(): ReadonlyRanges

      Returns a new static normalized ReadonlyRanges object that represents the ranges of the media resource, if any, that the user agent has buffered at the moment the buffered property is accessed.

      Note: ReadonlyRanges is a view to the DOM TimeRanges object.

      Returns ReadonlyRanges

    • get bufferingQuality(): null | MediaQualityMetadata

      Returns null | MediaQualityMetadata

      Use `getBufferingQuality('audio')

    • get capabilities(): Capabilities

      Returns Capabilities

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

      Returns the current content types for active streams.

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

    • get currentTime(): number

      The current playback time in seconds. When changed, a 'timeUpdate' event is emitted.

      Returns number

    • get currentTimePercent(): number

      Returns current time as a percent of the total duration.

      Returns number

      A number between 0-1

    • get currentTrack(): null | ReadonlyTrack

      Returns the current track.

      Returns null | ReadonlyTrack

    • get defaultPlaybackRate(): number

      The default playback rate when the user is not using fast forward or reverse for a video or audio resource.

      Returns number

    • set defaultPlaybackRate(value: number): void

      The default playback rate when the user is not using fast forward or reverse for a video or audio resource.

      Parameters

      • value: number

      Returns void

    • get disposed(): boolean

      Returns true if this player has been disposed.

      Returns boolean

    • get duration(): number

      The length of the element's media in seconds. Observe changes with durationChange events.

      Returns number

    • get ended(): boolean

      Indicates whether the media element has ended playback.

      Returns boolean

    • get error(): null | Error

      The last error reported.

      Returns null | Error

    • get fetchedTime(): number

      Returns the time of the prefetch end. If no data has been prefetched for the current track, 0 will be returned.

      The time given will be in seconds according to the media timeline. It will represent the ending time of the continuous prefetch range from the current playhead time.

      Returns number

    • get fetchedTimePercent(): number

      Returns current fetched time as a percent of the total duration.

      Returns number

      A number between 0-1

    • get loop(): boolean

      Controls whether the media element should start over when it reaches the end.

      Returns boolean

    • set loop(value: boolean): void

      Controls whether the media element should start over when it reaches the end.

      Parameters

      • value: boolean

      Returns void

    • get muted(): boolean

      Indicates whether the media element muted. Observe changes with mutedChange events.

      Returns boolean

    • set muted(value: boolean): void

      Indicates whether the media element muted. Observe changes with mutedChange events.

      Parameters

      • value: boolean

      Returns void

    • get networkState(): PlaybackNetworkState

      Indicates the current state of the fetching of media over the network.

      Returns PlaybackNetworkState

    • get options(): OptionsType

      Returns the current player options. Use configure to set.

      Returns OptionsType

    • get paused(): boolean

      Indicates whether the media element is paused. Observe changes with play and pause events.

      Returns boolean

    • get playbackQuality(): null | MediaQualityMetadata

      Returns null | MediaQualityMetadata

      Use `getPlaybackQuality('audio')

    • get playbackRate(): number

      Sets the rate at which the media is being played back. This is used to implement user controls for fast-forward, slow motion, and so forth. The normal playback rate is multiplied by this value to obtain the current rate, so a value of 1.0 indicates normal speed.

      Returns number

    • set playbackRate(value: number): void

      Sets the rate at which the media is being played back. This is used to implement user controls for fast-forward, slow motion, and so forth. The normal playback rate is multiplied by this value to obtain the current rate, so a value of 1.0 indicates normal speed.

      Parameters

      • value: number

      Returns void

    • get playing(): boolean

      True if playback has started, is not paused, stalled, or seeking. Observe changes with 'playing' and 'played' events.

      Returns boolean

    • get playIsPending(): boolean

      True if play has been called and the returned promise is currently in a pending state. Observe changes with PlaybackControllerEventMap.playIsPendingChange events.

      Returns boolean

    • get preservesPitch(): boolean

      Determines whether the browser should adjust the pitch of the audio to compensate for changes to the playback rate. Default: true

      Returns boolean

    • set preservesPitch(value: boolean): void

      Determines whether the browser should adjust the pitch of the audio to compensate for changes to the playback rate. Default: true

      Parameters

      • value: boolean

      Returns void

    • get profileId(): Maybe<string>

      Returns Maybe<string>

    • get queue(): readonly TrackLoadOptionsType[]

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

      Returns readonly TrackLoadOptionsType[]

    • get seekable(): ReadonlyRanges

      Returns a new static normalized ReadonlyRanges object that represents the ranges of the media resource, if any, that the user agent is able to seek to at the time seekable property is accessed.

      Note: ReadonlyRanges is a view to the DOM TimeRanges object.

      Returns ReadonlyRanges

    • get seeking(): boolean

      True if the element is currently seeking. Observe changes with seeking and seeked events.

      Returns boolean

    • get streamingQuality(): null | MediaQualityMetadata

      Returns null | MediaQualityMetadata

      Use getStreamingQuality('audio')

    • get volume(): number

      The volume level for audio portions of the media element. Observe changes with volumeChange events.

      Returns number

    • set volume(value: number): void

      The volume level for audio portions of the media element. Observe changes with volumeChange events.

      Parameters

      • value: number

      Returns void

    • get waiting(): boolean

      True if playback is stopped due to waiting for data. Observe changes with waiting and waited events.

      Returns boolean

    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

    • Sets options on this player. Options will be merged shallowly, for example, configure({ abr: { strategy: AbrStrategy.BEST }}) will replace all previous abr options, and not change other options such as loudnessNormalization.

      Parameters

      Returns void

    • Disposes this player and sub-systems.

      Returns void

    • Appends the given tracks to the current queue.

      Parameters

      Returns void

    • Returns the cached track for the given URI, or null if the track is not cached.

      Parameters

      • uri: string

      Returns null | ReadonlyTrack

    • Returns probed client support information, used for debugging and error reporting.

      Returns Promise<AnyRecord>

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

      Returns boolean

    • Stores pending streamingTerminated and trackStreamed MTS events to persistence. If the app is closed before the player unloads a track, these events will be recovered and emitted (asynchronously) when this function is called on the next application load. The storage mechanism by default is LocalStorage, which may be overridden using the global persistenceRef.

      Parameters

      • Optionaloptions: MtsEventsPersistenceOptions

        Can be provided to set the storage key (default: 'vinylPendingMtsEvents'), and save interval (default: 2s).

      Returns void

    • 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: 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

    • Pauses playback of the media, if the media is already in a paused state this method will have no effect. If a play is pending, the play will be aborted and the promise returned by play() will be rejected.

      Returns void

      • pendingPlay
      • play
    • Attempts to begin playback of the media. It returns a Promise which is resolved when playback has been successfully started.

      Failure to begin playback for any reason, such as permission issues or interruption via pause, results in the promise being rejected.

      The first time play() is invoked, except muted video, should be in response to a user interaction such as a button click.

      Returns Promise<void>

      isNotAllowedError

    • 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

    • Certain track events are redispatched on the player for the current track.

      Returns void

    • Resets the error state.

      Returns void

    • Safely seeks to the given time. The seek will begin only after readyState is at least PlaybackReadyState.HAVE_METADATA. If a previous seek was still pending, the previous seek will be ignored. Returns a Promise that resolves when the seek has completed. If the seek is interrupted by another seek, the promise will be rejected with an AbortError. If the seek is not to a seekable range, the promise will reject with an InvalidSeekError.

      Parameters

      • time: number

        The value, in seconds, to set the playback time.

      • Optionaltolerance: number

        The amount of tolerance to have when the time is outside the seekable ranges to snap, in seconds. If time is outside all seekable ranges beyond this tolerance, the seek will be ignored. Default: 0.5

      Returns Promise<void>

    • Converts Amazon audio quality settings into VinylAmznOptions

      Parameters

      • streamingQuality: StreamingQuality

        One of 'HD', 'STANDARD', or 'DATA_SAVER'

      • abrEnabled: boolean

        If true, quality will be selected based on bandwidth. If false, streamingQuality DATA_SAVER will select the lowest quality, streamingQuality STANDARD will select the highest 'SD' quality, and streamingQuality 'HD' will select the highest HD/UHD quality. See StreamingQuality

      Returns void

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

      Returns void