-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mobile support issues and some solutions #975
Comments
Thank you for the detailed report! We think we've got a good idea where this is happening, but we'll need to do more testing to confirm. Could you tell us specifically what device / OS version you're using so we can try to replicate as closely as possible? Also, I was under the impression that the Android browser was removed entirely in 4.3? I ran these tests on a Samsung Galaxy S4 running Android 4.3. Keep in mind I'm not a daily Android user, so please forgive any Android n00bery on my part :)
|
Hi Matthew, I haven't tested with 4.3 yet, I'm actually waiting for my Nexus 5 with 4.4. The tests I did so far were on a Sony Xperia with Android 4.1.2 and a Sony Tablet S with Android 4.0.x. I totally get that you guys focus on supporting the latest version and don't want to waste time with the bugs and problems of older version. However, I'm planning to use videojs in production in a country where they still sell Android 4.0 handsets and in general I think it's vital for a platform to deliver cross-browser compatibility. I can easily provide you with a demo, but I'm pretty sure that the behaviour on 4.3 will be different on 4.1 (the platform I tested), the same as behaviour on 4.0 was different from 4.1. Anyway, the problem of multiple clicks happening was in Browser on Android 4.1.2. The summary of other problems across different browser also is based on tests on Android 4.1.2. Next week I plan to do all tests again on Kit Kat and will share the results. For firefox, yeah I guess results from version 4.1 are less interesting for your developments. As for Safari, I start to wonder now, if you search in Google for "safari browser android app" you can see it was in the playstore, but now has been removed so I guess it was a fake, my bad. Anyway, I will do a lot more research/testing on mobile so I just share and hopefully it helps. |
Very helpful, thanks! |
Btw, I just checked and according to the device emulator in the ADT, the default browser is still included in both Android 4.3 and 4.4. However, I guess manufacturers can and do decide to feature Chrome as the main browser. |
Nexus devices that began with the original Nexus 7 don't ship with any browser but Chrome. However, webviews on these devices are based on the "Native Android Browser". Starting with Android kitkat (4.4), webviews are based on chrome/chromium 18 (unfortunately, only 18, still better than nothing) and a lot of manufacturers are now starting to base their browsers based on chrome 18 as well. For example, the Samsung GS4's browser is based on chrome 18. Older samsung devices and other devices that have custom skins (i.e., non-nexus) probably have a custom browser based on the 'native android browser'. Also, I'm not certain whether this is a related issue, but in #992 I fixed some problems with touch events and listening to those. It may or may not address the issues you were seeing, but worth taking a look. |
Btw, here's a nice statistic on Android versions being used at the moment: http://images0.tcdn.nl/digitaal/article22270727.ece/BINARY/q/Google+Android+percentages.jpg Seems that Android 4.1 still represent1 >36% of all devices, which is quite a big chunk. |
Thanks for all of the feedback, @sangatpedas, this has been really helpful (that chart is great). We absolutely agree on the importance of backwards compatibility within reason, and the versions of Android we're talking about definitely fall in that range. The PR @gkatsev mentioned has been merged into master, so would you mind testing against a fresh build and letting us know if that helped? |
Hi @mmcc, I'd be happy to help you out here but I never made a fresh build myself yet. I kinda understand what's needed and generally how it works but maybe you can fill in the gaps for me a bit to make sure? |
I'm sorry but I'm kinda oldskool dev guy so I'm now trying to figure out github so my contributions can be more effective. So I've forked the project and will debug using the source-loader.js. I'm just wondering if there's a quick way to create a fresh dev version. |
Anyway, I made a test page using the source-loader.js and the js files in the folder src of the master branch. Please check if I'm using the right files. If so, the commits didn't solve the issue, in the default browser on Android one click still seems to generate two clicks resulting in nothing happening. This is the test page: http://video.sangatpedas.com/test-vjs-master |
Has there been any fix for this? I am using video.js in PhoneGap and it is causing all kinds of trouble with the play/pause issue. |
Hello. I am experiencing this exact issue (I think) on some Samsung devices (Tab 3 and S4). Is the recommended fix to follow sangatpedas excellent solution or have updates been published to fix this? |
@sangatpedas That demo example you showed works great for me. Does that include your fixes? I'm pretty sure the answer here is going to be yes, but any chance anyone's tried this since version 4.5 was released? All problems still present? |
@mmcc Hi Matt, I'm just picking up again on the player and will test whether the problem still exists on the latest version of videojs, I keep you posted. |
Thanks @sangatpedas! Let us know what you find. |
please share code demo for me? |
I had the same problem (video not pausing on tap on android) and in my case it was the handling of the touchevents that was the problem. i solved it by changing the 'touchend' event of the this.on('touchend', function(event) {
this.onClick();
// Stop the mouse events from also happening
event.preventDefault();
}); and also changing the
Its no elegant solution, and I guess the problem lies elsewhere, but it seems to work for me. |
Now that we've got custom controls enabled by default for all devices, can we get confirmations as to whether or not we're still seeing problems here? I expected more new issues (particularly around Android) after we enabled them, but that hasn't really happened. |
Galaxy Nexus 4.3 running Android Browser here. None of the video.js player examples work on my phone, including the homepage, the latest from git or the example @sangatpedas posted above. The player and cover appear, but no video ever plays. The player turns grey, then turns black when something times out. |
@mmcc The multiple click issue with video player controls is still reproducible at least with default Android Browser on Samsung Galaxy S3 4.3. Also can be reproduced on Video.js landing page. When using native controls everything works correctly. Based on our Google analytics on one of our sites default Android browser is still as popular as Chrome browser so it would be nice to get this fixed. |
I assume double click issue could be also prevented by the ghost click busting method explained in this Google's article https://developers.google.com/mobile/articles/fast_buttons#ghost We actually used that method to stop these double clicks in one webview based app we made. |
I'm also having exactly same issue on Galaxy S3.. Video.js landing page video won't play at all on the S3 and my video player on my page is very intermittent. I get it to play by button mashing. Any single click to play just pauses itself again. |
I also can confirm that video.js is totally broken on Android 4.3 Default Browser (Galaxy Nexus). I also cannot play video on official site homepage, but I made local version of player and it starts to play (somehow through fullscreen), but video.js controls do not correctly -- always ghost/double click per one touch. It's very surprising for me to see such bug. |
https://github.com/videojs/video.js/blob/master/src/js/component.js#L1087 Quick fix might look like this: this.on('touchstart', function() {
//...
this.touchClickProcessed = false;
this.preventNativeClick = false;
//...
});
this.on('touchend', function() {
//...
if (allConditionsMeetAndLetThisClickHappen) {
//...
this.touchClickProcessed = true;
//...
} else if (doNotWantSimulatedTouchButAlsoDoNotWantRealClick) {
this.preventNativeClick = true;
}
});
this.on('click', function(e) {
var ignoreClick = this.touchClickProcessed || this.preventNativeClick;
this.touchClickProcessed = false;
this.preventNativeClick = false;
if (ignoreClick) {
e.preventDefault();
return;
}
//...
}); |
On my Samsung Galaxy Tab GT-P5200 I get a black background instead of a video. It plays fine without videojs? |
I upgraded and then immediately rolled back, many many issues with this version. When using poster image you don't see the video play, just hear the sound. And I had some other issues. |
@sangatpedas "And I had some other issues" isn't very helpful at all. Mind expanding on that? Even better, check and see if someone else has reported them, and if not, open a new one. We can't fix things we don't know about! |
@mmcc Sorry mate but I was testing this in a production environment and as soon as I saw video wasn't showing I rolled back and kinda didn't care so much about the other problems. As far as I can remember the multiple click issue wasn't solved yet as well so I applied (a slightly modified) version of the code I posted initially in this thread. But like I said, at that moment I didn't bother to test a player that doesn't (consistently) show video. Anyway, didn't mean to be negative, me and all others appreciate what you guys are doing. If i have some time later I will do some checks and let you know. |
Totally understandable! The core contributors just have a (relatively) limited device-set we can test on locally, so it's really helpful when we can get solid issue reports from the rest of the device world. |
Hi Matthew, Here are two things I encountered and our dev team will look into the reasons why it occurs. Here's the demo page of the latest videojs version and when you cut the query in the url it will revert to an older version of videojs. http://lv8.tv/the-salvation-official-us-release-trailer-1-2015-mads-mikkelsen-eva-green-movie-hd-12x6ony0l5cy.html?v=4.11.4 The older version works fine, the new version has some (major) issues but I suspect it might also be in our css or in one of the plugins.
I don't see these problems on the videojs site so I guess css and plugins that worked with older versions are not compatible anymore with the latest version. As said, we're looking into the cause and will update you later. |
Hi Matthew, An update from my side after testing V4.11.4:
So in my opinion this thread can be closed as the problems originally reported now have been solved. Thanks! |
Hi guys I have tested our video player on Android 4.3 default browser on a Galaxy nexus and a Galaxy s3 and the onClick function still gets called several times. It is no longer the same event type but now, 'tab' and 'click, events get raised one after the other. We have done our tests against version 4.11.4 and 4.12.5 of videoJs. The only solution I could find was to debounce the the calls to onclick I have done a plugin to fix this issue (es5 forEach polyfill required)
I could do a PR to debounce the calls to onClick although, it seems a bit hacky. |
@sangatpedas great to hear the issues have been fixed for you! @carpasse that does feel a bit hacky, and could potentially lead to other bugs. If a touch event and a click event are both firing, it sounds like a preventDefault isn't getting called somewhere we need it to. Either that or Android ignores preventDefault and still fires both. Either way it'd be great to have a full understanding why that's happening before we patch it. |
@heff I completely agree we need to investigate this better. |
in v5, we default to native controls in the native android browser (#2499) which I believe closes this issue. |
Hi guys,
I've been focussing on mobile support for videojs on the most popular Android browsers and find the following issues and some solutions. Mainly this is about support for the videojs controls.
First, in Chrome on Android all seems to work as expected.
The most problems occur with the default Android browser on Jelly Bean, ICS seems to be ok. Basically in the current version the controls of the standard browser in Jelly Bean don't work at all. The reason for this is that Browser generates multiple clicks. So for instance when the play button is clicked it calls the process twice, resulting in a play request followed immediately by a pause request, resulting in nothing really happening. The same goes for all other buttons in the control bar.
I'm sure my solutions won't meet the required quality of the project but I give them anyway so they can be used as temporary work-around by others. This is done by editing the dev version.
First I've defined more booleans so I better know what browser I deal with:
Next, I define an execution time out based on browser/platform:
Now basically all onclick function are rewritten like this:
On the fullscreen toggle button more changes are required. Since Safari uses native controls in fullscreen mode, any request from the toggle button is always a request for fullscreen. And since returning from fullscreen with native controls doesn't change the values of the button or the var isFullScreen, no need to change them in the first place.
As for the volume slider, I don't see much use for it unless one is a midget with extremely small fingers.
Then there's a problem (in my opinion) once a player is paused. Most mobile browser show a play button in the middle but since vjs.MediaTechController.prototype.onTap only triggers user activity. Since Chrome and Opera show a big native play button I made the following changes:
After having done these changes the following issues remain for Android:
Firefox:
fullscreen doesn't work, remote debugging shows the fullscreen request is ignored due to too many iterations. This corresponds with a test I did with an external button that requests a full change, which works.
Returning from fullscreen changes zoom mode, player is slightly bigger as if double clicked.
Safari (so the official Safari release on Android)
Any fullscreen requests is ignored and stops the video entirely from playing
Opera
First play always switches to fullscreen
returning from fullscreen the native controls show again, even the boolean is set to false.
Thanks for all the work you guys put in and I hope this helps a bit and obviously I hope you guys can help with some of the remaining issues.
Remco
The text was updated successfully, but these errors were encountered: