1

I stream on youtube and I have OBS Studio which has a built-in browser.

I would like to know what is a suitable code if I want to have a pressed space button in every 20 seconds on that website automatically?

LordY
  • 31
  • 3
  • Look into `dispatchEvent` (https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent) and already answered questions (e.g. https://stackoverflow.com/questions/596481/is-it-possible-to-simulate-key-press-events-programmatically) – junvar Apr 15 '19 at 21:02

1 Answers1

1

I tried this but doesn't work (now 2 sec for easy testing)

$(window).load(function()  {
var e = $.Event('keydown', { keyCode: 32 });// space key
setInterval(function() {
$(document).trigger(e);
         }, 2000);

});

LordY
  • 31
  • 3