Add an Apple Music player to your web app.
- MusicKit JS 1.0+Beta
MusicKit JS Configuration
Some basic setup is required before you begin to use MusicKit JS.
Creating an Apple Music API Token
You use a developer token to authenticate yourself as a trusted developer and member of the Apple Developer Program and to use MusicKit JS. You can find more information about creating an Apple Music API token in Developer Account Help.
Embedding MusicKit JS in Your Webpage
Use the script tag and link to Apple’s hosted version of MusicKit JS:
Configuring MusicKit JS
To configure the library using only markup, use the following meta tags:
There are two primary ways to handle authorization in your implementation.
Your users can authorize with Apple Music using these authorization buttons. These buttons are bound to
id to signal that they should be declared only once.
Use declarative markup to bind handlers to a
<button> or an
<a> tag that contain an
id attribute of
Wrap MusicKit JS methods in the
authorize method, which returns a promise. The promise resolves with a valid music user token when the user signs in and gives authorization.