Keep MPMoviePlayerViewController playing when in b

2019-08-20 16:33发布

问题:

I use MPMoviePlayerViewController to playback videos in my iOS app on iPhone4 (iOS5.1), new iPad (iOS5.1), iPad (iOS4.2).

I press home button twice when playing a video, the multitask dock shows and player pauses.

I have tried to call player's play method in appDelegate applicationWillResignActive,but it didn't work.

Does anyone know how to do to avoid player pause ?

Another question, how to show video's title on remote control panel? (swipe multitask dock to leftmost).

Thanks.

回答1:

I don't think you shouldn't continue playing the video. According to Apple App Programming Guide, you are supposed to pause visual activity in the application when that happens. I am not 100% sure if the App Store submission will accept that behavior.

You can show the video title by providing metadata to the MPNowPlayingInfoCenter:

See Here

As written there:

The system displays now-playing information on the device lock screen and in the multimedia controls in the multitasking UI.