Merge branch 'master' into master
This commit is contained in:
49
Video.js
49
Video.js
@@ -172,6 +172,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) {
|
||||
@@ -236,6 +242,7 @@ export default class Video extends Component {
|
||||
onVideoBuffer: this._onBuffer,
|
||||
onTimedMetadata: this._onTimedMetadata,
|
||||
onVideoAudioBecomingNoisy: this._onAudioBecomingNoisy,
|
||||
onVideoExternalPlaybackChange: this._onExternalPlaybackChange,
|
||||
onVideoFullscreenPlayerWillPresent: this._onFullscreenPlayerWillPresent,
|
||||
onVideoFullscreenPlayerDidPresent: this._onFullscreenPlayerDidPresent,
|
||||
onVideoFullscreenPlayerWillDismiss: this._onFullscreenPlayerWillDismiss,
|
||||
@@ -248,35 +255,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>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -303,6 +296,7 @@ Video.propTypes = {
|
||||
onVideoEnd: PropTypes.func,
|
||||
onTimedMetadata: PropTypes.func,
|
||||
onVideoAudioBecomingNoisy: PropTypes.func,
|
||||
onVideoExternalPlaybackChange: PropTypes.func,
|
||||
onVideoFullscreenPlayerWillPresent: PropTypes.func,
|
||||
onVideoFullscreenPlayerDidPresent: PropTypes.func,
|
||||
onVideoFullscreenPlayerWillDismiss: PropTypes.func,
|
||||
@@ -384,6 +378,7 @@ Video.propTypes = {
|
||||
onPlaybackRateChange: PropTypes.func,
|
||||
onAudioFocusChanged: PropTypes.func,
|
||||
onAudioBecomingNoisy: PropTypes.func,
|
||||
onExternalPlaybackChange: PropTypes.func,
|
||||
|
||||
/* Required by react-native */
|
||||
scaleX: PropTypes.number,
|
||||
|
Reference in New Issue
Block a user