Merge branch 'master' of git://github.com/react-native-community/react-native-video into react-native-community-master

Merge branch 'master' of git://github.com/react-native-community/react-native-video into react-native-community-master
This commit is contained in:
sridhar
2018-10-27 09:19:28 +05:30
157 changed files with 5271 additions and 577 deletions

View File

@@ -178,6 +178,12 @@ export default class Video extends Component {
this.props.onPlaybackRateChange(event.nativeEvent);
}
};
_onExternalPlaybackChange = (event) => {
if (this.props.onExternalPlaybackChange) {
this.props.onExternalPlaybackChange(event.nativeEvent);
}
}
_onAudioBecomingNoisy = () => {
if (this.props.onAudioBecomingNoisy) {
@@ -207,7 +213,7 @@ export default class Video extends Component {
}
const isNetwork = !!(uri && uri.match(/^https?:/));
const isAsset = !!(uri && uri.match(/^(assets-library|file|content|ms-appx|ms-appdata):/));
const isAsset = !!(uri && uri.match(/^(assets-library|ipod-library|file|content|ms-appx|ms-appdata):/));
let nativeResizeMode;
if (resizeMode === VideoResizeMode.stretch) {
@@ -243,6 +249,7 @@ export default class Video extends Component {
onBandwidthUpdate: this._onBandwidthUpdate,
onTimedMetadata: this._onTimedMetadata,
onVideoAudioBecomingNoisy: this._onAudioBecomingNoisy,
onVideoExternalPlaybackChange: this._onExternalPlaybackChange,
onVideoFullscreenPlayerWillPresent: this._onFullscreenPlayerWillPresent,
onVideoFullscreenPlayerDidPresent: this._onFullscreenPlayerDidPresent,
onVideoFullscreenPlayerWillDismiss: this._onFullscreenPlayerWillDismiss,
@@ -255,35 +262,21 @@ export default class Video extends Component {
onAudioBecomingNoisy: this._onAudioBecomingNoisy,
});
if (this.props.poster && this.state.showPoster) {
const posterStyle = {
position: 'absolute',
left: 0,
top: 0,
right: 0,
bottom: 0,
resizeMode: this.props.posterResizeMode || 'contain'
};
return (
<View style={nativeProps.style}>
<RCTVideo
ref={this._assignRoot}
{...nativeProps}
/>
<Image
style={posterStyle}
source={{uri: this.props.poster}}
/>
</View>
);
}
const posterStyle = {
...StyleSheet.absoluteFillObject,
resizeMode: this.props.posterResizeMode || 'contain',
};
return (
<RCTVideo
ref={this._assignRoot}
{...nativeProps}
/>
<React.Fragment>
<RCTVideo ref={this._assignRoot} {...nativeProps} />
{this.props.poster &&
this.state.showPoster && (
<View style={nativeProps.style}>
<Image style={posterStyle} source={{ uri: this.props.poster }} />
</View>
)}
</React.Fragment>
);
}
}
@@ -306,6 +299,7 @@ Video.propTypes = {
onVideoEnd: PropTypes.func,
onTimedMetadata: PropTypes.func,
onVideoAudioBecomingNoisy: PropTypes.func,
onVideoExternalPlaybackChange: PropTypes.func,
onVideoFullscreenPlayerWillPresent: PropTypes.func,
onVideoFullscreenPlayerDidPresent: PropTypes.func,
onVideoFullscreenPlayerWillDismiss: PropTypes.func,
@@ -377,6 +371,7 @@ Video.propTypes = {
controls: PropTypes.bool,
audioOnly: PropTypes.bool,
currentTime: PropTypes.number,
fullscreenOrientation: PropTypes.oneOf(['all','landscape','portrait']),
progressUpdateInterval: PropTypes.number,
useTextureView: PropTypes.bool,
onLoadStart: PropTypes.func,
@@ -396,6 +391,7 @@ Video.propTypes = {
onPlaybackRateChange: PropTypes.func,
onAudioFocusChanged: PropTypes.func,
onAudioBecomingNoisy: PropTypes.func,
onExternalPlaybackChange: PropTypes.func,
/* Required by react-native */
scaleX: PropTypes.number,