MPMoviePlayerController crasher regression in iOS 8.4 beta 2

Originator:cedric.luthi
Number:rdar://20762442 Date Originated:30-Apr-2015 02:56 PM
Status:Open Resolved:
Product:iOS SDK Product Version:8.4 (12H4086d)
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
Using a MPMoviePlayerController, it is possible to change the currently playing movie by changing its `contentURL` property. Changing the URL then playing the movie should work fine. This behavior is broken in the latest iOS 8.4 beta.

Steps to Reproduce:
1. Run the attached sample project (KVO externalPlaybackActive crash)
2. Tap the "Play Basic Stream" button
3. Tap the "Play Advanced Stream" button
4. Observer the app crashing

Expected Results:
There should be no crash and the app should play the advanced stream.

Actual Results:
The app crashes with the following exception:
*** Terminating app due to uncaught exception 'NSRangeException', reason: 'Cannot remove an observer <MPAVController 0x146503c70> for the key path "externalPlaybackActive" from <MPQueuePlayer 0x170106390> because it is not registered as an observer.'

Version:
iOS 8.4 (12H4086d)

Notes:
Changing the content URL of a movie player controller worked fine since iOS 2.0. This regression was introduced in iOS 8.4. The sample project works fine on iOS 8.3 and earlier.

Configuration:
iPad Air 64GB A1474

Note to Open Radar users:
The "KVO externalPlaybackActive crash" sample project is available at https://github.com/0xced/radars/tree/master/KVO%20externalPlaybackActive%20crash

Comments

Cédric Luthi

This crash is not fixed in iOS 8.4 beta 3 (Build: 12H4098c).

By cedric.luthi at May 12, 2015, 7:47 a.m. (reply...)

Apple Developer Relations

Please verify this issue with iOS 8.4 beta 3 (Build: 12H4098c) and update your bug report at http://bugreport.apple.com/ with your results.

iOS 8.4 beta 3 (Build: 12H4098c) https://developer.apple.com/devcenter/ios/index.action Posted: May 11, 2015

If this issue still occurs, please update your bug report with relevant logs.

Logging Instructions/Test Case Requirements: https://developer.apple.com/bug-reporting/ios/

By cedric.luthi at May 12, 2015, 7:45 a.m. (reply...)

Easy workaround

It turns out there is a pretty easy workaround: just call the stop method before changing the content URL.

See https://github.com/0xced/radars/blob/6c36f5a76ce856d152df6d6ace13411a662cef21/KVO%20externalPlaybackActive%20crash/KVO%20externalPlaybackActive%20crash/ViewController.m#L37-L40

By cedric.luthi at April 30, 2015, 6:04 p.m. (reply...)

Still reproducible with suggested workaround

Even calling to stop before changing contentURL does not help. But really after mentioned workaround it is reproducible rarely.

I could fix it by executing play asynchronously

playerController.contentURL = URL

dispatch_async(dispatch_get_main_queue()) {

playerController.play()

}

By igor.palaguta at July 2, 2015, 12:38 p.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!