Skip to content

Commit

Permalink
Stop progress loop on pause
Browse files Browse the repository at this point in the history
To prevent the delayed progress event after pausing, and ensure #51 doesn't happen again
  • Loading branch information
cookpete committed Jul 27, 2016
1 parent 2a4ecd4 commit 180039b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/ReactPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ export default class ReactPlayer extends Component {
componentDidMount () {
this.progress()
}
componentWillReceiveProps (nextProps) {
if (this.props.playing && !nextProps.playing) {
clearTimeout(this.progressTimeout)
}
if (!this.props.playing && nextProps.playing) {
this.progress()
}
}
componentWillUnmount () {
clearTimeout(this.progressTimeout)
}
Expand Down

0 comments on commit 180039b

Please sign in to comment.