Giter Site home page Giter Site logo

immersive-web / webvr-polyfill-dpdb Goto Github PK

View Code? Open in Web Editor NEW
31.0 43.0 32.0 111 KB

An up-to-date Device Parameter Database for the WebVR Polyfill

Home Page: https://dpdb.webvr.rocks/dpdb.json

License: Apache License 2.0

JavaScript 100.00%
webvr polyfill

webvr-polyfill-dpdb's Introduction

webvr-polyfill-dpdb

Build Status (Travis CI) Package Info (npm)

This is a fork of the online cache of the Device Parameter Database (DPDB) for the webvr-polyfill.

Adding a Device

You'll need to update dpdb-formatted.json with your device's information in the following format:

{
  "devices": [
    {
      "type": "android",
      "rules": [
        {
          "mdmh": "asus/*/ASUS_Z00AD/*"
        },
        {
          "ua": "ASUS_Z00AD"
        }
      ],
      "dpi": [
        403,
        404.6
      ],
      "bw": 3,
      "ac": 1000
    }
  ]
}
  • type: Either "android" or "ios".
  • rules: An array of various rules that must be satisfied in order to use the configuration. See the Rules section below.
  • dpi: The DPI of the device's screen, either as a scalar value or as an array of X and Y DPI. Get this information via the Device Info App and look for Actual DPI X and Actual DPI Y values.
  • bw: The bezel width in millimeters, with many phones having between 3 or 4mm bezel widths. See the Calculating Bezel Width section below.
  • ac: The accuracy of this entry. This is not currently used in webvr-polyfill, but may in the future, and used to settle discrepencies between device reported information versus DPDB data, although this is more for Android apps that have may potentially have access to both API reporting and DPDB results. Can be one of the following values:
    • 0: measurements are speculative. Use as fallback only.
    • 500: measurements are based on the device's self-reported values, which is often inaccurate. Unless you're physically measuring a device, this is probably the value to use.
    • 1000: measurements are based on measuring a physical device.

Rules

The rules entry is an array of objects, each with one key/value pair, and matches if any of the rules match the device.

User-Agent

The ua rule is matched with the device's User-Agent string. It is not a regular expression, but just a simple substring match. Go to useragentstring.com and find something unique that looks like the device's name. Use this if device type is "android". Keep in mind of other models, where a string for the Nexus 5 could match the Nexus 5X, hence a string like "Nexus 5 " (note the extra space).

  { "ua": "ASUS_Z00AD" }

MDMH

The mdmh rule matches a device based on manufacturer, device, model, and hardware, as reported by the device's Android API. This rule is only applicable to Android devices running native apps, not the web.

  { "mdmh": "asus/*/ASUS_Z00AD/*" }

Resolution

The res rule matches a device based on its exact pixel resolution. This should normally only be used on iOS devices because there's a 1:1 mapping between exact resolution and phone model.

  { "res": [640, 960] }

Calculating Bezel Width

You can calculate the exact bezel width using this formula, where deviceWidth is in millimeters, screen is the screen's diagonal length in millimeters, and ratio is the screen resolution's width / height:

(deviceWidth - Math.sqrt((screen * screen) / (1 + (1 / (ratio * ratio))))) / 2;

Scripts

To generate the dpdb.json file from the dpdb-formatted.json source file, run this npm script from the command line:

npm run build

Or call this Node script directly:

node scripts/build.js --write

Change Log

The following devices were added (and/or corrections made):

2020-12-16

2019-11-09

2019-04-25

2019-02-19

2018-12-10

2018-10-17

2018-03-14

2018-02-07

2018-01-19

2017-10-12

2017-09-12

2017-08-27

2017-07-09

2017-06-01

2017-05-22

2017-01-19

  • Added format key to avoid 'unexpected format version' error (thanks to AdrienPoupa for spotting this oversight)

2017-01-12

2017-01-06

webvr-polyfill-dpdb's People

Contributors

andrewpitts15 avatar cvan avatar davidh64 avatar devasur avatar geoffturk avatar himorin avatar jsantell avatar juancamposlb avatar klausw avatar knee-cola avatar lcorbelino avatar marcio-ao avatar salbanese avatar sboulema avatar sidx1024 avatar thoragio avatar wildlifedeploy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

webvr-polyfill-dpdb's Issues

Account for country/region model variations

As you probably already know, some phones have different model names for countries/regions. For example the S9+ has SM-G965F (eu), SM-G965U (us) etc.

I think for this db they could be grouped together in a single entry, since the changes are not related to the screen. I know that the user agent will work if we just leave the rule as SM-G965, but my question is, can we do the same for mdmh?

Would this work?
samsung/*/SM-G965*/*

Add iPhone X (and other recent devices)

This chat message was posted in the #general channel of the WebVR Slack:

jasonmarsh [1 day ago]
I'm looking to get the webvr-polyfill device params updated to work with the latest phones. Here's what I know because it might help someone, and what I Both my app and the a-frame examples have horrible aspect ratios and eye distance on iPhone X). I fixed a few Samsung phones (SM-G930V and SM-G950U - my AT&T S8 ) by adding entries into the device params database (dpdb).

Looking here: https://dpdb.webvr.rocks/dpdb.json, I can see the following entries for iOS devices, which list the screen resolution in order to figure out which device it is:
This is the entry for iPhone 8: {"type":"ios","rules":[{"res":[1242,2208]}],"dpi":[453.6,458.4],"bw":4,"ac":1000}
The entry for iPhone X, which is missing, should be a res of 1126, 2436, with approx a dpi of 458. (I'm not sure of the source for the more precise dpi value).

Who maintains the dpdb at webvr.rocks? Can we update it with the iphoneX values, or actually do a survey of current phones and see what is missing?

Add Lenovo Phab 2 Pro data

Please add the Lenovo Phab 2 Pro. Here's the JSON that's working for me:

    {
      "type":"android",
      "rules":[
        {
          "mdmh":"LENOVO/*/Lenovo PB2-690Y/*"
        },
        {
          "ua":"Lenovo PB2-690Y"
        }
      ],
      "dpi":[
        457.2,
        454.713
      ],
      "bw":3,
      "ac":500
    }

Yes, as far as I can tell, it tells Android that it's the LENOVO Lenovo PB2-690Y.

OnePlus 5 UA detection is incorrect

The current rules for OnePlus 5 don't match the UA string found in Chrome on the OnePlus 5.

Current UA in Chrome 78, Android 9:

Mozilla/5.0 (Linux; Android 9; ONEPLUS A5000) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.62 Mobile Safari/537.36

Please add Motorola G5 Plus

{
"type": "android",
"rules": [
{
"mdmh": "motorola//G5/"
},
{
"ua": "Moto G (5) Plus"
}
],
"dpi": [
403.4,
403
],
"bw": 3,
"ac": 1000
}

Google Pixel missing

Apologies if I'm going blind but I don't see the Pixel or Pixel XL in your new definitions.

cheers

James

Issue with Galaxy S7

Hello,

First of all, thanks for creating this repo!

However, when I try to use your compiled version of Aframe (https://rawgit.com/thoragio/vr-aframe-dist/master/040/aframe-v0.4.0.min.js) with a Samsung Galaxy S7 the image is still distorded/duplicated in a cardboard, despite your additions.

http://btco-code.appspot.com/debug/screen_test.html returns

UA: Mozilla/5.0 (Linux; Android 6.0.1; SM-G935F Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.91 Mobile Safari/537.36
computed resolution: 2560 x 1440
screen.width: 640
screen.height: 360
screen.availWidth: 640
screen.availHeight: 360
window.devicePixelRatio: 4

Is there anything that can be fixed?

Thank you!

Please add SM-N920P

Please add Note5 SM-N920P :
{
"type": "android",
"rules": [
{
"mdmh": "samsung//SM-N920P/"
},
{
"ua": "SM-N920P"
}
],
"dpi": [
386.3655,
390.144
],
"bw": 3,
"ac": 1000
},

Please add entry for Samsung Galaxy S8

Here's an entry for the Galaxy S8. Could you please add it to the dpdb?

{"type":"android","rules":[{"mdmh":"samsung//SM-G950F/"},{"ua":"SM-G950F"}],"dpi":[562.707,565.293],"bw":3,"ac":500},

Samsung Galaxy S7 Edge

Current entry you provide for Samsung Galaxy S7 Edge makes my VR mode distorted. Can tell me why? Is the current entry correct? Did someone try it? #

Needs LICENSE

I'm guessing this should be Apache from webvr-polyfill, but should be clear about that, and have some patches for this repo but need an explicit license first :)

Device detection not working for Firefox Android S8

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.

Samsung variants

Having purchased dozens of Samsung phones for GearVR customers, I have personally these variants of IDs. Two of the below are S7s and the last is an S8 (AT&T version), so I created these:
{"type":"android","rules":[{"mdmh":"samsung//SM-G930A/"},{"ua":"SM-G930A"}],"dpi":576.6,"bw":3,"ac":1000},
{"type":"android","rules":[{"mdmh":"samsung//SM-G930V/"},{"ua":"SM-G930V"}],"dpi":576.6,"bw":3,"ac":1000},
{"type":"android","rules":[{"mdmh":"samsung//SM-G950U/"},{"ua":"SM-G950U"}],"dpi":[562.707,565.293],"bw":3,"ac":500},

But, Samsung generates many, many id variants which appear in the userAgent string:
Here's a list I found online:
https://forum.xda-developers.com/galaxy-s8/how-to/index-list-s8-s8-versions-t3586387

Perhaps we should query for the model without the trailing alpha character?
Such as SM-930 instead of SM-930A?

Create a helper script/web page for generating values for a new device

It'd be nice to eventually have users load a page from any mobile device, information is gathered from client-side JS, and parameters get calculated and added to the JSON file. That'd obviously involve some backend service, or generate some fancy new GitHub issue URL with query-string parameter for the user's device (ร  la https://github.com/immersive-web/webvr-polyfill-dpdb/issues/new?body=Example).

As a simpler start, it'd be nice to have a basic index.html at https://dpdb.webvr.rocks/ that could automate the process of adding a new device to the database.

A basic JS snippet would suffice. I don't want to commit to anything too grand, but helping folks crowdsource this data better really would be fantastic.

Basically, I'd like to recreate the workflow of SDL2's crowdsourced gamepad controller mappings:

Please add Fly IQ4412

{
"type": "android",
"rules": [
{
"mdmh": "Fly//IQ4412/"
},
{
"ua": "IQ4412"
}
],
"dpi": [
307.9
],
"bw": 3,
"ac": 1000
}

No DPDB device match. iPhone X, iPad Pro 2, LG V30

I tested webVR on aframe and webXR sample.

As a result, only Pixel2 works.
Other devices, iPhone X, iPad Pro 2 and LG V30, show static view.

Even though iPhone X is already registered, it does not work.

image

Here is my console.
No DPDB device match.

image

Please, check it out

Could we add support for iPhone XS Max?

I need support for iPhone XS Max. Was not able to send pull request because of authentication failure. Could anyone help to add the following? Thanks.

{
 "type": "ios",
  "rules": [
    {
      "res": [
        1242,
        2688
      ]
    }
  ],
  "dpi": 458,
  "bw": 4,
  "ac": 1000
},

Change versioning scheme

Right now this version is tracking the webvr-polyfill version 0.9.27, but this seems unsustainable, as the polyfill is now 0.9.28, and in the case where the polyfill is using the dpdb as a dependency, like it could get confusing.

I propose for simplicity, just publishing 1.0.0, and incrementing patch versions with new devices from there, and the polyfill can bump dependencies when needed.

@cvan thoughts?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.