Looking for the old docs? Go here

Providers

Audio

This provider enables playing audio files via the HTML5 audio element.

The audio provider is used to embed sound content into documents via the native <audio> element.

INFO

Refer to the Player component if you’re looking for props, methods, and events.

Single Source

    
    

Multiple Sources

    
    

Source Object

The src property on the player accepts any of the following source objects: MediaStream, MediaSource, Blob, and File. You can optionally specify it’s an audio object by setting the source type to audio/object.

    
    

The audio source URL should include on the following file extensions: m4a, m4b, mp4a, mpga, mp2, mp2a, mp3, m2a, m3a, wav, weba, aac, oga, spx.

If the source URL does not contain a file extension, you must provide one of the following type hints: audio/mpeg, audio/ogg, audio/3gp, audio/mp4, audio/webm, audio/flac, audio/object.

The following are valid as they have a file extension (e.g, .mp3) or type hint (e.g., audio/mp3):

  • src="https://example.com/audio.mp3"
  • src = { src: "https://example.com/audio", type: "audio/mp3" }

You can obtain a reference to the underlying HTMLAudioElement element like so:

    
    

The HTMLAudioElement can also be referenced on all media events like so: