react-youtube
react-youtube copied to clipboard
Using 'end' in playerVars causes onEnd to be called twice
Will have to setup a test case to see this in action. Thank you for opening an issue 👍
@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
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.