问题
I use MPMoviePlayerViewController to play some videos form the internet.
When the user presses home button and the app goes in background, the iphone still downloads a lot of information.
Can anyone recomend me how the trafic can be stopped, without disabling multitasking or calling exit(0)?
I have tried to stop the MPMoviePlayerViewController, but in some cases, when the MPMoviePlayerViewController is not fully loaded, the it doesn't respond(not the video, the MPMoviePlayerViewController).
Thanks in Advance!
回答1:
I think you should use the below delegate methods
(void)applicationDidBecomeActive:(UIApplication *)application; (void)applicationWillResignActive:(UIApplication *)application;
(void)applicationDidEnterBackground:(UIApplication *)application (void)applicationWillEnterForeground:(UIApplication *)application
回答2:
[movieplayer stop];
movieplayer.initialPlaybackTime = -1.0;
[movieplayer release];
you can use this code in applicationDidEnterBackground
- (void)applicationDidEnterBackground:(UIApplication *)application {
}
来源:https://stackoverflow.com/questions/6042089/how-to-stop-mpmovieplayerviewcontroller-from-downloading-video-if-the-app-is-in