FAPI.invokeUIMethod("prepareMidroll")

Example

/*
* Starts a video ad preparation for an in-game show
*/
function prepareMidroll() {
    FAPI.invokeUIMethod("prepareMidroll");
}

Result

As a result data parameter is passed with following value:

data: "prepareMidroll$ok$ready"

Possible results:

  • ok:ready - video is found and is ready to be shown;
  • error:{errorReason} - an error occured while picking video to show.

Possible errors:

  • empty - no video was found for current user;
  • disabled - video ads are disabled for user or app. This will happen if user is an app payer.

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”.

Statistics

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.