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.

Replies

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.