w3c / deviceorientation

W3C Device Orientation spec
https://www.w3.org/TR/orientation-event/
Other
49 stars 32 forks source link

How reliable is interval? #185

Open marcoscaceres opened 1 month ago

marcoscaceres commented 1 month ago

The interval attribute assumes that the user agent will fire the event, which doesn't make much sense because the user agent could fire as little or as often as it wants (based on a significant change of motion) and other environmental conditions.

Couldn't the interval between events be more accurately been gleamed from comparing the .timeStamp between two events?

reillyeon commented 1 month ago

I've always interpreted interval as a promise to fire the event at a particular implementation-defined rate. That is, timestamp tells you when the event was generated and interval tells you when to expect the next one. This is important for motion events because they represent rates of change.

Note that devicemotion events are fired at a fixed interval while deviceorientation events (which represent a position rather than a change in position) fire whenever there is significant change.

marcoscaceres commented 1 month ago

Ok, yeah, that makes sense. I haven't check, but it would be interesting to see how reliable interval is and it changes in any way.

marcoscaceres commented 1 month ago

I guess I'm also wondering if it does change, then why does it change... for instance, if it changes because of battery or anything else (e.g., the phone gets plugged in), it might be a privacy leak.

reillyeon commented 1 month ago

In Chromium at least it is hard-coded to 16ms.