Skip to main content
Inspiring
August 22, 2018
Question

Cheat course autoplay blocker

  • August 22, 2018
  • 2 replies
  • 496 views

Hi there,

Thought I post some findings here regarding the infamous new autoplay block for HTML5, introduced in the latest Captivate patch. I found that if I insert a play command in the cpInit() function in the head of the index file like shown below, the course starts playing right away, without the need of clicking the ugly Play button (in fact without it appearing discernibly at all).

function cpInit()

{

  document.body.innerHTML = " ...;

  cp.DoCPInit();

  window.cpAPIInterface.play();

  var lCpExit = window["DoCPExit"];

  window["DoCPExit"] = function()

  {

   if(cp.UnloadActivties)

    cp.UnloadActivties();

   lCpExit();

  };

}

Works decently enough for a non-responsive project on latest IE and FireFox versions under Windows (didn't test responsive / mobile).

Catch is, Chrome seems to struggles with it. Although the course autoplays just fine on Chrome as well, once it reaches an video somewhere within the course, it pauses there, regardless if the video object is set to Autoplay or not (in the case of event video).

Anybody knows of some JavaScript code to be fired on slide enter on the video slide, that would force the video to start?

I don't know much JavaScript, so this is all rather empiric trial and error stuff for me. Tried 'document.getElementsByTagName("video")[0].play();' on event video, but couldn't get it to work on slide enter.

    This topic has been closed for replies.

    2 replies

    Stagprime2687219
    Legend
    July 2, 2019

    I realize this post is a bit old but there were no responses so I thought I might chime in.

    Try placing the following code on your onEnter for the slide where the video is found.

    setTimeout(function() {

    $("#initNameOfVideoObject").click();

    }, 500);

    You will need to change the portion in red above to whatever the name of your video object on the slide is.

    The timeout allows a half second before emulating the click so that the object can fully load first.

    This concept also works on the play button for the project as well  when placed after the call for the cpInit() function.

    $("#playImage").click();

    GaanfAuthor
    Inspiring
    July 4, 2019

    Took me awhile to realize someone answered here ;-)

    Thanks for your suggestion. Doesn't seem to work for me though. The video still remains struck on it's first frame.

    I kind of got used to having people click that play button before the first slide, so it's not that much of a pain to me anymore.