Skip to content

Commit

Permalink
Merge pull request #3 from fenderdigital/allowsExternalPlayback
Browse files Browse the repository at this point in the history
expose allowsExternalPlayback (iOS only)
  • Loading branch information
bennettk authored Apr 9, 2018
2 parents 9d587fb + 9be4dc4 commit 3f1ba2c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions Video.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ Video.propTypes = {
playInBackground: PropTypes.bool,
playWhenInactive: PropTypes.bool,
ignoreSilentSwitch: PropTypes.oneOf(['ignore', 'obey']),
allowsExternalPlayback: PropTypes.bool,
disableFocus: PropTypes.bool,
controls: PropTypes.bool,
currentTime: PropTypes.number,
Expand Down
8 changes: 8 additions & 0 deletions ios/RCTVideo.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ @implementation RCTVideo
NSString * _ignoreSilentSwitch;
NSString * _resizeMode;
BOOL _fullscreenPlayerPresented;
BOOL _allowsExternalPlayback;
UIViewController * _presentingViewController;
}

Expand All @@ -68,6 +69,7 @@ - (instancetype)initWithEventDispatcher:(RCTEventDispatcher *)eventDispatcher
_playInBackground = false;
_playWhenInactive = false;
_ignoreSilentSwitch = @"inherit"; // inherit, ignore, obey
_allowsExternalPlayback = YES;

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationWillResignActive:)
Expand Down Expand Up @@ -540,6 +542,12 @@ - (void)setPaused:(BOOL)paused
_paused = paused;
}

- (void)setAllowsExternalPlayback:(BOOL)allowsExternalPlayback
{
_allowsExternalPlayback = allowsExternalPlayback;
[_player setAllowsExternalPlayback:allowsExternalPlayback];
}

- (float)getCurrentTime
{
return _playerItem != NULL ? CMTimeGetSeconds(_playerItem.currentTime) : 0;
Expand Down
2 changes: 2 additions & 0 deletions ios/RCTVideoManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ - (dispatch_queue_t)methodQueue
RCT_EXPORT_VIEW_PROPERTY(currentTime, float);
RCT_EXPORT_VIEW_PROPERTY(fullscreen, BOOL);
RCT_EXPORT_VIEW_PROPERTY(progressUpdateInterval, float);
RCT_EXPORT_VIEW_PROPERTY(allowsExternalPlayback, BOOL);

/* Should support: onLoadStart, onLoad, and onError to stay consistent with Image */
RCT_EXPORT_VIEW_PROPERTY(onVideoLoadStart, RCTBubblingEventBlock);
RCT_EXPORT_VIEW_PROPERTY(onVideoLoad, RCTBubblingEventBlock);
Expand Down

0 comments on commit 3f1ba2c

Please sign in to comment.