var ua = navigator.userAgent; var player = videojs("MyVideo"); var options = {id:"MyVideo",adTagUrl:"http://g.adspeed.net/ad.php?do=vast&aid=944911&oid=24254&cb=1682728875"}; player.ima(options);
// Remove controls from the player on iPad to stop native controls from stealing our click var contentPlayer = document.getElementById("content_video_html5_api"); if ((ua.match(/iPad/i) || ua.match(/Android/i)) && contentPlayer.hasAttribute("controls")) { contentPlayer.removeAttribute("controls"); } // fi
// Initialize ad container when video player is clicked, but only first time var initAdDisplayContainer = function() { player.ima.initializeAdDisplayContainer(); wrapperDiv.removeEventListener(startEvent, initAdDisplayContainer); }
var startEvent = "click"; if (ua.match(/iPhone/i) || ua.match(/iPad/i) || ua.match(/Android/i)) { startEvent = "touchend"; }
var wrapperDiv = document.getElementById("MyVideo"); wrapperDiv.addEventListener(startEvent, initAdDisplayContainer);