The Applixir Video platform provides a local callback that sends events with status of the various actions and errors that occur while a video is being played. For the local callback, the events are sent to the device on which the video player is running. These events should be used to display messages to the users and to handle the interface between the video player and your app/site.
To implement the local status callback, create a function containing handlers for each event you want to process then pass this function as the value of the parameter adStatusCb in the video player options passed to invokeApplixirVideoUnit method (or initApplixirVideoUnit, discussed later).
Refer the example shown below:
<script type="application/javascript">
function adStatusCallback(status) { // Create a status Callback Method
console.log('Ad Status: ' + status);
}
var options = { //Video Ad Options
zoneId: 2050,
userId: this.userID, UUID4 value recommended
accountId: my-accountID,
siteId: my-siteID,
adStatusCb: adStatusCallback, //Mandatory for setting up local status callback
};
invokeApplixirVideoUnit(options); // Invoke Video ad
</script>
The callback events are on the SDK’s thread so don't do anything that will block an event callback handler or the ad process may time out (e.g. don't display an alert waiting on user input). If you need to do something time-consuming based on an event, do this after the event has returned and you are back on your thread.
Following are the different status messages which are received in the call back event. Note that these events are lower-case strings.
"ad-blocker" | An ad-blocker application is detected |
network-error | network or connectivity issues |
cors-error | cross-origin resource error |
no-zoneid | the zone id is either missing or invalid |
ad-started | the ad has loaded and is starting |
ad-watched | the ad was successfully played |
ad-interrupted | The ad was ended before the skip point |
ads-unavailable | no ads were returned to the player |
sys-closing | final message before the ad window is closed |
ad-initready | video ad initiated successfully |
ad-rewarded | The reward has been validated by the RMS system |
ad-violation | The RMS system has detected a user scripting to get rewards without ad revenue |
ad-maximum | RMS tracking determined the user has received the maximum rewards in the past 24 hours |
ad-rejected | You returned an error from your RMS endpoint |