ably / giveitalob

A fun realtime demo - see how high you can throw your phone
1 stars 3 forks source link

Accelerometer detection is not working in modern browsers #21

Open mattheworiordan opened 2 years ago

mattheworiordan commented 2 years ago

IMG_2D5E764AB157-1

Nosfheratu commented 2 years ago

@mattheworiordan researching about how to fix this issue, i found that motion sensors are not supported in mobile browsers, at least in iOS devices (which is the phone and old iPad I have atm). However there are some dependencies that need to be updated or upgraded, pg lib (postgres) in specific is giving compatibility issues in this project setup, found several useless demos that throw the same errors when I tried to use the motion sensors, take look

Example of orientation sensor in Chrome for iOS

IMG_5238

Example of orientation sensor in Safari for iOS

IMG_5237

Example of accelerator sensor in Chrome for iOS

IMG_5234

mattheworiordan commented 2 years ago

Oh, looks like that API is being limited by some browsers now. See https://caniuse.com/?search=accel

Is DeviceMotion supported?

Nosfheratu commented 2 years ago

this is the current state of DeviceMotion events

Partial support refers to the lack of compassneedscalibration event. Partial support also refers to the lack of devicemotion event support for Chrome 30- and Opera. Opera Mobile 14 lost the ondevicemotion event support. Firefox 3.6, 4 and 5 support the non-standard [MozOrientation](https://developer.mozilla.org/en/DOM/MozOrientation) event.

WebKit status: [Supported](https://webkit.org/status.html#specification-deviceorientation-events)

* compassneedscalibration supported in IE11 only for compatible devices with Windows 8.1+.

https://caniuse.com/?search=devicemotion

mattheworiordan commented 2 years ago

this is the current state of DeviceMotion events

Ok, so could work?

Nosfheratu commented 2 years ago

this is the current state of DeviceMotion events

Ok, so could work?

@mattheworiordan it could, but I need to test and verify the behavior

Also, I need access to make push to this repo, I tried to push a branch with the new pg gem upgrade but it says i dont have enough permisssion to do that

mattheworiordan commented 2 years ago

@Nosfheratu I have given you access. But please ask the dev team in future if you're blocked.

Keep me posted on your test & verify.

Nosfheratu commented 2 years ago

@Nosfheratu I have given you access. But please ask the dev team in future if you're blocked.

Keep me posted on your test & verify.

will do, sorry the delay of the response we had energy outage all day and and I was not able to work today, will keep you posted with my progress

mattheworiordan commented 2 years ago

What's the latest?

Nosfheratu commented 2 years ago

What's the latest?

I will need a little bit time on this, the project setup is a little bit harder since there are some dependencies that I am struggling to resolve them, such as the older npm engin

annamariyaivanova commented 2 years ago

Asked Bruce for some help in case he knows and that's what I got. Maybe give a shot checking the source code? link is below.

Screenshot 2022-06-28 at 18 35 04

link- https://github.com/CrowdHailer/lob

Nosfheratu commented 2 years ago

@annamariyaivanova yes, I got the same error when I tried to setup the project dependencies

Screen Shot 2022-06-29 at 3 02 14

probably the problem there is due to all references of project the dependencies in the npm packages file are outdated

cc @fliptopbox