From 7b95bae99a30db6230fb55235a2a5ac89c942c97 Mon Sep 17 00:00:00 2001 From: Linmic Date: Thu, 8 Dec 2016 22:12:34 +0800 Subject: [PATCH] employ onPlaybackRateChange instead to smooth the poster disappearance (#411) --- Video.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Video.js b/Video.js index d4f60468..5dcc2579 100644 --- a/Video.js +++ b/Video.js @@ -58,10 +58,6 @@ export default class Video extends Component { }; _onProgress = (event) => { - if (this.state.showPoster) { - this.setState({showPoster: false}); - } - if (this.props.onProgress) { this.props.onProgress(event.nativeEvent); } @@ -126,6 +122,10 @@ export default class Video extends Component { }; _onPlaybackRateChange = (event) => { + if (this.state.showPoster && (event.nativeEvent.playbackRate === 1)) { + this.setState({showPoster: false}); + } + if (this.props.onPlaybackRateChange) { this.props.onPlaybackRateChange(event.nativeEvent); }