immersive-web / webvr-polyfill-dpdb

An up-to-date Device Parameter Database for the WebVR Polyfill
https://dpdb.webvr.rocks/dpdb.json
Apache License 2.0
31 stars 32 forks source link

Device detection not working for Firefox Android S8 #38

Open danrossi opened 6 years ago

danrossi commented 6 years ago

useragent string is

Mozilla/5.0 (Android 7.0; Mobile; rv:59.0) Gecko/59.0 Firefox/59.0
html:60:1
user agent Mozilla/5.0 (Android 7.0; Mobile; rv:59.0) Gecko/59.0 Firefox/59.0

In Chrome / Samsung Internet

Mozilla/5.0 (Linux; Android 7.0; SAMSUNG SM-G950F Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/6.4 Chrome/56.0.2924.87 Mobile Safari/537.36

SM-G950F is missing. therefore no device data gets detected.

jsantell commented 6 years ago

I see the device information stripped from my Pixel as well on Firefox 59. Has there been a change in UA strings in Firefox? @cvan

danrossi commented 6 years ago

@jsantell FYI. I don't know what to say about this. They have removed the device name on purpose to sabotage. From what I gather this will make the browser more secure from spoofing ???

https://bugzilla.mozilla.org/show_bug.cgi?id=1448649#c3

jsantell commented 6 years ago

There's value in changing the user agent for privacy for sure; this might cause issues rendering WebVR experiences with the polyfill however.

A-Frame folks, have you noticed any issues in Firefox with the UA change? @dmarcos @ngokevin

kbrosnan commented 6 years ago

Firefox for Android has never had the device name in the UA.

danrossi commented 6 years ago

According to a commit ticket it did. It's falling back to a default setting. I'll try and work around it.

jsantell commented 6 years ago

Huh, maybe the default device has been close enough for me on Firefox. @danrossi is the distortion incredibly off, or is it just seeing the console error?

danrossi commented 6 years ago

I'm not too sure what is going on. But for me the entire cardboard display is not resizing correctly when going fullscreen. It's fine on Chrome / Samsung Internet. Maybe it's another issue altogether.

I found some possible methods to detect dpi ?

https://stackoverflow.com/questions/279749/detecting-the-system-dpi-ppi-from-js-css https://jsfiddle.net/pgLo6273/2/

function findFirstPositive(b, a, i, c) {
  c=(d,e)=>e>=d?(a=d+(e-d)/2,0<b(a)&&(a==d||0>=b(a-1))?a:0>=b(a)?c(a+1,e):c(d,a-1)):-1
  for (i = 1; 0 >= b(i);) i *= 2
  return c(i / 2, i)|0
}

var dpi = findFirstPositive(x => matchMedia(`(max-resolution: ${x}dpi)`).matches)
danrossi commented 6 years ago

Please close this if its not fixable. My fullscreen bug, was not device detection but because of some patched polyfill causing fullscreen events on the element not working. It needed it on the document.