Browse Source

movie player: remove vout from view hierarchy when app goes to background

Felix Paul Kühne 10 years ago
parent
commit
6dcca9741e
1 changed files with 8 additions and 2 deletions
  1. 8 2
      Sources/VLCPlaybackController.m

+ 8 - 2
Sources/VLCPlaybackController.m

@@ -36,6 +36,7 @@
     float _currentPlaybackRate;
     UIView *_videoOutputViewWrapper;
     UIView *_actualVideoOutputView;
+    UIView *_preBackgroundWrapperView;
 
     /* cached stuff for the VC */
     NSString *_title;
@@ -1020,6 +1021,9 @@ static inline NSArray * RemoteCommandCenterCommandsToHandle(MPRemoteCommandCente
 {
     [self _savePlaybackState];
 
+    _preBackgroundWrapperView = _videoOutputViewWrapper;
+    [self setVideoOutputView:nil];
+
     if (_mediaPlayer.audioTrackIndexes.count > 0)
         _mediaPlayer.currentVideoTrackIndex = -1;
 
@@ -1038,8 +1042,10 @@ static inline NSArray * RemoteCommandCenterCommandsToHandle(MPRemoteCommandCente
 
 - (void)applicationDidBecomeActive:(NSNotification *)notification
 {
-    if (_videoOutputViewWrapper)
-        [self setVideoOutputView:_videoOutputViewWrapper];
+    if (_preBackgroundWrapperView) {
+        [self setVideoOutputView:_preBackgroundWrapperView];
+        _preBackgroundWrapperView = nil;
+    }
 
     if (_mediaPlayer.numberOfVideoTracks > 0) {
         /* re-enable video decoding and reset position once done */