Merge pull request #1057 from genglei01/master
Add allowsExternalPlayback Property for ios
This commit is contained in:
commit
bd30454aea
@ -219,6 +219,7 @@ var styles = StyleSheet.create({
|
||||
```
|
||||
|
||||
### Configurable props
|
||||
* [allowsExternalPlayback](#allowsexternalplayback)
|
||||
* [ignoreSilentSwitch](#ignoresilentswitch)
|
||||
* [muted](#muted)
|
||||
* [paused](#paused)
|
||||
@ -235,6 +236,13 @@ var styles = StyleSheet.create({
|
||||
* [useTextureView](#usetextureview)
|
||||
* [volume](#volume)
|
||||
|
||||
#### allowsExternalPlayback
|
||||
Indicates whether the player allows switching to external playback mode such as AirPlay or HDMI.
|
||||
* **true (default)** - allow switching to external playback mode
|
||||
* **false** - Don't allow switching to external playback mode
|
||||
|
||||
Platforms: iOS
|
||||
|
||||
#### ignoreSilentSwitch
|
||||
Controls the iOS silent switch behavior
|
||||
* **"inherit" (default)** - Use the default AVPlayer behavior
|
||||
|
1
Video.js
1
Video.js
@ -274,6 +274,7 @@ Video.propTypes = {
|
||||
poster: PropTypes.string,
|
||||
posterResizeMode: Image.propTypes.resizeMode,
|
||||
repeat: PropTypes.bool,
|
||||
allowsExternalPlayback: PropTypes.bool,
|
||||
selectedTextTrack: PropTypes.shape({
|
||||
type: PropTypes.string.isRequired,
|
||||
value: PropTypes.oneOfType([
|
||||
|
@ -40,6 +40,7 @@ static NSString *const timedMetadata = @"timedMetadata";
|
||||
BOOL _muted;
|
||||
BOOL _paused;
|
||||
BOOL _repeat;
|
||||
BOOL _allowsExternalPlayback;
|
||||
NSDictionary * _selectedTextTrack;
|
||||
BOOL _playbackStalled;
|
||||
BOOL _playInBackground;
|
||||
@ -67,6 +68,7 @@ static NSString *const timedMetadata = @"timedMetadata";
|
||||
_controls = NO;
|
||||
_playerBufferEmpty = YES;
|
||||
_playInBackground = false;
|
||||
_allowsExternalPlayback = YES;
|
||||
_playWhenInactive = false;
|
||||
_ignoreSilentSwitch = @"inherit"; // inherit, ignore, obey
|
||||
|
||||
@ -523,6 +525,12 @@ static NSString *const timedMetadata = @"timedMetadata";
|
||||
_playInBackground = playInBackground;
|
||||
}
|
||||
|
||||
- (void)setAllowsExternalPlayback:(BOOL)allowsExternalPlayback
|
||||
{
|
||||
_allowsExternalPlayback = allowsExternalPlayback;
|
||||
_player.allowsExternalPlayback = _allowsExternalPlayback;
|
||||
}
|
||||
|
||||
- (void)setPlayWhenInactive:(BOOL)playWhenInactive
|
||||
{
|
||||
_playWhenInactive = playWhenInactive;
|
||||
@ -635,6 +643,7 @@ static NSString *const timedMetadata = @"timedMetadata";
|
||||
[self setRepeat:_repeat];
|
||||
[self setPaused:_paused];
|
||||
[self setControls:_controls];
|
||||
[self setAllowsExternalPlayback:_allowsExternalPlayback];
|
||||
}
|
||||
|
||||
- (void)setRepeat:(BOOL)repeat {
|
||||
|
@ -22,6 +22,7 @@ RCT_EXPORT_MODULE();
|
||||
RCT_EXPORT_VIEW_PROPERTY(src, NSDictionary);
|
||||
RCT_EXPORT_VIEW_PROPERTY(resizeMode, NSString);
|
||||
RCT_EXPORT_VIEW_PROPERTY(repeat, BOOL);
|
||||
RCT_EXPORT_VIEW_PROPERTY(allowsExternalPlayback, BOOL);
|
||||
RCT_EXPORT_VIEW_PROPERTY(selectedTextTrack, NSDictionary);
|
||||
RCT_EXPORT_VIEW_PROPERTY(paused, BOOL);
|
||||
RCT_EXPORT_VIEW_PROPERTY(muted, BOOL);
|
||||
|
Loading…
Reference in New Issue
Block a user