Open adbakke opened 9 years ago
Here's a pen to illustrate the issue better: http://codepen.io/adbakke/pen/zGYyGM
This was tested on both Nexus 7 (2013) stock Android 5.1 using Chrome 42.0.2311.109 and a Samsung Galaxy Tab Pro 8.4 Android 4.4 (CyanogenMod 11) with Chrome 41.0.2272.96
I wanted to open an issue about this, but found that you are having the same issue that I was having. jPlayer binds to "click" events only, which is not 100% reliable on mobile devices. The solution is to move away from the default jp-play/jp-pause classes and use your own binding
$('.play-control').on('click touchstart', function(){
$('#player').jPlayer('play');
});
if you bind to click and touchstart then you will accurately capture click/touch events on the phone and desktop. Works perfectly for me now.
@johnymonster thanks heaps for this suggestion! I tried working it in and it seemed to still be a bit finicky, though it clued me in to the fact that it wasn't responding to touch events.
I looked in to touch events a bit more and found this: https://github.com/furf/jquery-ui-touch-punch/
Which fixed all my issues without having to move to my own classes for play / pause. It might be better to go with my own classes, but in this case it was speed over 'doing it right'.
I can confirm that livestream players are definitely not working in Chrome on Androids (though the jPlayer demo works just fine). In my case, a single click did nothing at all.
Chrome on my desktop originally worked fine, but implementing code as mentioned in the comment above created the error as described above, where a double-click was necessary to start the player, I expect because the play event was now bound twice. The Android phone still refused to play.
Interestingly, the player started working perfectly with the "Request desktop site" option selected.
Still FUBAR on Android.
In my experience it does work after the canplaythrough
event has fired, which takes a while. I have worked around this issue by not showing the play button to the user until then. Maybe this helps someone until the issue is solved.
Using the library jenlampton mentioned above fixed the issue for me.
Using Android having issues with play not starting after one click, it takes at least two clicks to get started. The second actually loads the file and takes a few seconds to load then plays. Typical user would not know this and not be able to play anything at all.