Keep MPMoviePlayerViewController playing when in background

时光总嘲笑我的痴心妄想 提交于 2019-12-13 04:26:50

问题


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.



来源:https://stackoverflow.com/questions/12298195/keep-mpmovieplayerviewcontroller-playing-when-in-background

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!