Vinyl
    Preparing search index...

    Class PlaybackControllerImpl

    An object that may dispatch events and have handlers for those events. Similar to the DOM's EventTarget, this is a basic event system based on event naming.

    Some of the advantages of EventHost over EventTarget:

    • Not all supported platforms support EventTarget construction or extension.
    • EventTarget is designed for the DOM, with bubble and capture phases not necessary in Vinyl.
    • Event types are strict.
    • Events can be plain objects, no need to extend CustomEvent.
    • Easier unsubscription and disposal; reduces the risk of memory leaks.

    EventHost supports concurrent modification, that is, handlers may be added or removed during the execution of another handler.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    logPrefix: string

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

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

      True if this controller 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 Error object for the most recent error, or null if there has not been an error. When an error event is received by the element, you can determine details about what happened by examining this object.

      Returns null | Error

    • 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(): number

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

      Returns number

    • get paused(): boolean

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

      Returns boolean

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

    • Returns void

    • 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

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