Method signature


Example usage

* Starts a video ad preparation for an in-game show
function prepareMidroll() {

Callback example

Following arguments can be passed to API_callback function as a result:

Callback if a video was found

method: “prepareMidroll”

result: “ok”

data: “ready”

Callback if a video was not found

method: “prepareMidroll”

result: “error”

data: “empty”

Callback if video ads are not available for current user

method: “prepareMidroll”

result: “error”

data: “disabled”

How it works

Function initiates a process of video ad selection for current user to show it in-game.
Video selection is personalized and depends on user activity on Web and other personal data.
After a successful video selection method FAPI.invokeUIMethod(“showMidroll”) should be invoked.

10-15 seconds await between methods’ invocations is a must.

Test application

To check how it all works you can use our test application.

You can find it by these links:

To view an ad in html application do the following:

  • press the button “prepare midroll”;
  • press the button “show midroll”.

An for mobile html app:

  • press the button “inject frame”;
  • press the button “prepare midroll”;
  • press the button “show”.


On “Statistics” page of your game you can find dedicated charts for amount of ads that were played and viewed by your users.

Keep in mind that we count a video was successfully viewed only if:

  • user viewed it for at least 10 seconds;
  • “showMidroll$ok$complete” response was returned after video was played.