You’re going to need to use the Youtube API to listen to those types of events. Youtube doesn’t generate a standard HTML5 video, and when a video is within an iframe it is insulated inside its own window, so you have two things here that are blocking from detection of an ended video. Check out this thread for how to work with the Youtube API within a regular rectangle.
Using their API, you can detect whether a video has ‘ended’: https://developers.google.com/youtube/iframe_api_reference#Playback_status