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
|
### Configurable props
|
||||||
|
* [allowsExternalPlayback](#allowsexternalplayback)
|
||||||
* [ignoreSilentSwitch](#ignoresilentswitch)
|
* [ignoreSilentSwitch](#ignoresilentswitch)
|
||||||
* [muted](#muted)
|
* [muted](#muted)
|
||||||
* [paused](#paused)
|
* [paused](#paused)
|
||||||
@ -235,6 +236,13 @@ var styles = StyleSheet.create({
|
|||||||
* [useTextureView](#usetextureview)
|
* [useTextureView](#usetextureview)
|
||||||
* [volume](#volume)
|
* [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
|
#### ignoreSilentSwitch
|
||||||
Controls the iOS silent switch behavior
|
Controls the iOS silent switch behavior
|
||||||
* **"inherit" (default)** - Use the default AVPlayer behavior
|
* **"inherit" (default)** - Use the default AVPlayer behavior
|
||||||
|
1
Video.js
1
Video.js
@ -274,6 +274,7 @@ Video.propTypes = {
|
|||||||
poster: PropTypes.string,
|
poster: PropTypes.string,
|
||||||
posterResizeMode: Image.propTypes.resizeMode,
|
posterResizeMode: Image.propTypes.resizeMode,
|
||||||
repeat: PropTypes.bool,
|
repeat: PropTypes.bool,
|
||||||
|
allowsExternalPlayback: PropTypes.bool,
|
||||||
selectedTextTrack: PropTypes.shape({
|
selectedTextTrack: PropTypes.shape({
|
||||||
type: PropTypes.string.isRequired,
|
type: PropTypes.string.isRequired,
|
||||||
value: PropTypes.oneOfType([
|
value: PropTypes.oneOfType([
|
||||||
|
@ -40,6 +40,7 @@ static NSString *const timedMetadata = @"timedMetadata";
|
|||||||
BOOL _muted;
|
BOOL _muted;
|
||||||
BOOL _paused;
|
BOOL _paused;
|
||||||
BOOL _repeat;
|
BOOL _repeat;
|
||||||
|
BOOL _allowsExternalPlayback;
|
||||||
NSDictionary * _selectedTextTrack;
|
NSDictionary * _selectedTextTrack;
|
||||||
BOOL _playbackStalled;
|
BOOL _playbackStalled;
|
||||||
BOOL _playInBackground;
|
BOOL _playInBackground;
|
||||||
@ -67,6 +68,7 @@ static NSString *const timedMetadata = @"timedMetadata";
|
|||||||
_controls = NO;
|
_controls = NO;
|
||||||
_playerBufferEmpty = YES;
|
_playerBufferEmpty = YES;
|
||||||
_playInBackground = false;
|
_playInBackground = false;
|
||||||
|
_allowsExternalPlayback = YES;
|
||||||
_playWhenInactive = false;
|
_playWhenInactive = false;
|
||||||
_ignoreSilentSwitch = @"inherit"; // inherit, ignore, obey
|
_ignoreSilentSwitch = @"inherit"; // inherit, ignore, obey
|
||||||
|
|
||||||
@ -523,6 +525,12 @@ static NSString *const timedMetadata = @"timedMetadata";
|
|||||||
_playInBackground = playInBackground;
|
_playInBackground = playInBackground;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)setAllowsExternalPlayback:(BOOL)allowsExternalPlayback
|
||||||
|
{
|
||||||
|
_allowsExternalPlayback = allowsExternalPlayback;
|
||||||
|
_player.allowsExternalPlayback = _allowsExternalPlayback;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)setPlayWhenInactive:(BOOL)playWhenInactive
|
- (void)setPlayWhenInactive:(BOOL)playWhenInactive
|
||||||
{
|
{
|
||||||
_playWhenInactive = playWhenInactive;
|
_playWhenInactive = playWhenInactive;
|
||||||
@ -635,6 +643,7 @@ static NSString *const timedMetadata = @"timedMetadata";
|
|||||||
[self setRepeat:_repeat];
|
[self setRepeat:_repeat];
|
||||||
[self setPaused:_paused];
|
[self setPaused:_paused];
|
||||||
[self setControls:_controls];
|
[self setControls:_controls];
|
||||||
|
[self setAllowsExternalPlayback:_allowsExternalPlayback];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setRepeat:(BOOL)repeat {
|
- (void)setRepeat:(BOOL)repeat {
|
||||||
|
@ -22,6 +22,7 @@ RCT_EXPORT_MODULE();
|
|||||||
RCT_EXPORT_VIEW_PROPERTY(src, NSDictionary);
|
RCT_EXPORT_VIEW_PROPERTY(src, NSDictionary);
|
||||||
RCT_EXPORT_VIEW_PROPERTY(resizeMode, NSString);
|
RCT_EXPORT_VIEW_PROPERTY(resizeMode, NSString);
|
||||||
RCT_EXPORT_VIEW_PROPERTY(repeat, BOOL);
|
RCT_EXPORT_VIEW_PROPERTY(repeat, BOOL);
|
||||||
|
RCT_EXPORT_VIEW_PROPERTY(allowsExternalPlayback, BOOL);
|
||||||
RCT_EXPORT_VIEW_PROPERTY(selectedTextTrack, NSDictionary);
|
RCT_EXPORT_VIEW_PROPERTY(selectedTextTrack, NSDictionary);
|
||||||
RCT_EXPORT_VIEW_PROPERTY(paused, BOOL);
|
RCT_EXPORT_VIEW_PROPERTY(paused, BOOL);
|
||||||
RCT_EXPORT_VIEW_PROPERTY(muted, BOOL);
|
RCT_EXPORT_VIEW_PROPERTY(muted, BOOL);
|
||||||
|
Loading…
Reference in New Issue
Block a user