Post

Replies

Boosts

Views

Activity

Reply to Music Kit JS Reload Page
I understand that, I'm asking for something that Music Kit JS can detect this kind of change. Like I mentioned before, with the Spotify player I was using on reload it calls a playback error event then I can prompt the user to play manually. Is there an event or some error that shows up when playback is interrupted on reload?
May ’22
Reply to Music Kit JS Reload Page
Does anyone have a solution for this? I'm not really sure what I should be checking for. I was able to get something like this resolved with Spotify's player with an event that fired off saying the browser prevented playback. Right now I'm testing this by playing a track and then reloading the page. I just need some way to verify that the player has stopped due to a page reload. I suppose right now my alternative option is to check if the page has reloaded and then restart the Apple music player but that seems like a big workaround for something that should be simple and easy to verify with Music Kit JS.
Apr ’22
Reply to Music Kit JS with Multiple Songs (not in playlist)
So I tested this again today, this time using different tracks and it seems to be working. I did notice that if I use a specific track from Billie Eilish that it would either not play or would play for a second then stop and sometimes even continue to the next track. From the events I have set up, I didn't see any errors. I'm not entirely sure what the issue is, but using a few different tracks works just fine. If I continue to have issues with this then I'll submit a ticket.
Apr ’22
Reply to Music Kit JS with Multiple Songs (not in playlist)
This is the whole function used to load and start the music kit instance: const loadAppleMusic = async () => {   const mk = await (window as any).MusicKit;   console.log("mk", mk);   const token = await getAppleDevToken();   await mk.configure({     developerToken: token,     app: {       name: "MusicKit Music Example",       build: "1.0.0",     },   });   musicKit.value = mk.getInstance();   musicKit.value.volume = 0.5; }; I also previously had it as: musicKit.value = await mkConfigure({}) Then I use this function to play the songs by their id: const loadDynamicTracks = async () => {   await musicKit.value.setQueue({     songs: ["1616228595", "1564530724"],     startPlaying: true,   }); }; I also added these event listeners:   musicKit.value.addEventListener("queueIsReady", (data: any) => {     console.log("Queue is ready", data);   });   musicKit.value.addEventListener("queueItemsDidChange", (data: any) => {     console.log("Queue items changed", data);   }); These fire off once everything is loaded, and it looks like I'm getting the proper songs in the queue from what I've seen. Is there something else I need to update? Seems like I'm missing something that would move to the next song in the queue. Is there an event listener I should add that would help me troubleshoot this? I added this one as well, but it doesn't get called:   musicKit.value.addEventListener("mediaPlaybackError", (data: any) => {     console.log("Playback Error", data);   }); I appreciate the help. Also this is what I'm getting in the console: Right after the song plays "now playing" shows undefined for the item. As you can see in the Queue items changed there are two media items so I don't know what's going on.
Apr ’22
Reply to MusicKit User Token Issues
Ok as I suspected the extra "aud" and "sub" when creating the JWT was causing the issue, at least that's the way it seems while testing. I recreated the developer token without them and used that for the music player and logged in with an account that has a subscription to Apple Music and it worked the first time with no issue. I will consider this solved and will also update my Feedback Assistance ticket as well. Thanks for the help!
Apr ’22
Reply to MusicKit User Token Issues
Thanks, I did test my developer token using curl as mentioned above and got a 200 response. I also tested this through Postman with the same 200 response. This is what I have included in the JWT (blocked out potential sensitive info): I did add in the "sub" and the "aud" as this was needed for the Apple Login logic from what I remember, so I don't know if that is causing the issue. I'm also able to use this token for various Apple Music API endpoints with no issue. I'm also able to use the Apple Music player just fine, but it only plays in preview mode. I'm using my developer token within the configuration there as mentioned: const waitForAppleMusic = async () => {   const mk = await (window as any).MusicKit;   const token = await getAppleDevToken();   musicKit.value = await mk.configure({     developerToken: token,     app: {       name: "MusicKit Music Example",       build: "1.0.0",     },   }); }; I submitted a ticket through Feedback Assistance after I submitted my original post here but have not seen any updates.
Apr ’22