Search.../

AudioPlayer

An element for playing audio files. Learn more.

Guides

Additional information about this section

Properties

Store values associated with an object

  • artistName

    Sets or gets the name of the artist displayed in an audio player.

  • collapsed

    Indicates if the element is collapsed or expanded.

  • coverImage

    Sets or gets the cover image displayed in an audio player.

  • currentTime

    Gets the current play time from the beginning of the audio track, in seconds.

  • duration

    Gets the total play time of the audio track, in seconds.

  • global

    Indicates if an element appears on all pages or only on the current page.

  • hidden

    Indicates if the element is visible or hidden.

  • id

    Gets the element's ID.

  • isMuted

    Indicates if the volume is currently muted.

  • isPlaying

    Indicates if an audio track is currently playing.

  • isVisible

    Indicates if the element is actually visible.

  • parent

    Gets the element's parent element.

  • rendered

    Indicates if an element is currently in the DOM structure.

  • src

    Sets or gets the file location of the audio file.

  • trackName

    Sets or gets the track name displayed in an audio player.

  • type

    Gets the element's type.

  • volume

    Sets or gets an audio player's volume.

Functions

Perform actions on an object

  • collapse( )

    Collapses the element and sets its collapsed property to true.

  • expand( )

    Expands the element and sets its collapsed property to false.

  • hide( )

    Hides the element and sets its hidden property to true, using an effect if specified.

  • mute( )

    Mutes audio volume.

  • onEnded( )

    Adds an event handler that runs when playback has ended.

  • onMouseIn( )

    Adds an event handler that runs when the mouse pointer is moved onto the element. Deprecation note: The $w parameter of event handlers is being deprecated. To ...

  • onMouseOut( )

    Adds an event handler that runs when the mouse pointer is moved off of the element. Deprecation note: The $w parameter of event handlers is being deprecated. ...

  • onPause( )

    Adds an event handler that runs when playback is paused.

  • onPlay( )

    Adds an event handler that runs when playback is started or restarted.

  • onProgress( )

    Adds an event handler that runs when playback progresses.

  • onViewportEnter( )

    Adds an event handler that runs when an element is displayed in the viewable part of the current window.

  • onViewportLeave( )

    Adds an event handler that runs when an element is no longer displayed in the viewable part of the current window.

  • pause( )

    Pauses playback.

  • play( )

    Begins or resumes playback.

  • scrollTo( )

    Scrolls the page to the top of the element using an animation.

  • seek( )

    Moves playback to the specified time, in seconds.

  • show( )

    Shows the element and sets its hidden property to false, using an effect if specified.

  • stop( )

    Stops playback.

  • togglePlay( )

    Toggles playback.

  • unmute( )

    Unmutes audio volume.