浏览代码

Movie View: be nice with the user's battery and stop video decoding when app is in background (close #8678)

Felix Paul Kühne 12 年之前
父节点
当前提交
33fd465ea6
共有 1 个文件被更改,包括 6 次插入6 次删除
  1. 6 6
      AspenProject/VLCMovieViewController.m

+ 6 - 6
AspenProject/VLCMovieViewController.m

@@ -373,11 +373,10 @@
 
 - (IBAction)playPause
 {
-    if ([_mediaPlayer isPlaying]) {
+    if ([_mediaPlayer isPlaying])
         [_mediaPlayer pause];
-    } else {
+    else
         [_mediaPlayer play];
-    }
 }
 
 - (IBAction)forward:(id)sender
@@ -543,7 +542,8 @@
     if (![[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingContinueAudioInBackgroundKey] intValue]) {
         [_mediaPlayer pause];
         _shouldResumePlaying = YES;
-    }
+    } else
+        _mediaPlayer.currentVideoTrackIndex = 0;
 }
 
 - (void)applicationDidEnterBackground:(NSNotification *)notification
@@ -553,11 +553,11 @@
 
 - (void)applicationDidBecomeActive:(NSNotification *)notification
 {
-    NSLog(@"applicationDidBecomeActive");
     if (_shouldResumePlaying) {
         _shouldResumePlaying = NO;
         [_mediaPlayer play];
-    }
+    } else
+        _mediaPlayer.currentVideoTrackIndex = 1;
 }
 
 #pragma mark - autorotation