I'm revisiting this as I'm not able to get looping or "repeating" to work at all using the method shown in the reply above or in the documentation. I used a simple HTML page as an example to keep it as simple as possible. Here is my code:
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://js-cdn.music.apple.com/musickit/v1/musickit.js"></script>
<title>Apple Music Example</title>
</head>
<body>
<script>
const loadMusicKit = async () => {
console.log("loading music kit");
await MusicKit.configure({
developerToken: "",
app: {
name: "Apple Music Example",
build: "1.0",
},
});
const music = MusicKit.getInstance();
await music.setQueue({
songs: [1604978510],
repeatMode: MusicKit.PlayerRepeatMode.all,
});
await music.play();
};
</script>
<button onclick="loadMusicKit()">play</button>
</body>
</html>
As you can see I added the repeatMode. Everytime I add this in I get this error:
After much frustration, I finally found a way that seems to work for anyone encountering this issue as well. I had to go through the music kit instance player and set the repeat mode there to 1 as such:
music.player.repeatMode = 1;
Post
Replies
Boosts
Views
Activity
Is there a way for me to verify which storefronts a track is available in through an API? With the application, I'm building I search for tracks based on ISRC. Initially, I'm able to find these tracks just fine, but when I go to play them using the Player I will randomly encounter one of these tracks that are not available and get a popup. What are my options for this? If I could verify these tracks are not available in certain countries that would help alleviate this issue. These tracks would be played worldwide so I need a way to verify that tracks can be played before they get to the streaming aspect.