MPMusicPlayerController's nowPlayingItem has playbackDuration 0

Originator:jay.whitsitt
Number:rdar://30155420 Date Originated:23-Jan-2017
Status:Open Resolved:
Product:iOS + SDK Product Version:
Classification:Other bug Reproducible:Sometimes
 
Area:
Music

Summary:
Sometimes, in the method observing the MPMusicPlayerControllerNowPlayingItemDidChangeNotification notification, when requesting nowPlayingItem.playbackDuration from an active instance of MPMusicPlayerController, the value is zero even if nowPlayingItem is non-nil. This seems to happen only when the nowPlayingItem object is an MPModelObjectMediaItem rather than MPConcreteMediaItem.

As a workaround, waiting an extra second, then requesting playbackDuration again returns the correct playbackDuration.

This is not reproducible all the time. It seems to be reproducible more often for songs that you have not yet played.

Steps to Reproduce:
1. self.playerController = [MPMusicPlayerController systemMusicPlayer];
2. [self.playerController setQueueWithStoreIDs:@[trackId]];
3. [self.playerController play];

Expected Results:
In the method receiving MPMusicPlayerControllerNowPlayingItemDidChangeNotification:
self.playerController.nowPlayingItem.playbackDuration returns correct float value

Actual Results:
In the method receiving MPMusicPlayerControllerNowPlayingItemDidChangeNotification:
self.playerController.nowPlayingItem.playbackDuration is sometimes 0 even if self.playerController.nowPlayingItem is non-nil

Version:
iPhone 6 Plus running 10.2
iPhone 7 Plus running 10.1
iPhone 6 running 9.3.5

Notes:


Configuration:
Debug or release build, Sierra, Xcode 8.2.1

Attachments:

Comments

Jay Whitsitt 23-Jan-2017 08:39 PM

In my scenario, I'm specifically using systemMusicPlayer. I have not tested this with applicationMusicPlayer.

By jay.whitsitt at Jan. 24, 2017, 2:39 a.m. (reply...)

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!