开发者

how to stop MPMoviePlayerViewController from downloading video if the app is in background

开发者 https://www.devze.com 2023-03-06 12:58 出处:网络
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.

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 h开发者_如何学编程ave 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!


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


[movieplayer stop];  
movieplayer.initialPlaybackTime = -1.0;  
[movieplayer release];   

you can use this code in applicationDidEnterBackground

- (void)applicationDidEnterBackground:(UIApplication *)application {  
}  
0

精彩评论

暂无评论...
验证码 换一张
取 消