30 Replies
      Latest reply on Oct 23, 2018 6:23 PM by gumbright
      ross.woodhams Level 1 Level 1 (0 points)

        Apple music does not work on iOS 11.3 Beta. It was working on iOS 11.2.5 though.

         

        I am playing Apple music in my application using two ways using setQueueWithMPMediaItemCollection and setQueueWithStoreIds. First one is working fine but second method is not working at all and there is no error occurrs but music is not playing.

         

        // Code snippet

        let appleMusicPlayer : MPMusicPlayerController = MPMusicPlayerController.applicationMusicPlayer()

        // Method 1

        self.appleMusicPlayer.setQueue(with: MPMediaItemCollection(items:[appleMediaItem]))

        // Method 2

        self.appleMusicPlayer.setQueueWithStoreIDs([trackId])

         

         

        any help will be highly appreciated.

        • Re: MPMusicPlayerController does not work on iOS 11.3 Beta
          davenorfleet Level 1 Level 1 (10 points)

          Several MPMusicPlayer issues are fixed in iOS 11.3 Beta 2. But in order to see the fixes, I had to use the corresponding xcode beta. Apps compiled with Xcode GM still exhibit strange behavior when running on iOS 11.3 Beta 2.

            • Re: MPMusicPlayerController does not work on iOS 11.3 Beta
              GKid86 Level 1 Level 1 (0 points)

              I too am having problems with iOS 11.3 even when using Beta 2 and the corresponding xcode beta.

               

              My problem is that the audio will begin playing as soon as prepareToPlay is called. Consider the code below:

               

                spinner.startAnimating()
                appMusicPlayer.prepareToPlay(completionHandler: {[weak self] (error) in
                    self?.appMusicPlayer.currentPlaybackTime = ct
                    DispatchQueue.main.async { [weak self] in
                          self?.spinner.stopAnimating()
              
                          if error != nil {
                              self?.goIdle()
                              let alertController = UIAlertController(title: "Problem Playing Apple Music", message:
                                    "Check network connection and try again.  " + error!.localizedDescription, preferredStyle: UIAlertControllerStyle.alert)
                              alertController.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default,handler: nil))
                              self?.present(alertController, animated: true, completion: nil)
                          } else {
                              self?.conditionallyBeginFadeIn()
                              self?.appMusicPlayer.play()
                              self?.playbackStartTime = (self?.appMusicPlayer.currentPlaybackTime)!
                              self?.playbackStartDate = Date()
                          }
                    }
                })
              
              

               

              Normally (like with iOS 11.2 and prior) the audio playback doesn't begin until the call to "appMusicPlayer.play()" in the completion handler.  But with iOS 11.3 Beta 2, it will begin as soon as prepareToPlay is called.

               

              I'm also noticing inconsistent problems getting and setting "currentPlaybackTime" as well.

                • Re: MPMusicPlayerController does not work on iOS 11.3 Beta
                  davenorfleet Level 1 Level 1 (10 points)

                  I'm seeing the same with iOS 11.3 beta 3. They've come so far with the MPMusicPlayer issues! Just a few remaninig. I've submitted bug report 37786167 for the issue with autoplay on .prepareToPlay().

                   

                  If you can narrow down the issue with currentPlaybackTIme or second my bug report on prepareToPlay(), it's always good to have more voices who can clearly demonstrate the bugs.

                    • Re: MPMusicPlayerController does not work on iOS 11.3 Beta
                      GKid86 Level 1 Level 1 (0 points)

                      Sorry, I just saw your reply today (I wasn't notified earlier and I just happened to check back here today).

                       

                      I submitted a bug report (my first one so I hope I did everything correctly) on the issue with prepareToPlay so hopefully that will provide one more voice.

                       

                      The problem with currentPlaybackTime has been hard for me to reproduce consistently.  In practice, when things are working properly, I set the currentPlaybackTime to where I want playback to begin and it works fine.  With 11.3 Beta 3, it will sometimes work and sometimes not work.  I haven't been able to narrow it down.  Since it seems logical to think that this might be related to problems with playback preparation, I thought I'd see if the fix to prepareToPlay would also address this inconsistent issue.

                        • Re: MPMusicPlayerController does not work on iOS 11.3 Beta
                          Ynot Level 1 Level 1 (0 points)

                          We also have been having several issues with 11.3 beta.  We have determined that the first time we start our app (after a power on) we have several issues with missing media player notifications, getting currentPlaybackTime, etc.  However if we terminate our app and then start it up again many of these issues are gone.  Or if we start the Apple Music App (and play some music)  before starting our app after a power up, many of the issues are also gone. 

                           

                          I've submitted a bug report with logs but have not had any feedback yet.

                           

                          This could be leading to your inconsistant results.  Would be interested in your results after trying this.

                  • Re: MPMusicPlayerController does not work on iOS 11.3 Beta
                    stain Level 1 Level 1 (0 points)

                    Having the same Problem with MPMoviePlayerController, since 11.3 Beta 4

                     

                    Getting MPMovieFinishReasonPlaybackError, Error Code 3 immediately at start.

                    • Re: MPMusicPlayerController does not work on iOS 11.3 Beta
                      davenorfleet Level 1 Level 1 (10 points)

                      In iOS 11.3 beta 5 15E5211a, I'm still seeing both issues:

                      1) prepareToPlay causes autoplay and (bug #37786167)

                      2) currentPlaybackrate is ignored when setting on active MPMusicPlayer (bug #38126022)

                       

                      If anyone else has active bug reports on these or other MPMusicPlayer, please update with the latest beta build info.

                       

                      @ ross.woodhams - regarding your original post, the documentation for both setQueue & setQueueWithStoreIDs say that prepareToPlay has to be called after setting the queue. That in turn causes the audio to play. Are you still having the original issue of no tracks playing at all?

                      • Re: MPMusicPlayerController does not work on iOS 11.3 Beta
                        teststation5 Level 1 Level 1 (0 points)

                        As of the public release of 11.3, the prepareToPlay still starts playing immediately and the setCurrentTime works very inconsistantly.   Working on workarounds right now, but there will be some very unhappy folks using my production app when they upgrade to 11.3.

                        • Re: MPMusicPlayerController does not work on iOS 11.3 Beta
                          hoon_keelo Level 1 Level 1 (0 points)
                              appleMediaResults = AppleMusicHelper.getMediaQueryFor(musicCollectionSpecificItem: music).collections
                              if let media = appleMediaResults {
                                  appleMusicPlayer.setQueue(with: media[0])
                                  appleMusicPlayer.beginGeneratingPlaybackNotifications()
                                  NotificationCenter.default.addObserver(self, selector: #selector(appleNowPlayingChanged), name: NSNotification.Name.MPMusicPlayerControllerNowPlayingItemDidChange, object: nil)
                                  if #available(iOS 10.1, *) {
                                      appleMusicPlayer.prepareToPlay { error in
                                          if let error = error {
                                              print("Apple Music Player Error: \(error.localizedDescription)")
                                              return
                                          }
                                          self.appleMusicPlayer.shuffleMode = Settings.musicShuffleOn ? .songs : .off
                                          self.appleMusicPlayer.repeatMode = .all
                                          self.appleMusicPlayer.play()
                                      }
                                  }
                              }
                          
                          
                          

                           

                          After some trial and error, the above seems to work.  Unfortunately, it only works for iOS 10.1 or newer versions because of the `prepareToPlay` callback function.

                          • Re: MPMusicPlayerController does not work on iOS 11.3 Beta
                            davenorfleet Level 1 Level 1 (10 points)


                            With iOS 11.3 general release, are others still seeing:?

                            1) prepareToPlay causes autoplay and (bug #37786167)

                            2) currentPlaybackrate is ignored when setting on active MPMusicPlayer (bug #38126022)

                             

                            If so, please submit bug reports.

                              • Re: MPMusicPlayerController does not work on iOS 11.3 Beta
                                GKid86 Level 1 Level 1 (0 points)

                                I am still seeing the same problems with "prepareToPlay" and "currentPlaybackrate" that you mentioned above.  I also do have an app on the app store that is being impacted by this bug (at least for those that have updated to 11.3). 

                                 

                                I did submit a bug report back in the beginning of March but have never gotten any response.  Is that to be expected?  Does anyone ever get any responses from Apple on bug reports?  Should I just submit them again with each new Beta or release?  Also, I noticed that you referenced your bug report numbers.  It's not like I can see them or "comment" on them so are you sharing them so that I would I reference them in my bug report?  If so, where in the report should I include them (like what section)?

                                 

                                By the way, I've verified that it's still not fixed in 11.4 beta 1, but I just saw that 11.4 beta 2 was released yesterday so I'll test it on that shortly.

                                  • Re: MPMusicPlayerController does not work on iOS 11.3 Beta
                                    davenorfleet Level 1 Level 1 (10 points)

                                    I've tested on iOS 11.4 beta 2 and still see these issues:

                                    • MPMusicPlayer autoplays when calling prepareToPlay (bug#37786167)
                                    • No action when setting currentPlaybackRate (bug#38126022)
                                    • nowPlayingItem reported is not the actual currently playing track (bug#39412140)

                                     

                                    Even though we can't see each other's bug reports, I've been told that it could be helpful in case the Apple folks are trying to match issues reported here with those submitted via the bug report system.

                                     

                                    I have no insider knowledge on how/when the bug reports get reviewed or prioritized. For my own satisfaction, I imagine that a whole team of Apple pros read, reread & discuss every word I type here or in a bug report. It's possible that it doesn't really happen that way.

                                     

                                    I've posted this position before: I hope you'll submit the bug report. Sometimes it seems no one is working on the issue. But I'm sure there are many moving parts, with most outside my field of observation. And even though I don't understand how Santa gets down the chimney with presents, I still write my wish list ;-) So file that bug report and let's keep our hopes high!

                                      • Re: MPMusicPlayerController does not work on iOS 11.3 Beta
                                        GKid86 Level 1 Level 1 (0 points)

                                        FYI, my prepareToPlay bug reports were all marked as duplicates today, so at least there's confirmation that they're being looked at?

                                         

                                        Also, I was spending a little more time yesterday looking into work-arounds and found that my problems with setting "currentPlaybackTime" only occurred after calling the "setQueue" method.  A normal sequence of calls for me would be:

                                        1. Call "setQueue"
                                        2. Call "prepareToPlay"
                                        3. In the completion handler (among other things) set "currentPlaybackTime"
                                        4. Call "play"

                                        If I don't set the queue each time before "prepareToPlay" is called, previous versions would throw an error.  So if I were to pause playback and attempt to resume, in previous versions it would be acceptable to re-set the queue, call "prepareToPlay" and set the currentPlaybackTime to where playback was stopped and begin playback. 

                                         

                                        Now, with 11.3 and 11.4, setting currentPlaybackTime in this scenario often has no effect and playback will start at the beginning of the song.  If I change it to set the queue only once (like when the selection changes) prepareToPlay will not throw and error and setting currentPlaybackTime will work. Playback will start at the moment that the completion handler is called (which is wrong), but it still gives me a chance to stop spinners and start counters, etc. 

                                         

                                        It's not perfect but it provides a solution to those using my app with version 11.3 that was released with this bug.

                                        • Re: MPMusicPlayerController does not work on iOS 11.3 Beta
                                          davenorfleet Level 1 Level 1 (10 points)

                                          These bugs still present in iOS 11.4 beta 3 (sigh)

                                          • MPMusicPlayer autoplays when calling prepareToPlay (bug#37786167)
                                          • No action when setting currentPlaybackRate (bug#38126022)
                                          • nowPlayingItem reported is not the actual currently playing track (bug#39412140)
                                      • Re: MPMusicPlayerController does not work on iOS 11.3 Beta
                                        gumbright Level 1 Level 1 (0 points)

                                        Yes, seeing the problems with 11.3.  Went through problems with 11.1, which required 11.2 to fix.  My app was out if the store for months because of it and I cannot believe that I have to go through this again.  I had 4 radars open about different facets of the problems.  I have better things to spend my time on than making bug demo app for Apple.

                                         

                                        Apple, get your act together on the media player.

                                      • Re: MPMusicPlayerController does not work on iOS 11.3 Beta
                                        davenorfleet Level 1 Level 1 (10 points)

                                        These bugs still present in iOS 11.4 beta 5

                                        • MPMusicPlayer autoplays when calling prepareToPlay (bug#37786167) (has been identified as duplicated)
                                        • No action when setting currentPlaybackRate (bug#38126022)
                                        • nowPlayingItem reported is not the actual currently playing track (bug#39412140)