react-youtube icon indicating copy to clipboard operation
react-youtube copied to clipboard

Using 'end' in playerVars causes onEnd to be called twice

Open baron816 opened this issue 8 years ago • 3 comments

baron816 avatar Apr 08 '17 20:04 baron816

Will have to setup a test case to see this in action. Thank you for opening an issue 👍

tjallingt avatar Apr 12 '17 13:04 tjallingt

@getnashty's solution for a similar issue on react-native-video worked for me:

import debounce from 'lodash.debounce'; onEnd={debounce(this.myFn, 100)}

https://github.com/react-native-community/react-native-video/issues/238#issuecomment-230317033

It's a hack but at least works until this issue is fixed

andycloke avatar May 03 '18 09:05 andycloke

Thanks for raising this issue. I had been debugging for a bit and thought it was a problem in my own app until I found this issue. I tried debounce but it didn't seem to consistently work even with long thresholds set (e.g. I tried values from 1000ms to 5000ms) as the second onEnd event would sometimes arrive afterwards when a new video had already been queued up and was playing. For now, I've removed the use of 'end' as one of the options I'm passing to the opts prop.

waynelau avatar Jun 09 '20 06:06 waynelau