Music & audiomusic.apple.com
Can you embed Apple Music in an iframe?
Yes, with the embed.music.apple.com player. Apple documents this embed code for songs, albums and playlists, not the music.apple.com page.
Checked Test again
Live check
Two links, two results
Playlist pageBlocked
music.apple.com/us/playlist/todays-hits/pl.f4d106fed2bd41149aaacabb233eb5eb- X-Frame-Options
- DENY (ignored)
- CSP frame-ancestors
- 'none'
- Response
- 200 OK · 397 ms · HTTPS
Embed playerEmbeddable
embed.music.apple.com/us/playlist/todays-hits/pl.f4d106fed2bd41149aaacabb233eb5eb- X-Frame-Options
- Not sent
- CSP frame-ancestors
- Not sent
- Response
- 200 OK · 699 ms · HTTPS
Steps
How to embed Apple Music
- Go to music.apple.com and open the song, album or playlist.
- ClickMore (…)thenCopy Embed Code
- Paste the HTML code into your page.
- To set the height and width first, use Apple Music Marketing Tools. Set the size under Preview Player, then click Copy Embed.
Embed code
Paste this into your page
HTML
<iframe
src="https://embed.music.apple.com/{country}/{type}/{name}/{id}"
height="450"
width="100%"
allow="autoplay *; encrypted-media *"
title="Media player">
</iframe>Copy Embed Code gives the exact code. Use that code. Apple's Marketing Tools set the height and width.
URL patterns
Swap the link you have for the embed URL
- You havemusic.apple.com/{country}/album/{name}/{id}Use in the iframeembed.music.apple.com/{country}/album/{name}/{id}
- You havemusic.apple.com/{country}/playlist/{name}/{id}Use in the iframeembed.music.apple.com/{country}/playlist/{name}/{id}
The {country} part is the storefront, such as us.
Good to know
- Listeners who are not signed in can play a 30-second clip of a song.
- For an album or playlist, listeners who are not signed in see a preview with the full song list.
- Listeners who sign in to Apple Music can hear full tracks in the embed.
- Listeners can open Apple Music from the player to sign in or start a free trial.
Sources
- Apple Music User Guide · Share music from Apple Music on the websupport.apple.com/guide/music-web/share-music-apdm0783785d/web
- Apple Music for Artists · Apple Music Marketing Toolsartists.apple.com/support/1117-apple-music-marketing-tools
- Apple Services Marketing Tools · Today's Hitstoolbox.marketingtools.apple.com/en-us/apple-music/us/playlist/pl.f4d106fed2bd41149aaacabb233eb5eb
- MDN · CSP frame-ancestorsdeveloper.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy/frame-ancestors
- iframecheck live check · both links
Profile updated