Javascript - Listen to YouTube player events in interactive video?
Submitted by vargaszabolcs on Sat, 10/03/2020 - 11:59
Forums:
Hi!
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
Mon, 10/05/2020 - 06:54
Permalink
Hi https://h5p.org/user
Hi https://h5p.org/user/109552!
You can add your own scripts using the alter scripts hook (see customization docs at https://h5p.org/node/2692). 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 https://h5p.org/comment/22925#comment-22925
Best,
Oliver