I'm trying to implement displaying video ads using video.js
and google's IMA plugin [videojs-ima][1]
In the example code there is following part:
// Initialize the ad container when the video player is clicked, but only the
// first time it's clicked.
var startEvent = 'click';
if (navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/Android/i)) {
startEvent = 'tap';
}
but when the startEvent
is set to tap
on mobile devices I get following errors:
Uncaught TypeError: document.createTouch is not a function(anonymous function) @ ima3.js:252Ha @ ima3.js:9zm @ ima3.js:252h.Ld @ ima3.js:253Ze @ ima3.js:68h.dispatchEvent @ ima3.js:66im.w @ ima3.js:243We @ ima3.js:63Se @ ima3.js:64(anonymous function) @ ima3.js:62
ima3.js:252
Uncaught TypeError: Cannot read property 'apply' of undefined
When I comment out the line with startEvent = 'tap'
I don't get these errors anymore, but some functionalities of video.js
player are not working, i.e. I cannot pause video by clicking on the video area (I need to click on pause button, and that is hard on mobile devices).
How can I get this "tap" events working properly on mobile devices?