Auto Play Video

Forums: 

Hi,

I am trying to make intercative vdeo to play automaticaly when my moodle activity page load. I tried the below code in my custom.js file. But it seems to be not working. Any help appreciated.

(function ($) {
    $(document).ready(function () {
        $('.h5p-control').trigger("click");
    })
})(H5P.jQuery);

 

Summary: 
Moodle interactive video autoplay
Content types: 
tomaj's picture

The Interactive Video is running inside an iframe, so you wouldn't be able to use jQuery to select elements inside that iframe.

You might be able to do something like this, to select inside the iframe.

var $iframe = $("#iframeID").contents();
$iframe.find('selector');

- Tom

Thanks Tom,

Also I shoud have used,

$(window).load(function()