Posts

Post not yet marked as solved
0 Replies
233 Views
I'm trying to implement a unique Id for each pass that someone adds to their wallet. Something like a unique membership Id or even something as simple as displaying a unique username. What is the process of setting this up? I already have everything set up to generate the pass and update the values of the pass fields, but how can I make this specific to a single pass? I feel like I have everything I need to support this but not sure of the workflow I should use. I found this endpoint: https://developer.apple.com/documentation/walletpasses/return_a_personalized_pass but unsure what the personalizationToken is or how I'd provide this. Is this the same as the "pushToken"? It also references this: https://developer.apple.com/documentation/walletpasses/personalizationdictionary/requiredpersonalizationinfo which seems to require previously entered user information.
Posted
by gonzosan.
Last updated
.
Post not yet marked as solved
2 Replies
834 Views
I have my music kit instance setup with a few songs:   await musicKitInstance.setQueue({     songs: ["726416473", "1099848811"],     startPlaying: true,   }); Previously I was having issues with tracks playing back to back, but with these tracks I don't have this issue. I wanted this queue to continue looping. I then thought to add:   await musicKitInstance.setQueue({     songs: ["726416473", "1099848811"],     startPlaying: true, repeatMode:1   }); and that does loop, but it only loops the last song. I also changed it to 2 and it does the same thing. I looked through the docs, but they don't really explain this from what I saw. If there's some documentation that clearly explains the various options I can use for the music kit instance I'd like to see it.
Posted
by gonzosan.
Last updated
.
Post not yet marked as solved
0 Replies
700 Views
I'm working on an application that matches tracks from Spotify using an ISRC. I'm using this endpoint: https://api.music.apple.com/v1/catalog/us/songs?filter[isrc]=USQE92100257 example is taken from here: https://developer.apple.com/documentation/applemusicapi/get_multiple_catalog_songs_by_isrc Every now and then we won't be able to find a specific song even though it exists in Apple's library but under a different storefront. By default, we're using the "US" storefront, but tracks may be available in say "GB" or some other storefront. Is there a way to search multiple storefronts when this happens? I know I could change the storefront value in the endpoint, but this is impractical as we often use tracks available in multiple countries. Is there an endpoint that allows me to search if a song is available on any storefront? On another note, does the Apple player from the Apple Music Kit JS utilize specific storefronts when playing music, or is it just based on having a valid Apple Id? Meaning if 3 songs came from the US storefront but a 4th one was from GB would that affect playback?
Posted
by gonzosan.
Last updated
.
Post not yet marked as solved
6 Replies
1.4k Views
I'm trying to stream an array of Apple music songs that are not tied to a single playlist. I have all the id's of these songs and I can play them individually if I use "setQueue" such as this:    await musicKit.value.setQueue({   songs: ["1616228595", "1564530724"],     autoplay: true,     }); After the first song finishes playing it just stops altogether. How can I have the next song in the array play? I'm able to use:   await musicKit.value.skipToNextItem();   await musicKit.value.skipToPreviousItem(); And that works fine to toggle between the songs in the array, but I haven't found anything that shows an example of how this would be done with an array of songs such as I have. What do I need to add in order to get this playing songs back to back in from the song array?
Posted
by gonzosan.
Last updated
.
Post marked as solved
2 Replies
931 Views
I'm trying to use the seekToTime instance method as shown here: https://developer.apple.com/documentation/musickitjs/musickit/player/2992768-seektotime I don't know what "time" is, is this in seconds or milliseconds? I assume it's in seconds but I figure I'd ask anyway. I am currently using it in this way:   await musicKit.play();   await musicKit.seekToTime(10); This technically works, although it plays first from the start and then abruptly changes to play based on the "time" provided in the seekToTime method. I tried using the seek method before playing but that throws an error. Same thing if I "chain" these together using seekToTime first "then" play the music. Is there a "smoother" way to start playing at a specific time without this abrupt change?
Posted
by gonzosan.
Last updated
.
Post not yet marked as solved
1 Replies
1.1k Views
I'm testing out a dynamic song list to be queued up with Music Kit JS. When testing with a few tracks everything seemed to be working fine but then I ran into this error: The Id in question is Nirvana's "Smells Like Teen Spirit". I retrieved this Id through the Apple Music API and I double-checked it to make sure it was correct and it is. This appeared for a few tracks. I used this API endpoint to verify it was correct: https://api.music.apple.com/v1/catalog/us/songs?filter[isrc]=USGF19942501 this one as well: https://api.music.apple.com/v1/catalog/us/songs/483164390 The ISRC matches that Id, and I can see it directly from the apple id as well. Why does this appear? From everything I see that song does exist and I can play it fine on Apple Music, so why can't I play this through the Music Kit JS instance?
Posted
by gonzosan.
Last updated
.
Post not yet marked as solved
4 Replies
1k Views
I'm trying to figure out if an event gets called whenever I'm streaming with the music kit player and I reload the page. I'm using Chrome and when I reload the page the streaming music stops and says the browser prevented playing without user interaction. Events I have listeners for include: mediaPlaybackError nowPlayingItemDidChange playbackStateDidChange queueIsReady queueItemsDidChange mediaCanPlay Each of these are associated with a console message so I can track when they get called. This is what appears in my console when I start a playlist: I thought that the "mediaPlaybackError" would be called but it wasn't, and no other errors seem to pop up. The documentation here: https://developer.apple.com/documentation/musickitjs/musickit/events doesn't really explain much about the events.
Posted
by gonzosan.
Last updated
.
Post not yet marked as solved
1 Replies
1.4k Views
I'm working on a streaming application using Music Kit. For the login, I'm using the "authorize" method which works fine when I use an account that has an Apple Music subscription. When I use an account that does not have a subscription I get prompted to try out Apple Music: If I click "not now" it doesn't return anything at all from what I see and it just stops my function altogether. This is the code I have setup to test this: const appleLogin = async () => {   console.log("Apple Login Called");   const userToken = await appleMusicInstance.value.authorize();   console.log("user token", userToken); }; When I log in using a subscription account it works fine, I get a token and I can stream full-length songs. When I click "not now" (with a non-subscription account) it just stops. Doesn't even show that my "userToken" received anything and nothing else in the function gets called. I'd like to have the ability for members to log in with their account whether they have a subscription or not and play either full length or previews based on their subscription status. What would be the best solution to this?
Posted
by gonzosan.
Last updated
.
Post marked as solved
3 Replies
2k Views
I'm building a music streaming application using Music Kit JS. The frontend uses Vue and the backend uses Express. That said I had a few questions. I'm trying to generate a token that can be used with the music player configuration. This is how I have it setup currently:   const mk = await (window as any).MusicKit;   musicKit.value = await mk.configure({     developerToken: "DevTokenExample", userToken:"userTokenExample",     app: {       name: "Apple Streaming Example",       build: "1.0.0",     },   }); I've omitted my developer token and user token. I'm able to stream music just fine, but it plays "previews" of the songs. I have a login system setup for Apple OAuth authentication using this process: https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_js And all that works fine, I can get tokens and everything. I tried using the access_token as the userToken in the music kit configuration and the player still plays the previews of the songs. I also used the id_token for the userToken to see if that would make a difference and it didn't do anything different, still played the previews. To clarify, yes the account used is signed up to Apple Music. Since that didn't work, I then used the "musicKit.authorize()" method which gave me a popup and I was trying to log in like that. Once I added in my 2FA code it just says there was an error connecting and I see in the URL an "UNABLE TO VERIFY JWT". The few posts regarding that issue don't seem to have any fixes. My questions are: Can I use the Sign In With Apple Rest API method shown for the music kit user token? If I can't use the Rest API method, how do I resolve the JWT error when using musicKit.authorize()?
Posted
by gonzosan.
Last updated
.