MPMediaPlayback.currentPlaybackRate no longer working in iOS 15.4?

Just wondering if anyone else is having issues with currentPlaybackRate in release version of iOS 15.4? In my particular case this is using MPMusicPlayerController.applicationQueuePlayer.

I've always had issues controlling this property reliably but from what I can see it is now completely non-operational in 15.4.

I've isolated this behavior in a trivial project, and will file a radar, but hoping others may have some insight first.

FWIW- This is my trivial test case:

class ViewController: UIViewController {
    lazy var player: MPMusicPlayerApplicationController = {
        let player = MPMusicPlayerController.applicationQueuePlayer
        player.repeatMode = .none
        player.shuffleMode = .off
        player.beginGeneratingPlaybackNotifications()
        return player
    }()

    override func viewDidLoad() {
        super.viewDidLoad()

        NotificationCenter.default.addObserver(forName: .MPMusicPlayerControllerPlaybackStateDidChange, object: nil, queue: .main) { [weak self] notification in
            guard let notificationPlayer = notification.object as? MPMusicPlayerApplicationController,
                  notificationPlayer === self?.player else {
                return
            }
            
            debugPrint("Player state now: \(notificationPlayer.playbackState)")
        }
    }

    @IBAction func goAction(_ sender: Any) {
        guard let item = MPMediaQuery.songs().items?.randomElement() else {
            debugPrint("Unable to access media items")
            return
        }

        debugPrint("Now playing item: \(item.title ?? "")")
        player.setQueue(with: [item.playbackStoreID])

        player.prepareToPlay() { error in
            guard error == nil else {
                debugPrint("Player error: \(error!.localizedDescription)")
                return
            }

            DispatchQueue.main.async { [weak self] in
                self?.player.play()
            }
        }
    }

    @IBAction func slowAction(_ sender: Any) {
        debugPrint("Setting currentPlaybackRate to 0.5")
        player.currentPlaybackRate = 0.5
        checkPlaybackRate()
    }

    @IBAction func fastAction(_ sender: Any) {
        debugPrint("Setting currentPlaybackRate to 1.5")
        player.currentPlaybackRate = 1.5
        checkPlaybackRate()
    }

    func checkPlaybackRate(afterSeconds delay: TimeInterval = 1.0) {
        DispatchQueue.main.asyncAfter(deadline: .now() + delay) {
            debugPrint("After \(delay) seconds currentPlaybackRate now: \(self.player.currentPlaybackRate)")
        }
    }
}

Typical console output:

"Now playing item: I Know You Know"
"Player state now: MPMusicPlaybackState(rawValue: 2)"
"Player state now: MPMusicPlaybackState(rawValue: 1)"
"Setting currentPlaybackRate to 1.5"
"After 1.0 seconds currentPlaybackRate now: 1.0"
"Setting currentPlaybackRate to 0.5"
"After 1.0 seconds currentPlaybackRate now: 1.0"

I can also confirm that setting the currentPlaybackRate doesn't work on iOS 16.1 beta 1.

Please, we don't want a repeat of the horrible time we had six months ago, our users were crazy.

FWIW, my feedback was resolved with "potential fix identified for an upcoming OS release." Hopefully that means a subsequent 16.1 beta and not 16.2.

I've tried 16.1 beta 3 and unfortunately the bug is still there. @JoeKun any news on this problem?

Hi all, beta 4 fixed it! Nicolas

Hello @nickfromsf, @florom, @umbertoide, @xalio,

Thank you all for bringing attention to this issue.

Indeed, we accidentally regressed the functionality of the currentPlaybackRate property for playback of Apple Music content in earlier beta builds of iOS 16.1.

As @xalio pointed out, we fixed that up in the latest beta build of iOS 16.1, which is beta 4 for iPhone (build number 20B5064c).

I hope this helps.

Best regards,

Hey @JoeKun,

I'm on iOS 16.4 and assigning to ApplicationMusicPlayer.state.playbackRate doesnt seem to make any change to the playback rate... I guess it's a bug, right?

Hello @Czajniks,

I don't know yet.

Would you mind filing a new ticket on Feedback Assistant to track the issue you're encountering? Please make sure to include a sysdiagnose and an approximate timestamp of when your app exercised this code path that lead to changing the ApplicationMusicPlayer.state.playbackRate.

Thank you very much in advance.

Best regards,

MPSystemMusicPlayerController.currentPlaybackRate = <someRate> broken (causes hang) still when starting playback. iOS 16.4.1(a). :(

Hello @haarj,

I'm sorry to hear that. Please file a new ticket on Feedback Assistant and make sure to attach a sysdiagnose taken shortly after reproducing this issue. Please also make sure to mention the time when this issue occurred.

Please refer to this document for more information on how to capture a sysdiagnose.

Thank you very much in advance for your help.

Best regards,

MPMediaPlayback.currentPlaybackRate no longer working in iOS 15.4?
 
 
Q