MusicKit JS

RSS for tag

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

Posts under MusicKit JS tag

123 Posts

Post

Replies

Boosts

Views

Activity

MusicKit Web Components not working
Hi, I noticed in the documentation that v3 supports web components if we pass the data-web-components attr, however this is not the case and no web component is loaded in https://js-cdn.music.apple.com/musickit/v3/musickit.js, should we be using https://js-cdn.music.apple.com/musickit/v3/components/musickit-components/musickit-components.esm.js instead? Thanks
1
1
909
Nov ’22
Playing a song from non-zero starting position
Summary I am trying to play a song starting at a non-zero starting position. For example, I would like to play a song starting at 10 seconds instead of at 0 seconds. Approach setQueue play seekToTime let music = window.MusicKit.getInstance(); // 1: setQueue music.setQueue({ song: "validSongID" }) .then(() = { // 2: play music.player.play() .then(() = { // 3: seekToTime const position = 10; music.player.seekToTime(position); }); }); Expected results The song should start playing at 10 seconds. Actual results ~4 out of every 5 times it works as expected. ~1 out of every 5 times I get the following error: Uncaught (in promise) TypeError: Failed to execute 'remove' on 'SourceBuffer': The end value provided (0) must be greater than the start value provided (0). See also the full error log attached: Error log - https://developer.apple.com/forums/content/attachment/e6252199-17b4-4497-8ee9-d8078cabd7c6 Further Impact The error that is being thrown does not create an mediaPlaybackError event, so I can't even handle the error properly in my application logic.
2
0
1.7k
Nov ’22
Apple Music
hello, I have the latest BETA IOS16 version, I could benefit from the 3-month Apple Music trial offer so I subscribed today and canceled because I had a message telling me that I could take advantage of the offer until January. Except that I no longer have access, do you have a solution or can I benefit from the offer? the goal is to be able to try and potentially subscribe to a definitive package thank!
2
0
903
Oct ’22
Find Apple song in other storefronts
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?
0
0
994
Oct ’22
******* Apple Music - API - How Much Support? Right Choice?
Hello all! I have a web app mostly developed in JSON. Can I add Apple Music to it and can I do things like: See what songs are being played and play back the most listened to? Grab lyrics and show them on the screen? We have a communication side - can we listen to a song together during a video call? Is Apple Music the best choice for my application? Thanks all!
0
0
1.2k
Sep ’22
MusicKit instance seek to time error
I am using apple MusicKit to song streaming based on action per seconds at specific seconds i try to stop the playing music and start the next on on the queue. i alwyas get this error i am sure that i stopped and then try to play and seekToTime. this is my next function : async function next(time) { const music = MusicKit.getInstance(); await music.skipToNextItem(); await music.play(); await music.seekToTime(time); return; } this is it's call in condition : music.stop().then(function () { next(100) });`
0
0
1.2k
Aug ’22
User Library music not available when considered "now playing"
I have a few reports of users with music purchased outside iTunes/Apple Music not displaying the album artwork when they play it. I was able to reproduce this on my end, but not sure why this would be happening. Is there a setting that needs to be enabled from Apple Music when adding external music? From my end, is there anything I need to when calling setQueue? async playAlbum(album: string, startPosition: number, shuffle = false) { this.toggleShuffle(shuffle); await this.mkInstance.setQueue({ album, startPosition }); await this.play(); } Right now, I just pass the album ID and call that. Should I be doing this differently?
0
0
1.2k
Jul ’22
Status Code 40015 Error Occurred in Apple Music API "add_a_resource_to_a_library"
When using the Apple Music API add_a_resource_to_a_library with Musickit JS, the following status code 40015 error occurred. {"errors":[{"id":"26-digit-ID","title":"Insufficient Privileges","detail":"User's subscription tier does not have access to privilege: ListeningHistory","status":"400","code":"40015","messageForDisplay":"Insufficient Privileges"}]} This error is not listed in the Response Codes in the API documentation for this endpoint. (1) Are there any details about the cause of this error or other details described anywhere in the API documentation? (2) Are there any other errors that may occur besides this error that are not listed in the documentation for this endpoint?
0
0
782
Jul ’22
MusicKitJS in embedded webview cannot authenticate
When working with embedded web content inside a native app, any calls to MusicKit.authorize will not be properly authenticate. Calling authenticate will open Safari, allow the user to login, then ask for user confirmation, but the window will not navigate back to the native app. Is it expected that developers would have to enable associated domains for the native app?
1
0
956
Jul ’22
MusicKit JS v3 authentication failure
When attempting to authenticate with the musickit-js v3, the page that gets loaded from authorize.music.apple.com results in an error "Cannot parse response" On the desktop, this does not happen. The authentication code in question is async login() { const mkInst = MusicKit.getInstance(); await mkInst.authorize(); } Not sure if this is limited to V3, as it's technically not officially released, but figured it was worth bringing to attention.
3
0
1.4k
Jul ’22
MusicKit v3 previewOnly does nothing
The documentation states that setting this property to true makes the player only play previews, even when authorization is available. I am using it like this: async function playPreview(songId) { const music = window.MusicKit.getInstance(); music.previewOnly = true; await music.setQueue({song: songId, startPlaying: true}); } This still makes the entire song play. I have cross-checked that I am indeed loading MusicKit v3 (MusicKit.version returns '3.2226.3-prerelease'). Is the documentation wrong here, or am I missing something?
1
0
927
Jul ’22
Music Kit JS with Multiple Songs (not in playlist)
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?
6
0
2.0k
Jun ’22
MusicKit JS finding 81 playlists I don't have
Hey All, I am in the middle of developing a little web app using MusicKit JS, and I deleted all my playlists so I could do a little testing. But when I get all library playlists, the query returns 81 phantom playlists. The playlists don't have names in the JSON, so I can't work out their source. It doesn't show any of the playlists I have added and just keeps returning 81 phantom library playlists. When I tested my code using another person's Apple ID, it works perfectly, retuning all the playlists in their library. Is there a way to reset the library or fix this? I am using V1 of the MusicKit library. Thanking everyone in advance. Jacko
1
0
663
Jun ’22
Music Kit JS SeekToTime
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?
2
0
1.5k
Jun ’22
New MusicKit JS release?
Is there any sign of an update to MusicKit JS? The 1.x version still seems to be the only one available despite updates to the iOS and MacOS SDKs. The 1.x version has been fairly unreliable for me and I've paused updates to Apple Music support in my app in hopes that a better version is coming soon.
4
0
1.9k
Jun ’22
Change my App icon and developers name on the app store
Can someone help me how I can change my app icon to another good image. And can someone help me on how I can change the developer name in the app store. Thank you guy.
Replies
1
Boosts
0
Views
1.3k
Activity
Dec ’22
MusicKit Web Components not working
Hi, I noticed in the documentation that v3 supports web components if we pass the data-web-components attr, however this is not the case and no web component is loaded in https://js-cdn.music.apple.com/musickit/v3/musickit.js, should we be using https://js-cdn.music.apple.com/musickit/v3/components/musickit-components/musickit-components.esm.js instead? Thanks
Replies
1
Boosts
1
Views
909
Activity
Nov ’22
High-resolution support for MusicKit.JS
I'm very happy that Apple Music now supports lossless audio. However, the applications we have created using MusicKit and MusicKit JS currently do not seem to play in lossless or high-resolution formats. When will we developers be able to use MusicKit and MusicKit JS to play songs in lossless and hi-res formats?
Replies
4
Boosts
2
Views
4.1k
Activity
Nov ’22
Playing a song from non-zero starting position
Summary I am trying to play a song starting at a non-zero starting position. For example, I would like to play a song starting at 10 seconds instead of at 0 seconds. Approach setQueue play seekToTime let music = window.MusicKit.getInstance(); // 1: setQueue music.setQueue({ song: "validSongID" }) .then(() = { // 2: play music.player.play() .then(() = { // 3: seekToTime const position = 10; music.player.seekToTime(position); }); }); Expected results The song should start playing at 10 seconds. Actual results ~4 out of every 5 times it works as expected. ~1 out of every 5 times I get the following error: Uncaught (in promise) TypeError: Failed to execute 'remove' on 'SourceBuffer': The end value provided (0) must be greater than the start value provided (0). See also the full error log attached: Error log - https://developer.apple.com/forums/content/attachment/e6252199-17b4-4497-8ee9-d8078cabd7c6 Further Impact The error that is being thrown does not create an mediaPlaybackError event, so I can't even handle the error properly in my application logic.
Replies
2
Boosts
0
Views
1.7k
Activity
Nov ’22
Apple Music
hello, I have the latest BETA IOS16 version, I could benefit from the 3-month Apple Music trial offer so I subscribed today and canceled because I had a message telling me that I could take advantage of the offer until January. Except that I no longer have access, do you have a solution or can I benefit from the offer? the goal is to be able to try and potentially subscribe to a definitive package thank!
Replies
2
Boosts
0
Views
903
Activity
Oct ’22
Find Apple song in other storefronts
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?
Replies
0
Boosts
0
Views
994
Activity
Oct ’22
******* Apple Music - API - How Much Support? Right Choice?
Hello all! I have a web app mostly developed in JSON. Can I add Apple Music to it and can I do things like: See what songs are being played and play back the most listened to? Grab lyrics and show them on the screen? We have a communication side - can we listen to a song together during a video call? Is Apple Music the best choice for my application? Thanks all!
Replies
0
Boosts
0
Views
1.2k
Activity
Sep ’22
Can i get user token in my android app without download apple music android app?
I want play whole song frome apple music in my android app ,but the musickit for android tell me ,we should download apple music app.if it has other ways? or use musickit for web api in android app?
Replies
0
Boosts
0
Views
885
Activity
Sep ’22
MusicKit instance seek to time error
I am using apple MusicKit to song streaming based on action per seconds at specific seconds i try to stop the playing music and start the next on on the queue. i alwyas get this error i am sure that i stopped and then try to play and seekToTime. this is my next function : async function next(time) { const music = MusicKit.getInstance(); await music.skipToNextItem(); await music.play(); await music.seekToTime(time); return; } this is it's call in condition : music.stop().then(function () { next(100) });`
Replies
0
Boosts
0
Views
1.2k
Activity
Aug ’22
User Library music not available when considered "now playing"
I have a few reports of users with music purchased outside iTunes/Apple Music not displaying the album artwork when they play it. I was able to reproduce this on my end, but not sure why this would be happening. Is there a setting that needs to be enabled from Apple Music when adding external music? From my end, is there anything I need to when calling setQueue? async playAlbum(album: string, startPosition: number, shuffle = false) { this.toggleShuffle(shuffle); await this.mkInstance.setQueue({ album, startPosition }); await this.play(); } Right now, I just pass the album ID and call that. Should I be doing this differently?
Replies
0
Boosts
0
Views
1.2k
Activity
Jul ’22
Is it possible to get a few seconds of paid music
Is it possible to get a few seconds of paid music through the Apple Music api, so that the users of my app can use it to make commercial videos and save to their albums?
Replies
0
Boosts
0
Views
1.2k
Activity
Jul ’22
User Authorization to your application: Display the app name instead of the domain name?
Hey all - I've noticed that when you launch the login procedure from a custom MusicKit powered app, instead of using the app name (eg. "Apple Music for Vestaboard") it shows the domain name I'm hosting my app at. Is there a way - some META tag or something - to make it use my app name instead?
Replies
1
Boosts
0
Views
1.3k
Activity
Jul ’22
Status Code 40015 Error Occurred in Apple Music API "add_a_resource_to_a_library"
When using the Apple Music API add_a_resource_to_a_library with Musickit JS, the following status code 40015 error occurred. {"errors":[{"id":"26-digit-ID","title":"Insufficient Privileges","detail":"User's subscription tier does not have access to privilege: ListeningHistory","status":"400","code":"40015","messageForDisplay":"Insufficient Privileges"}]} This error is not listed in the Response Codes in the API documentation for this endpoint. (1) Are there any details about the cause of this error or other details described anywhere in the API documentation? (2) Are there any other errors that may occur besides this error that are not listed in the documentation for this endpoint?
Replies
0
Boosts
0
Views
782
Activity
Jul ’22
MusicKitJS in embedded webview cannot authenticate
When working with embedded web content inside a native app, any calls to MusicKit.authorize will not be properly authenticate. Calling authenticate will open Safari, allow the user to login, then ask for user confirmation, but the window will not navigate back to the native app. Is it expected that developers would have to enable associated domains for the native app?
Replies
1
Boosts
0
Views
956
Activity
Jul ’22
MusicKit JS v3 authentication failure
When attempting to authenticate with the musickit-js v3, the page that gets loaded from authorize.music.apple.com results in an error "Cannot parse response" On the desktop, this does not happen. The authentication code in question is async login() { const mkInst = MusicKit.getInstance(); await mkInst.authorize(); } Not sure if this is limited to V3, as it's technically not officially released, but figured it was worth bringing to attention.
Replies
3
Boosts
0
Views
1.4k
Activity
Jul ’22
MusicKit v3 previewOnly does nothing
The documentation states that setting this property to true makes the player only play previews, even when authorization is available. I am using it like this: async function playPreview(songId) { const music = window.MusicKit.getInstance(); music.previewOnly = true; await music.setQueue({song: songId, startPlaying: true}); } This still makes the entire song play. I have cross-checked that I am indeed loading MusicKit v3 (MusicKit.version returns '3.2226.3-prerelease'). Is the documentation wrong here, or am I missing something?
Replies
1
Boosts
0
Views
927
Activity
Jul ’22
Music Kit JS with Multiple Songs (not in playlist)
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?
Replies
6
Boosts
0
Views
2.0k
Activity
Jun ’22
MusicKit JS finding 81 playlists I don't have
Hey All, I am in the middle of developing a little web app using MusicKit JS, and I deleted all my playlists so I could do a little testing. But when I get all library playlists, the query returns 81 phantom playlists. The playlists don't have names in the JSON, so I can't work out their source. It doesn't show any of the playlists I have added and just keeps returning 81 phantom library playlists. When I tested my code using another person's Apple ID, it works perfectly, retuning all the playlists in their library. Is there a way to reset the library or fix this? I am using V1 of the MusicKit library. Thanking everyone in advance. Jacko
Replies
1
Boosts
0
Views
663
Activity
Jun ’22
Music Kit JS SeekToTime
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?
Replies
2
Boosts
0
Views
1.5k
Activity
Jun ’22
New MusicKit JS release?
Is there any sign of an update to MusicKit JS? The 1.x version still seems to be the only one available despite updates to the iOS and MacOS SDKs. The 1.x version has been fairly unreliable for me and I've paused updates to Apple Music support in my app in hopes that a better version is coming soon.
Replies
4
Boosts
0
Views
1.9k
Activity
Jun ’22