diff --git a/src/players/Vimeo.js b/src/players/Vimeo.js index 0030eec..423da80 100644 --- a/src/players/Vimeo.js +++ b/src/players/Vimeo.js @@ -39,11 +39,12 @@ export class Vimeo extends Component { }).catch(this.props.onError) this.player.on('loaded', () => { this.props.onReady() - this.player.getDuration().then(duration => { - this.duration = duration - }) + this.refreshDuration() + }) + this.player.on('play', () => { + this.props.onPlay() + this.refreshDuration() }) - this.player.on('play', this.props.onPlay) this.player.on('pause', this.props.onPause) this.player.on('seeked', e => this.props.onSeek(e.seconds)) this.player.on('ended', this.props.onEnded) @@ -56,6 +57,11 @@ export class Vimeo extends Component { }) }, this.props.onError) } + refreshDuration () { + this.player.getDuration().then(duration => { + this.duration = duration + }) + } play () { this.callPlayer('play') }