addEventListener Not Working

getEnded works to hide the player.

But conversely the other way you may have issues as a hidden dom element may get blocked by the browser for autoplay, so you may not see any events trigger.