浏览代码

VLCPlaybackService: Handle DidBecomeActive logic inside WillEnterForeground

This will allow more time to prepare the the video ouput in order to
avoid an empty, black screen when re-entrering from background.
Soomin Lee 5 年之前
父节点
当前提交
36841c0f9e
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      Sources/VLCPlaybackService.m

+ 3 - 3
Sources/VLCPlaybackService.m

@@ -108,10 +108,10 @@ NSString *const VLCPlaybackServicePlaybackPositionUpdated = @"VLCPlaybackService
         // appkit because we neeed to know when we go to background in order to stop the video, so that we don't crash
         [defaultCenter addObserver:self selector:@selector(applicationWillResignActive:)
                               name:UIApplicationWillResignActiveNotification object:nil];
-        [defaultCenter addObserver:self selector:@selector(applicationDidBecomeActive:)
-                              name:UIApplicationDidBecomeActiveNotification object:nil];
         [defaultCenter addObserver:self selector:@selector(applicationDidEnterBackground:)
                               name:UIApplicationDidEnterBackgroundNotification object:nil];
+        [defaultCenter addObserver:self selector:@selector(applicationWillEnterForeground:)
+                              name:UIApplicationWillEnterForegroundNotification object:nil];
 
         _metadata = [VLCMetaData new];
         _dialogProvider = [[VLCDialogProvider alloc] initWithLibrary:[VLCLibrary sharedLibrary] customUI:YES];
@@ -1238,7 +1238,7 @@ NSString *const VLCPlaybackServicePlaybackPositionUpdated = @"VLCPlaybackService
     }
 }
 
-- (void)applicationDidBecomeActive:(NSNotification *)notification
+- (void)applicationWillEnterForeground:(NSNotification *)notification
 {
     if (_preBackgroundWrapperView) {
         [self setVideoOutputView:_preBackgroundWrapperView];