iOS Control Center doesn't work properly when using MPMusicPlayerController.applicationMusicPlayer()
Originator: | rob | ||
Number: | rdar://29313386 | Date Originated: | 17-Nov-2016 10:14 AM |
Status: | Open | Resolved: | |
Product: | iOS SDK | Product Version: | 10.1.1 |
Classification: | Serious Bug | Reproducible: | Always |
Summary: When playing music with MPMusicPlayerController.applicationMusicPlayer(), opening the Control Center displays the correct track info (title, artist, album, album artwork, playback position, and remaining playback time) but using the playback controls does not work as expected. Steps to Reproduce: 1. Configure the MPMusicPlayerController.applicationMusicPlayer() and start song playback. Sample code in the context of a view controller: override func viewDidLoad() { super.viewDidLoad() MPMediaLibrary.requestAuthorization { (status) in switch status { case .authorized: let musicPlayerController: MPMusicPlayerController = MPMusicPlayerController.applicationMusicPlayer() musicPlayerController.setQueue(with: MPMediaQuery.songs()) NSLog("About to call prepareToPlay") musicPlayerController.prepareToPlay(completionHandler: { (error) in guard error == nil else { let alert = UIAlertController(title: "Error", message: "Error preparing to play. \(error!.localizedDescription)", preferredStyle: .alert) alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) self.present(alert, animated: true, completion: nil) return } NSLog("Ready to play") musicPlayerController.play() }) case .denied, .notDetermined, .restricted: let alert = UIAlertController(title: "Access Denied", message: "You need to allow access to the media library.", preferredStyle: .alert) alert.addAction(UIAlertAction(title: "Settings", style: .default, handler: { (action) in UIApplication.shared.open(URL(string:UIApplicationOpenSettingsURLString)!) })) self.present(alert, animated: true, completion: nil) } } } 2. Swipe from bottom to open control center 3. Push the pause button Expected Results: The MPMusicPlayerController.applicationMusicPlayer() should pause the currently playing song. Actual Results: The song continues to play and the track info displayed in control center changes to a different song. There are also problems with the other controls: skip back, skip forward. There is also a problem when tapping the album artwork after step 2. It will stop the playing music and open the system Music app. Regression: These issues exist on iOS 10.1.1. Notes: Remote control commands (e.g. headphone remote) also have similar problems when using MPMusicPlayerController.applicationMusicPlayer()
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!