6

MPMoviePlayerController successfully plays airPlay when I go to the homescreen and app is in the background. But when i double tap the home button, the app crashes. This happens on iOS 5, but not is not on 4.3.

To exclude other code, I've created a new empty project that only executes the code bellow on button press.

moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8"]];

NSError *setCategoryError = nil; 
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: &setCategoryError]; 

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(moviePlaybackComplete:)
                                             name:MPMoviePlayerPlaybackDidFinishNotification
                                           object:moviePlayerController];

[moviePlayerController setMovieSourceType:MPMovieSourceTypeStreaming];
[self addObservers];
[self.delegate addSubview:moviePlayerController.view];
if([moviePlayerController respondsToSelector:@selector(setAllowsAirPlay:)])
{
    [moviePlayerController setAllowsAirPlay:YES];
}

moviePlayerController.fullscreen = YES;

moviePlayerController.scalingMode = MPMovieScalingModeAspectFit;
[moviePlayerController prepareToPlay];
[moviePlayerController play];

In the console i get the following output on crash:

Jan 27 12:08:01 unknown mediaserverd[295] <Error>: <<<< FIGSERVER >>>> FigPlayerRemoteServer_KillAndForceCrashReport: RPCTimeout message received to terminate [295] with reason 'fig rpc timeout -- FigSharedRemote_VolumeCategoryForAudioCategory'
Jan 27 12:08:01 unknown ReportCrash[308] <Notice>: MS:Notice: Installing: (null) [ReportCrash] (675.00)
Jan 27 12:08:01 unknown ReportCrash[308] <Error>: Saved crashreport to /Library/Logs/CrashReporter/mediaserverd-2012-01-27-120801.plist using uid: 0 gid: 0, synthetic_euid: 0 egid: 0
Jan 27 12:08:01 unknown mediaserverd[295] <Error>: <<<< FIGSERVER >>>> FigPlayerRemoteServer_KillAndForceCrashReport: RPCTimeout message received; stackshot generated
Jan 27 12:08:01 unknown mediaserverd[295] <Error>: <<<< FIGSERVER >>>> FigPlayerRemoteServer_KillAndForceCrashReport: TERMINATING our process [295]
Jan 27 12:08:02 unknown com.apple.launchd[1] <Notice>: (com.apple.mediaserverd) Exited: Killed: 9
Jan 27 12:08:02 unknown mediaserverd[310] <Notice>: MS:Notice: Installing: com.apple.mediaserverd [mediaserverd] (675.00)
Jan 27 12:08:02 unknown kernel[0] <Debug>: Sandbox: ignoring builtin profile for platform app: /usr/sbin/mediaserverd
Jan 27 12:08:02 unknown kernel[0] <Debug>: Sandbox: ignoring builtin profile for platform app: /usr/sbin/mediaserverd
Jan 27 12:08:03 unknown mediaserverd[310] <Error>: 12:08:03.383370 com.apple.AVConference: /SourceCache/GameKitServices/GameKitServices-344.3/AVConference.subproj/Sources/AVConferenceServer.m:1862: AVConferenceServerStart aborting - device doesn't support conferencing

and in the crashreport:

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread:  0

Last Exception Backtrace:
0   CoreFoundation                  0x33bab8bf 0x33af2000 + 759999
1   libobjc.A.dylib                 0x31bcd1e5 0x31bc4000 + 37349
2   AVFoundation                    0x374f6cb5 -[AVPlayerItem _attachToPlayer:forImmediateEnqueueing:shouldAppendItem:] + 341
3   AVFoundation                    0x374e71f7 -[AVPlayer _insertPlaybackItemOfItem:inPlayerQueueAfterPlaybackItemOfItem:] + 43
4   AVFoundation                    0x374eebf3 __-[AVPlayer _attachItem:andPerformOperation:withObject:]_block_invoke_2 + 1099
5   libdispatch.dylib               0x3641cd55 0x3641c000 + 3413
6   libdispatch.dylib               0x36427e8d 0x3641c000 + 48781
7   CoreFoundation                  0x33b7e2dd 0x33af2000 + 574173
8   CoreFoundation                  0x33b014dd 0x33af2000 + 62685
9   CoreFoundation                  0x33b013a5 0x33af2000 + 62373
10  GraphicsServices                0x31f56fcd 0x31f53000 + 16333
11  UIKit                           0x36d57743 0x36d26000 + 202563
12  AirplayTest                     0x00002e45 main (main.m:16)
13  AirplayTest                     0x00002dd4 start + 40

Any clues what could be wrong?

Olof
  • 5,348
  • 4
  • 25
  • 27
  • I had the very same problem. It didn't happen every time, usually if I launched other apps in the meantime. I assumed it was caused by MPMoviePlayerController's view's parent view being unloaded incorrectly when the device needed more resources – reddersky Feb 03 '12 at 18:19
  • Do you have any code running when it enters background? – Bot Feb 21 '12 at 17:21
  • Also having this crash, did you fixed it ? – ıɾuǝʞ Sep 03 '12 at 12:55
  • Please provide the ans so it will be useful for everyone – Cyril Oct 09 '12 at 03:57
  • I got this error while working on a project for a client. I believe that the problem disappeared with iOS release 5.1, but I haven´t got a confirmation on that. Do you have the problem on iOS 5.1? – Olof Oct 09 '12 at 07:37
  • Hi sorry for the late reply. I guess what you are saying is right. May be some problem with the ios. I have got my application crash in iOS 5.0.1. In iOS 5.0.1, I found many crash reports – Cyril Oct 30 '12 at 10:19
  • 1
    But in my iPad I am not able to see single crash report for the particular application. This iPad got 5.1 version before . Now I have updated the version to iOS 6.0. – Cyril Oct 30 '12 at 10:20
  • Thank you man. Please update your answer if you have fixed the issue – Cyril Oct 30 '12 at 10:20

2 Answers2

0

This seems to be a bug within iOS release 5.0. With the release of iOS 5.1 it seems to have been fixed.

Thanks to @Cyril for confirmation on this.

Olof
  • 5,348
  • 4
  • 25
  • 27
0

Have you tried setting the useApplicationAudioSession property of your movie player controller to NO (i.e. to simulate iOS 3.1 default behaviour) for iOS 5 only? There seem to be some bugs around the audio session handling in iOS 5 that can cause the audio server to die when you switch between apps, handle interruptions etc.

If this fixes it, please submit a bug report to Apple, as it's more of a hack than a fix!

Simon Lawrence
  • 564
  • 2
  • 8