Amazon 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
    logPrefix: string = ...

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

    • 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

    • 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

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

      • tolerance: number = 0.5

        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>