ReferenceMedia
SpotifyAudio
Audio component that plays Spotify tracks, episodes, playlists, and shows through the Spotify embed
The Spotify embed accepts tracks, episodes, albums, playlists, shows, and artists. Podcast episodes play in full for signed-out listeners; music plays as a preview until the listener logs in to Spotify.
Import
Load a source
src takes an open.spotify.com URL for any embeddable entity, including the localized (/intl-de/) and already-embedded (/embed/) forms, or a spotify:<type>:<id> URI. A t parameter sets the start position in seconds.
Controls
Spotify’s own chrome is the only UI the embed offers, so controls decides whether the element is visible at all. With controls, it shows Spotify’s player. Without it, the element hides itself and plays as an invisible transport: a hidden iframe still loads and plays, so a player skin’s buttons drive playback while the embed takes no room on the page.
Behavior
The Spotify embed exposes less than a native <audio> element:
- No volume and no mute: the embed takes neither command and reports neither value, so a player skin shows no volume controls at all.
- No playback rate and no text tracks.
loopreplays the entity from the top when it ends; without it, the embed continues into whatever Spotify queues next.
Examples
Basic Usage
API Reference
Props
Accepts these Video.js-specific props:
Engine options
source.engine.spotify
Pass Spotify embed options under source.engine.spotify, spelled exactly as Spotify spells them, plus anything Spotify adds next. Media Sources covers how engine options fit into a structured source.
Refs
ref
Forwards to the rendered <iframe>,
an HTMLIFrameElement. The iframe cannot play or seek; use mediaRef for playback.
mediaRef
Receives the SpotifyAdapter that
drives the embed, which exposes media methods and properties such
as play() and currentTime. It is set once the
adapter has attached to the iframe, so its target is already that iframe, and
it is cleared when the iframe unmounts.
Events
Handle standard media events with React event props such as onPlay and onTimeUpdate. The adapter dispatches them, not the iframe. For events without a React prop, call addEventListener on the adapter from mediaRef.