Highlighted

Cheat course autoplay blocker

Engaged ,
Aug 22, 2018

Copy link to clipboard

Copied

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.

Views

224

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Cheat course autoplay blocker

Engaged ,
Aug 22, 2018

Copy link to clipboard

Copied

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.

Views

225

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Advocate ,
Jul 02, 2019

Copy link to clipboard

Copied

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();

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Gaanf LATEST
Engaged ,
Jul 04, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Resources
Captivate User Guide
New Group