3 Replies
      Latest reply on Dec 3, 2019 11:34 AM by benst
      wagenleitner Level 1 Level 1 (0 points)

        Hello guys I am currently working on an iOS App that lets you Listen to Music and I am using the MPMusicPlayerController for playback!

        When setting up the Music Player I also set the shuffleMode but sometimes setting it fails:

        [SDKPlayback] Failed validators: {(
                setShuffleMode
            )}

         

        Now I would not really have a problem with the failure since I can try it again later tough a big problem is that when this error occurs the whole App freezes.

         

        Since I can/ should call functions of the MPMusicPlayerController only on the Main Thread I don't know how to prevent this from happening.

         

        Is there some check I can make before trying to set ShuffleMode or any other ways you can think of, preventing the App from Freezing?

         

        Thanks a lot for your help

        • Re: MPMusicPlayerController, set ShuffleMode, App freezes
          Polyphonic Apple Staff Apple Staff (70 points)

          Could you submit a bug report — ideally with a small sample project that demonstrates the problem — and post the bug number here? That would be a big help in trying to get this narrowed down.

          • Re: MPMusicPlayerController, set ShuffleMode, App freezes
            3no Level 1 Level 1 (0 points)

            I have the same issue with setting shuffleMode, also with setting repeatMode.

             

            The iOS Music app and MPMusicPlayerController seem to share state under the hood. I've discoverd that the UI freeze/delay is repeatable by: [open the Music app, play a song (briefly), stop play, exit the Music app, kill the music app]. This seems to reset the state of the shared player to an uninitialized state. If you now attempt to set shuffleMode or repeatMode in your app you get a UI freeze while the shared player initializes.

             

            OTOH, if you [open the Music app, play a song, stop play], this seems to initialize the state of the shared player so you get no UI freeze when you set repeat or shuffle mode from your app.

             

            Unfortunately, I haven't yet come up with a workaround based on this undeerstanding...

            • Re: MPMusicPlayerController, set ShuffleMode, App freezes
              benst Level 1 Level 1 (0 points)

              I was checking the shuffle mode on a background thread, then setting it to the inverse on the main thread, and I was seeing the problem you've described.

               

              I removed the async closures and the error and freezing have gone away.