Javascript - Listen to YouTube player events in interactive video?


I'd like to listen to the YouTube player events ('onReady', 'onStateChange') on a page with javascript, when a YouTube video is used in the Interactive video H5P content type in WordPress. How can I do that? Thanks in advance!

Content types: 
otacke's picture


You can add your own scripts using the alter scripts hook (see customization docs at Then you can wait for the content to be loaded, access the H5P content type instance and retrieve the video object to listen to, similar to