Skip to content

Commit

Permalink
fix(version): use old working version for auto fullscreen with device…
Browse files Browse the repository at this point in the history
… specific conditionals 🐛

see: TheWidlarzGroup#1568
  • Loading branch information
joemewes committed Nov 4, 2019
1 parent f38b6f8 commit bcc198a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions ios/Video/RCTVideo.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ @implementation RCTVideo
AVPlayer *_player;
AVPlayerItem *_playerItem;
NSDictionary *_source;
AVPictureInPictureController *_pipController;
// AVPictureInPictureController *_pipController;
void (^__strong _Nonnull _restoreUserInterfaceForPIPStopCompletionHandler)(BOOL);
BOOL _playerItemObserversSet;
BOOL _playerBufferEmpty;
Expand Down Expand Up @@ -79,6 +79,10 @@ @implementation RCTVideo
#if __has_include(<react-native-video/RCTVideoCache.h>)
RCTVideoCache * _videoCache;
#endif
#if TARGET_OS_IOS
void (^__strong _Nonnull _restoreUserInterfaceForPIPStopCompletionHandler)(BOOL);
AVPictureInPictureController *_pipController;
#endif
}

- (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher
Expand Down Expand Up @@ -793,6 +797,7 @@ - (void)setPlayWhenInactive:(BOOL)playWhenInactive

- (void)setPictureInPicture:(BOOL)pictureInPicture
{
#if TARGET_OS_IOS
if (_pictureInPicture == pictureInPicture) {
return;
}
Expand All @@ -807,8 +812,10 @@ - (void)setPictureInPicture:(BOOL)pictureInPicture
[_pipController stopPictureInPicture];
});
}
#endif
}

#if TARGET_OS_IOS
- (void)setRestoreUserInterfaceForPIPStopCompletionHandler:(BOOL)restore
{
if (_restoreUserInterfaceForPIPStopCompletionHandler != NULL) {
Expand All @@ -824,6 +831,7 @@ - (void)setupPipController {
_pipController.delegate = self;
}
}
#endif

- (void)setIgnoreSilentSwitch:(NSString *)ignoreSilentSwitch
{
Expand Down Expand Up @@ -1280,7 +1288,9 @@ - (void)usePlayerLayer
[self.layer addSublayer:_playerLayer];
self.layer.needsDisplayOnBoundsChange = YES;

#if TARGET_OS_IOS
[self setupPipController];
#endif
}
}

Expand Down Expand Up @@ -1538,7 +1548,7 @@ - (NSString *)cacheDirectoryPath {
}

#pragma mark - Picture in Picture

#if TARGET_OS_IOS
- (void)pictureInPictureControllerDidStopPictureInPicture:(AVPictureInPictureController *)pictureInPictureController {
if (self.onPictureInPictureStatusChanged) {
self.onPictureInPictureStatusChanged(@{
Expand Down Expand Up @@ -1574,5 +1584,6 @@ - (void)pictureInPictureController:(AVPictureInPictureController *)pictureInPict
}
_restoreUserInterfaceForPIPStopCompletionHandler = completionHandler;
}
#endif

@end

0 comments on commit bcc198a

Please sign in to comment.