MusicKit JS

RSS for tag

Add an Apple Music player to your web app using MusicKit JS.

MusicKit JS Documentation

Posts under MusicKit JS tag

30 Posts
Sort by:
Post not yet marked as solved
4 Replies
2.5k Views
I want to use Apple Music using MusicKit. I've created MusicKit identifier and private key by following all the steps mentioned here: https://help.apple.com/developer-account/#/devce5522674 I have my Team ID, the Music key ID and the private key (.p8 file) with me. I tried to generate the required JWT token by using many scripts that were mentioned in similar questions asked here, but none of them have worked so far. When I try to authenticate, I'm getting an error ERROR_FAILED_TO_VERIFY_JWT. Ref: Codes I've tried to generate the JWT token from: Thread 130168 - https://developer.apple.com/forums/thread/130168 A nice and simple blog by Lee Martin [Blog - Creating an Apple Music API Token] Thread 79074 - https://developer.apple.com/forums/thread/79074 Many other links But sadly, none of them worked and I had to post this question. I have tried the sample Android app: https://developer.apple.com/download/more/?=Android%20MusicKit After authentication, the page goes on with an infinite loader, which I believe must be because of the same error ERROR_FAILED_TO_VERIFY_JWT Also tried with this HTML page: <html> <head> <meta name="apple-music-developer-token" content="the-JWT-token-generated-using-the-reference-links"> <meta name="apple-music-app-name" content="My App Name"> <meta name="apple-music-app-build" content="1978.4.1"> </head> <body> <button id="apple-music-authorize"></button> <button id="apple-music-unauthorize"></button> </body> <script src="link-to-musickit.js"></script> <script> let music = MusicKit.getInstance(); &#9;&#9;music.player.play(); &#9;&#9;music.authorize().then(function() { &#9;&#9;&#9;&#9;music.player.play(); &#9;&#9;}); &#9;&#9;music.authorize().then(function() { &#9;&#9;&#9;&#9; music.api.library.albums.then(function(cloudAlbums) { &#9;&#9;&#9;&#9;&#9;&#9;&#9;// user's cloudAlbums &#9;&#9;&#9;&#9;}); &#9;&#9;}); </script> </html>
Posted Last updated
.
Post not yet marked as solved
1 Replies
505 Views
Cannot get various songs to play and cannot figure out what is causing it. It appears to be certain albums don't play. For instance Eric Church's Chief album plays fine, but his Soul album does not play.
Posted
by Westy28.
Last updated
.
Post not yet marked as solved
0 Replies
546 Views
For some reason when I go through the same process as shown here: https://developer.apple.com/documentation/musickitjs/ using MusicKit JS to authorize a user, the popup opens a user logs in and then on the access request screen you click allow nothing happens. You can see in the network tab when inspecting that the usertoken is being generated but the popup isn't closing and no matter what I try I cannot extract the usertoken, any thoughts?
Posted
by Drew97sl.
Last updated
.
Post not yet marked as solved
0 Replies
525 Views
If a user has only added one song from an album in its library, the library album endpoint (/me/library/albums) will return this album. It does not make sense because the user did not add the full album to its library, only one song. Note that the Apple Music app is doing the same in its Library > Albums section. How to retrieve only those albums which have been added ?
Posted
by fkdev.
Last updated
.
Post not yet marked as solved
1 Replies
518 Views
Hello Everyone, We've had an idea for a hardware controller for Logic X, and have already made prototypes that work with Garage Band and other applications. My question is - Does Apple have a development license available for Logic X? Thanks.
Posted
by Frank_XOZ.
Last updated
.
Post not yet marked as solved
0 Replies
844 Views
[Ticket on Feedback Assistant FB12353357] Hi there, We’re experiencing issues playing explicit songs using MusicKitJS for the Web (tested on both stable v1 and beta v3). Upon calling the SDK’s “play()” function, the following error gets logged in the console “CONTENT_RESTRICTED: Content restricted” and playback doesn’t begin. The Storefront we’ve tested in is “it”, but very likely all of them are impacted with the issue, here’s a few Adam IDs of affected tracks: 1681182396, 1683117248, 1669607876. A quick check with the REST APIs reveals indeed that the relevant thing all 3 of them have in common is "contentRating" being "explicit”. The bug isn’t however easy or predictable to replicate because it seems that it can be somewhat solved by fiddling with both the “Screen Time” restrictions settings within an iOS/iPadOS device (of course logged in with the same Apple account), as well as with the “Parental Controls” dashboard located in the Web version of the Apple Music’s settings page. We’re still not 100% sure what exactly “triggers” the fix, but both mentioned dashboards above are essential in attempting to solve it by trial and error. Specifically: in the “Parental Controls” dashboard what helps is actually turning ON the restrictions with the toggle, and then easing them up the most by specifically setting the less restricted available option in all 3 dropdown menus (pretty baffling); in the “Screen time” dashboard what helps is simply enabling/disabling the feature itself altogether, as well as the “Content & Privacy restrictions” toggle, and changing the level of allowed content between “Clean” and “Explicit”; I also want to highlight the fact that during the entire process, for the issue to be actually solved, users every time had to to restart their iPhone/iPad multiple times after changing a setting in “Screen time”, along with deauthorizing/authorizing (logging out and back in) their Apple Music account from the MusicKitJS SDK. The issue seems to always affect freshly created Apple accounts right from the start, we’re not aware of methods that can lead to the bug “coming back” and starting to happen again after being solved manually with the process above (meddling “randomly” with dashboards). It’s a pretty serious one because many of our users do not posses an Apple device and only use their Apple Music subscription on the Web and/or their Android device, meaning that the “Screen time” dashboard isn’t available for them. We’ve never been able to solve the problem on an Apple ID account solely by fiddling with the “Parental Controls” dashboard located in the Web version of the Apple Music’s settings page: tinkering with the “Screen time” settings was essential every single time, meaning owning an Apple device is essential to solve it. Last thing I’m adding is that the issue doesn’t seem to also affect listening to these explicit songs directly with the various first-party Apple Music clients (tested on the iOS native app, Android native app, and on the Apple Music WebApp). Steps to reproduce: on the Web, create a new Apple ID account and activate an Apple Music subscription (do not login with said account on an Apple device); go to the Apple Music WebApp settings page at music.apple.com/account/settings and make sure that the “Parental Controls” restrictions are turned OFF; open any explicit song in the Apple Music WebApp and confirm that playback is allowed; login and authorize the newly created account using any website/application integrated with the MusicKitJS SDK (v1 or v3, doesn’t matter); open the same explicit song as before (or any other) in said third-party client that uses the SDK and verify that playback doesn’t begin and an error “CONTENT_RESTRICTED: Content restricted” is logged in the console upon playing. Additional infos: Apple ID account region and language: Italy - Italian; Storefront affected: IT but possibly all of them; MusicKitJS versions affected: both v1 and v3; Browser where the issue was reproduced: Chrome v114. Attached you’ll find some informational screenshots. Thanks!
Posted
by centomxm.
Last updated
.
Post not yet marked as solved
0 Replies
788 Views
Hi, We are a funded startup developing a music festival and concert application that integrates with Apple Music. Two big features the API is missing are PUT and DELETE endpoints for tracks on a playlist. Both of these would drastically enhance the user experience on third-party apps that leverage Apple Music, specifically for editing and curating playlists. We have also noticed many errors returned as 403 when we have literally just signed in with a brand new token. We have confirmed on our end that the token is valid, fresh and can be used through other clients. As well, Apple's MusicKitJS SDK could use a bit of work. We were able to unminify and work around these issues; most of them were addressed with a simple try/catch and retry routine. We love the Apple Music API and SDK, and in general found it super easy to integrate with, setup and use. We also firmly believe Apple puts out superior products to other technology firms in the same industry. It was disappointing to see the API and SDK for Apple Music falling behind compared to other music providers who offer similar API's. We really hope Apple improves and enhances these offerings in the future. Also just wanted to give a shotout and thanks to all of the devs who make these services accessible and the integration possible. We wouldn't be here without you, and didn't want this post to come off as a rant just more of a friendly "nudge."
Posted Last updated
.
Post not yet marked as solved
0 Replies
518 Views
There are a couple of tracks that recently are throwing an net::ERR_FILE_NOT_FOUND error in console. All other songs are playing music just fine. One ID in question: 1685732269
Posted
by nyc2phx.
Last updated
.
Post not yet marked as solved
0 Replies
545 Views
Hello everyone, I'm currently working on some projects in React that involve using MusicKit on the web. However, I've been having some trouble finding a package that works with React. I've noticed that there's a beta version of MusicKit for web available, but I'm not sure if Apple has released an npm package for it yet. If there isn't an npm package available, is it still possible to use MusicKit on the web using just HTML and JavaScript? I'd appreciate any guidance or advice on how to get started with this. Thank you in advance for your help! Best regards.
Posted
by Briggs560.
Last updated
.