MPMoviePlayerViewController playback video after going to background for youtube

非 Y 不嫁゛ 提交于 2019-12-08 14:19:28

What you have discovered there is perfectly normal - weird, but normal. MPMoviePlayerController does only respect the initialPlaybackTime when being used on a fresh instance. I do actually urge you to file a bug-report on that issue as it is known since ages (iOS3) but not fixed.

There is no way to keep the buffer state and the solution you have drafted is pretty much the same that I am using in many apps.


Now directly answering your questions;

re 1) Yes and no. As you have discovered yourself, Apple did get very harsh on the UIBackgroundModes usage. Even though they clearly recommend using it for achieving uninterrupted AirPlay streaming (of video and audio content), they still reject apps when all they do is playing a video. That I also consider an epic failure on Apple's review team side. You might want to try to fight their rejection, quoting their own documentation:

Important: The UIBackgroundModes audio key will allow apps to stream audio or video content in the background using AirPlay.

From : http://developer.apple.com/library/ios/#qa/qa1668/_index.html

re 2) No (see introductional answer text)


Let me also tackle the issue from a different side...

If your problem actually is the fact that on iOS5 the device is going into sleep mode while streaming via AirPlay. Then, there is actually one possible workaround that at least works - even though it is nasty as hell...

You can register for MPMoviePlayerIsAirPlayVideoActiveDidChangeNotification and check the airPlayVideoActive within the hooked method. Once AirPlay is active, just prevent idling by setting [UIApplication sharedApplication].idleTimerDisabled = YES; Remember to do the reverse once AirPlay became inactive. All of this should only be needed on iOS5 as iOS6 fixed the idling issue while AirPlay is active.

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