Browse Source

playback: correctly continue video playback when coming back from the background

Felix Paul Kühne 10 years ago
parent
commit
7bea78646d
1 changed files with 9 additions and 1 deletions
  1. 9 1
      Sources/VLCPlaybackController.m

+ 9 - 1
Sources/VLCPlaybackController.m

@@ -1038,7 +1038,15 @@ static inline NSArray * RemoteCommandCenterCommandsToHandle(MPRemoteCommandCente
 
 
 - (void)applicationDidBecomeActive:(NSNotification *)notification
 - (void)applicationDidBecomeActive:(NSNotification *)notification
 {
 {
-    _mediaPlayer.currentVideoTrackIndex = 1;
+    if (_videoOutputViewWrapper)
+        [self setVideoOutputView:_videoOutputViewWrapper];
+
+    if (_mediaPlayer.numberOfVideoTracks > 0) {
+        /* re-enable video decoding and reset position once done */
+        float position = _mediaPlayer.position;
+        _mediaPlayer.currentVideoTrackIndex = 1;
+        _mediaPlayer.position = position;
+    }
 
 
     if (_shouldResumePlaying) {
     if (_shouldResumePlaying) {
         _shouldResumePlaying = NO;
         _shouldResumePlaying = NO;