how to stop MPMoviePlayerViewController from downl

2019-06-11 10:13发布

问题:

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 {  
}