Skip to content

Commit

Permalink
Always send both played and loaded values in progress events
Browse files Browse the repository at this point in the history
  • Loading branch information
albanqoku committed Jul 27, 2016
1 parent e068d5a commit 2ee2ccd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/ReactPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ export default class ReactPlayer extends Component {
}
progress = () => {
if (this.props.url && this.refs.player) {
const loaded = this.refs.player.getFractionLoaded()
const played = this.refs.player.getFractionPlayed()
if (loaded || played) {
const loaded = this.refs.player.getFractionLoaded() || 0
const played = this.refs.player.getFractionPlayed() || 0
if (loaded !== this.prevLoaded || played !== this.prevPlayed) {
this.props.onProgress({ loaded, played })
this.prevLoaded = loaded
this.prevPlayed = played
}
}
this.progressTimeout = setTimeout(this.progress, this.props.progressFrequency)
Expand Down

0 comments on commit 2ee2ccd

Please sign in to comment.