-
Notifications
You must be signed in to change notification settings - Fork 535
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
Stretched face on Android Chrome #292
Comments
Hi, Does the issue still occur with the latest commit? |
Unfortunately, no. In the JeelizResizer.js, in the apply_sizeCanvas function, the css width and height inside _if (isApplyCSS){ overwrites what you have in the styleFullScreen.css though. I tried removing that if but it didn't solve the issue either. On another note, the issue doesn't happen on iOS Safari. It seems to be a problem only on Android. |
I don’t have an android phone to test and indeed there is no issue with iOS. Can you try tinkering with the css to see if it solves the issue ? You can also mail me a device with the issue. |
I'm using a Samsung S8. I tried tinkering with the CSS to no avail. However here's some information that might help. The following CSS makes an HTLMVideo element fullscreen while keeping the aspect ratio (the transform scale is just to flip horizontally). It works on Android and iPhone.
I tried using the css above on the |
@xavierjs I found out what the issue is and how to fix it, but not the proper solution. The problem is the apply_sizeCanvas function and the _overSamplingFactor, which results to 4. If I hardcode 2 instead(3 also doesn't work), the webcam feed shows up properly.
So, it seems that different devices support different oversampling factors, or maybe it's just android (or even, just some Androids). If you detect that it's Android and set the oversampling factor to 2, it will solve the issue. Ideally the code should be able to figure out what is the max sampling factor the device supports though. EDIT I can see that the overSamplingFactor is set to the device's pixel ratio, which is 4 on my Android Chrome. I tried hardcoding the overSamplingFactor to 4 on my Chrome for Windows as well to see if the problem also happened (on my windows chrome the device pixel ratio is only 1.25), but the problem didn't happen. However, on my iPhone Safari the device pixel ratio is 3, and when I tried to force it to be 4, the face didn't become stretched, but the app blew up with an error and closed. So it's safe to say that 4 for the oversampling factor is not a number mobile devices like lol. I guess if you always set the oversamplingfactor to devicePixelRatio/2, it will solve the problem, although not ideal. |
Hi, Thank you for these precisions. It is really weird that it comes from the oversamplingfactor.
|
I have pushed a potential fix. It forces canvas resizing 500 milliseconds after init in JeelizResizer here: jeelizFaceFilter/helpers/JeelizResizer.js Line 262 in b133c79
Can you try it? And if it does not work increase the 500 timeout to 2000 for example and wait 2 seconds?
Thanx a lot! |
Unfortunately, it did not work. I tried with 2 seconds as well. I also made a few more discoveries. It seems that even if I set the oversampling factor to 2, I still get a small distortion on Android Chrome. However, the issue does not happen on Firefox for Android. Don't know about other browsers, but it seems that this problem is browser specific. It just looks like on some browsers the canvas attribute width/height needs to be the same as the css width/height, otherwise it distorts. Maybe there's a fix to this, but it looks like it's one of those CSS issues where it works on one browser, but doesn't on the other, and you need to find a common CSS that works across all browsers, which can be very difficult. |
Hi |
The meta tag code finally fixed the issue, without the need of this
Yes, this is true. I don't understand why it stretches either, but the meta tag solved the issue. Make sure to also test on all the iPhone browsers as well! One question, does the meta tag prevent the apply_sizeCanvas from doing its job though? So the oversampling factor won't do anything? |
It does not change the |
…pgrade third party demos list in the README
…a bit some helpers code
… and remove useless fix
If you try out this example on your Android Chrome, your face will be stretched vertically.
I already created a bug report on the threejs github, but one of the repo managers asked that the issue should be handled here instead...
The text was updated successfully, but these errors were encountered: