[vlc-devel] [PATCH 4/4] Prevent media player from sleep #7656

Gleb Pinigin gpinigin at gmail.com
Fri Jan 25 13:39:58 CET 2013


---
 Classes/MVLCMovieViewController.m |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/Classes/MVLCMovieViewController.m b/Classes/MVLCMovieViewController.m
index 4078434..f7709f6 100644
--- a/Classes/MVLCMovieViewController.m
+++ b/Classes/MVLCMovieViewController.m
@@ -238,6 +238,9 @@ static NSString * MVLCMovieViewControllerHUDFadeOutAnimation = @"MVLCMovieViewCo
     if (state == VLCMediaPlayerStateOpening) {
         MVLCLog(@"opening");
     }
+    if (state == VLCMediaPlayerStatePlaying) {
+        MVLCLog(@"input playing");
+    }
 
     UIImage *playPauseImage = nil;
     if (state == VLCMediaPlayerStatePaused) {
@@ -254,13 +257,11 @@ static NSString * MVLCMovieViewControllerHUDFadeOutAnimation = @"MVLCMovieViewCo
             playPauseImage = [UIImage imageNamed:@"MVLCMovieViewHUDPause_iPhone.png"];
         }
     }
-
-    if (state == VLCMediaPlayerStatePlaying) {
-        MVLCLog(@"input playing");
-        [UIApplication sharedApplication].idleTimerDisabled = YES;
-    } else {
-        [UIApplication sharedApplication].idleTimerDisabled = NO;
-    }
+    
+    BOOL isActive = (state == VLCMediaPlayerStatePlaying
+                     || state == VLCMediaPlayerStateOpening
+                     || state == VLCMediaPlayerStateBuffering);
+    [UIApplication sharedApplication].idleTimerDisabled = isActive;
 
     [self.playOrPauseButton setImage:playPauseImage forState:UIControlStateNormal];
 }
-- 
1.7.10.2 (Apple Git-33)




More information about the vlc-devel mailing list