在AVPlayerViewController中播放视频时,单击“主页”按钮时如何停止关闭iOS应用

时间:2019-05-08 07:00:48

标签: ios avplayer uiapplicationdelegate uiapplication avplayerviewcontroller

在您的应用程序中,我正在播放一个视频,并且如果用户不单击HomeButton应用程序,则应尽量减少播放该视频。是否有任何方法可以实现此目的,并且会为APP批准带来任何问题吗?

我尝试在applicationWillResignActive方法中使应用程序处于活动状态。

- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.

//    //home button press programmatically
    UIApplication *app = [UIApplication sharedApplication];
    [app performSelector:@selector(active)];

}

在AvPlayerViewController中播放视频时,单击“主页”按钮时,应用程序不应关闭。

0 个答案:

没有答案