开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜