Skip to main content

Audio

Represents an audio control implementation

Implemented by

Index

Properties

loop

loop: boolean

Whether the audio should loop (repeat forever)

playbackRate

playbackRate: number

Set the playbackRate, default is 1.0 at normal speed. For example 2.0 is double speed, and 0.5 is half speed.

volume

volume: number

The volume (between 0 and 1)

Methods

getPlaybackPosition

  • getPlaybackPosition(): number
  • Return the current playback time of the playing track in seconds from the start


    Returns number

getTotalPlaybackDuration

  • getTotalPlaybackDuration(): number
  • Return the duration of the sound


    Returns number

isPaused

  • isPaused(): boolean
  • Returns if the audio is paused


    Returns boolean

isPlaying

  • isPlaying(): boolean
  • Whether or not any audio is playing


    Returns boolean

isStopped

  • isStopped(): boolean
  • Returns if the audio is stopped


    Returns boolean

pause

  • pause(): void
  • Pause the sound


    Returns void

play

  • play(): Promise<any>
  • Will play the sound or resume if paused


    Returns Promise<any>

seek

  • seek(position: number): void
  • Seek to a position (in seconds) in the audio


    Parameters

    • position: number

    Returns void

stop

  • stop(): void
  • Stop playing the sound and reset


    Returns void