Music Kit JS Looping Error

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.

Thank you for the question, @gonzosan

Our musickit on the Web documentation was updated recently, including the information you are looking for. Please see the PlayerRepeatMode Enum documentation.

I believe the value you are looking for would be MusicKit.PlayerRepeatMode.all, which should repeat the entire queue after it has been played through completely.

For example:

  await musicKitInstance.setQueue({
    songs: ["726416473", "1099848811"],
    startPlaying: true,
    repeatMode: MusicKit.PlayerRepeatMode.all
  });

If this value for repeatMode is not behaving as expected, please file a ticket in the Feedback Assistant, including code snippets or reductions, .har exports from the network inspector, and any relevant console logs. This will help up prioritize and diagnose the issue, if there are any bugs.

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;
Music Kit JS Looping Error
 
 
Q