micnews / react-jw-player

A React Component API for JW Player
195 stars 94 forks source link

Fix for on resume event #108

Closed jc14 closed 6 years ago

jc14 commented 6 years ago

https://github.com/micnews/react-jw-player/issues/83

Solves issue with newer versions of jw player where on resume is being triggered through 'buffering' rather than 'paused'

ellell commented 6 years ago

@jc14 thanks for this! Curious if you have tested this for both version 7 and 8 of jwplayer? If I remember correctly they were handling these events a bit differently. I can test it out myself later today as well to make sure we don't break version 7, other than that looks good!

jc14 commented 6 years ago

@ellell No problem! I've only tested this with version 8. I don't have an easy way of testing for version 7. I needed OnResume for a current project so I thought I would go ahead and add this.

jc14 commented 6 years ago

@ellell Updated change to look for oldstate to be paused or buffering. This should make this change compatible with version 7 and 8 though I have only tested with 8.

I also separated the onResume test into two for versions 7 and lower, and versions 8 and higher.