当进入后台时暂停播放器并在应用返回前景ios时恢复

时间:2014-09-30 08:17:12

标签: ios mpmovieplayercontroller

在iOs应用中播放视频时,我需要它在应用程序发送到后台时暂停,并在应用程序从后台返回时恢复。

- (void)onApplicationDidBecomeActive:(NSNotification *)notif
{
    NSLog(@"player: app did become active...");
    [self.videoPlayer play];
}
- (void)onApplicationDidEnterBackground:(NSNotification *)notif
{
    NSLog(@"player: app did enter background...");
    [self.videoPlayer pause];
    [self.videoPlayer setFullscreen:NO];

}

在iOS7上,这可以正常运行但io iOs8似乎在当前的一个播放器下面创建了另一个播放器。 (self.videoPlayer是一个MPMoviePlayerController)

这是为什么?

0 个答案:

没有答案