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.