videojs / video.js

Video.js - open source HTML5 video player
https://videojs.com
Other
38.12k stars 7.46k forks source link

Player no longer fires "tap" event on Android #2958

Open shawnbuso opened 8 years ago

shawnbuso commented 8 years ago

I just upgraded my IMA plugin to vjs 5.3, and I've noticed that the player no longer fires the tap event on Android. We're using that to detect the user tapping the player to initialize ad requests here. Our SDK requires a user action to initialize, so we need to be able to respond to that tap. Reverting to 4.12 (the most recent version we supported before 5.3) brings back the tap event. We are still seeing the click event on desktop, just no tap on mobile.

nonth commented 8 years ago

Hi @shawnbuso I've using videojs 5.5 with videojs-ima and got the same issue on both iOS and Android. Any update on this issue ?

gkatsev commented 8 years ago

I've just tested it locally and cannot reproduce with a newer version of videojs. Can you give more background on what browser is used exactly? Preferably with a specific reduced test case where it is happening?

nonth commented 8 years ago

Hi @gkatsev Which version of videojs you're using ?

Detail about browser

Example http://nonth.net/videojs-ima/ It's work fine on desktop browser you'll see pre-roll ads at beginning of the video but if you open the url from mobile device it doesn't show pre-roll ads.

Code from ads.js line 48, on mobile device we detect the 'tap' event on player to initialize the ad container and request ads.

// 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';
}

player.one(startEvent, function() {
    player.ima.initializeAdDisplayContainer();
    player.ima.requestAds();
    player.play();
});
kieste commented 8 years ago

Same problem here on iPad using Video JS 5.8.3

shawnbuso commented 8 years ago

Any update on a fix or workaround here? A lot of our users are blocked on this.

ntamblyn commented 8 years ago

i have swapped out tap for

startEvent = 'touchstart';

Seems to work for me.