Skip to content

Commit

Permalink
Merge pull request #59 from let00/let00-add-isloading-youtube
Browse files Browse the repository at this point in the history
Add support for isLoading prop for Youtube vendor
  • Loading branch information
souporserious authored Apr 2, 2019
2 parents e6cbbf3 + 5f52e84 commit 20f7fc9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/vendors/Youtube.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class Youtube extends Component {

if (isPlaying) {
this.props.onPlay(true)
this.props.isLoading(false)
this.props.onDuration(this._player.getDuration())
this._timeUpdateId = requestAnimationFrame(this._handleTimeUpdate)
} else {
Expand All @@ -100,11 +101,16 @@ class Youtube extends Component {
this._progressId = null
}

if (data === -1 || data === BUFFERING) {
this.props.isLoading(true)
}

if (data === PAUSED) {
this.props.onPause(false)
}

if (data === ENDED) {
this.props.isLoading(false)
this.props.onEnded(false)
}

Expand All @@ -115,6 +121,7 @@ class Youtube extends Component {

// reset duration if a new video was loaded
if (data === CUED) {
this.props.isLoading(false)
this.props.onDuration(0.1)
}
},
Expand Down

0 comments on commit 20f7fc9

Please sign in to comment.