davidohayon669 / react-native-youtube

A <YouTube/> component for React Native.
MIT License
1.16k stars 472 forks source link

onClose, onFinish, or something similar for closing the youtube player event #501

Open lguardado opened 3 years ago

lguardado commented 3 years ago

Hi. I just needed an onClose or similar event but I couldn't find any. The idea is to be able to know when the user closed the player but when that happens, the only state change is paused.

If I want to show different UI depending on the playing, state it would be nice to be able to do it.

For instance, if I want to show the player () only when a user press "play" and a spinner while it's loading, it would be nice to know when the play has ended (rather than paused in which case the player would be removed from the DOM if the user press the pause button)

Basically something like vimeo's library https://github.com/Myagi/react-native-vimeo's "onFinish"

hamam99 commented 3 years ago

Yout can listen onChangeState, when video is end it will return status 'ended'