Posts

Post not yet marked as solved
5 Replies
919 Views
When using the applicationQueuePlayer perform(queueTransaction:completionHandler:) method, it takes multiple seconds to iterate over the items of either the MPMusicPlayerControllerMutableQueue or the MPMusicPlayerControllerQueue. While the iteration happens, the app is frozen (as this is done on the main thread) and I get the following error in console: ASYNC-WATCHDOG-1: Attempting to wake up the remote process I am dealing with a queue of a few hundred, but I don't believe the issue is with the number of MPMediaItems as when I get a similar number of items from e.g. MPMediaPlaylist, iterations happen instantly. Here is a simplified version of my code: var musicPlayerController = MPMusicPlayerController.applicationQueuePlayer self.musicPlayerController.perform { (currentQueue) in     return } completionHandler: { (newQueue, error) in     if let e = error {         print(e)     } else {         let items = newQueue.items         print("Starting iteration")         let tracks = items.map { Track(item: $0) }         print("Ending iteration")     } } In the console, I'll see "Starting iteration" printed in the console straight away as the method is called. And then I'll see "Ending iteration" multiple seconds later, during which the app is frozen. This method is called anytime the .MPMusicPlayerControllerQueueDidChange notification is posted.
Posted Last updated
.