I am creating a Chrome Extension which pauses the video on YouTube on load. At the moment when you click a video on YouTube it will automatically play, however I would like to pause it instead. I have found the element for the play button and at the moment I have made script, however it isn't working. Is it possible to automatically click something using jQuery?
Script:
$(document).on("DOMSubtreeModified", function() {
$(".ytp-button-play").trigger("click");
});
Also, the element for the video itself is #movie_player
and I have tried the .load() method for that element but it isn't working either.
Here is the Inspect Element:
Any help will be appreciated :) Thanks