Skip to content

Commit

Permalink
Fix Vimeo duration logic
Browse files Browse the repository at this point in the history
  • Loading branch information
webmiraclepro committed Oct 15, 2017
1 parent e159149 commit 9b14fa6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/players/Vimeo.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ export default class Vimeo extends Base {
static canPlay (url) {
return MATCH_URL.test(url)
}
duration = null
currentTime = null
secondsLoaded = null
componentDidMount () {
const { url, config } = this.props
if (!url && config.vimeo.preload) {
Expand Down Expand Up @@ -43,12 +46,12 @@ export default class Vimeo extends Base {
const iframe = this.container.querySelector('iframe')
iframe.style.width = '100%'
iframe.style.height = '100%'
this.player.getDuration().then(duration => {
this.duration = duration
})
}).catch(this.props.onError)
this.player.on('loaded', this.onReady)
this.player.on('play', ({ duration }) => {
this.duration = duration
this.onPlay()
})
this.player.on('play', this.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)
Expand Down

0 comments on commit 9b14fa6

Please sign in to comment.