employ onPlaybackRateChange instead to smooth the poster disappearance (#411)

This commit is contained in:
Linmic 2016-12-08 22:12:34 +08:00 committed by Matt Apperson
parent 595bc19c87
commit 7b95bae99a

View File

@ -58,10 +58,6 @@ export default class Video extends Component {
}; };
_onProgress = (event) => { _onProgress = (event) => {
if (this.state.showPoster) {
this.setState({showPoster: false});
}
if (this.props.onProgress) { if (this.props.onProgress) {
this.props.onProgress(event.nativeEvent); this.props.onProgress(event.nativeEvent);
} }
@ -126,6 +122,10 @@ export default class Video extends Component {
}; };
_onPlaybackRateChange = (event) => { _onPlaybackRateChange = (event) => {
if (this.state.showPoster && (event.nativeEvent.playbackRate === 1)) {
this.setState({showPoster: false});
}
if (this.props.onPlaybackRateChange) { if (this.props.onPlaybackRateChange) {
this.props.onPlaybackRateChange(event.nativeEvent); this.props.onPlaybackRateChange(event.nativeEvent);
} }