Video Interstitial - tapdaq/cordova-plugin GitHub Wiki
Video interstitial are full-screen visuals that appear inside your application.
To load an video, first create the following load callback object:
const loadOpts = {
didLoad: function(response) {
// video is loaded
},
didFailToLoad: function(error, response) {
// video failed to load
}
};Once that is done, you can call the load method on the Tapdaq interface, passing in the placement tag you with to load an ad for, and the callback object you just created, like so:
Tapdaq.loadVideo("my_video_tag", loadOpts);To display the video we recommend using the didLoad callback. Implement the following code inside your didLoad callback function:
const showOpts = {
willDisplay: function(response) {
},
didDisplay: function(response) {
},
didFailToDisplay: function(error, response) {
},
didClick: function(response) {
},
didClose: function(response) {
}
};
const loadOpts = {
didLoad: function(response) {
Tapdaq.showVideo("my_video_tag");
},
didFailToLoad: function(error, response) {
// video failed to load
}
};It is also possible to check the video is loaded before displaying it to the user, as shown below:
if (Tapdaq.isVideoReady("my_video_tag", function(ready) {
if (ready) {
Tapdaq.showVideo("my_video_tag", showOpts);
}
}))Build your application to iOS and Android, then run your application to test the ad displays correctly.
If you wish to load another video after you have shown one, implement the didClose callback, then pass in the callback object when showing an ad, like so:
const showOpts = {
didClose: function(response) {
Tapdaq.loadVideo("my_video_tag", loadOpts);
}
};
Tapdaq.showVideo("my_video_tag", showOpts);If you are having any problems integrating, feel free to contact us on [email protected] and we will be more than happy to help.
Now that you have successfully integrated an interstitial into your app, what would you like to do next?