Utilize the power of Android WebView instead of relying solely on the HTML Window
The dimensions of the Html Window during JavaScript execution are set to 320x240 or a suitable size
If you are unable to access the size of your WebView directly, delay the execution of relevant JavaScript until after the HTML Window has been resized
An illustration of code for loading SDK video overlay, using the HTML Window
if (!isAndroid() || isAndroidAndResized()) {
this.translateRelativePosition(params);
loadVideo(params.id, params.url, params);
} else {
var relativePosition = {left: params.left, top: params.top};
var offScreenPosition = {
left: params.left - params.width - 2000,
top: params.top - params.height - 2000
}; // preload video without displaying splash overlay at (0, 0)
params.left = offScreenPosition.left;
params.top = offScreenPosition.top;
loadVideo(params.id, params.url, params);
var positionCachedVideo = function () {
if (isAndroidAndResized() || Ad.width === 320 && Ad.height === 240) {
params.left = relativePosition.left;
params.top = relativePosition.top;
this.translateRelativePosition(params); // use container's absolute position + video's relative position (for device overlay)
playVideo(params.id, params);
} // ensure that the WebView is not set to 320x240 unless Ad dimensions are also 320x240
}.bind(this);
if (this.getWidth() !== 320 || this.getHeight() !== 240) {
targetHtmlWindow.addEventListener('resize', positionCachedVideo);
} else {
setTimeout(positionCachedVideo, 50);
}
}