Developers / How to: Move to the next step automatically after x seconds

How to: Move to the next step automatically after x seconds

With this callback, you can move to the next step automatically after x seconds.

Implementing the callback

Developers can prepare a function that will be within the application source code. Here we have defined im_callbacks.imDelayNext function which can be called from within the Authoring tool.

In your application source code insert:

  window.im_callbacks = {
      imDelayNext: function(player_id, topic_id, step_id, custom_data) {
        if (custom_data.delay == undefined) custom_data.delay = 0;
          custom_data.delay = custom_data.delay*1000;
          setTimeout(function() {
            inline_manual_player.goToStep("next");
          }, custom_data.delay);
      }
  }

Using the function in the Authoring tool

In the Authoring tool, you can re-use the callback wherever necessary and pass the parameter delay.

In the Authoring tool:

  1. Within the Callbacks panel, add a callback im_callbacks.imDelayNext in On show section.
  2. Click + under Custom data tab.
  3. Provide name delay and value seconds - how long it should wait before moving to the next step.