youtube-player
youtube-player copied to clipboard
Working fine but problem with event handler
player.on('stateChange', (event) => {
// event.data
});
while using event change when event.data === 0 basically the youtube player video ends to call a function but first time it works fine if i dont load the page or dont click anywhere else.
but while the video is playing and i click on other tab opened and came back to this tab the stateChange(i check logging the event.data) doesnt works and do whatever i told the function to do.