Re: Screen Orientation Feedback

+richt@opera.com

On Wed, 6 Aug 2014, at 07:14, Jonas Sicking wrote:
> Hi All,
> 
> I think the current interaction between the screen orientation and
> device orientation specs is really unfortunate.
> 
> Any time that you use the device orientation in order to render
> something on screen, you have to do non-obvious math in order to get
> coordinates which are usable. Same thing if you want to use the device
> orientation events as input for objects which are rendered on screen.
> 
> I would argue that these are the by far most common use cases for
> 
> I agree that the main problem here is that the deviceorientation spec
> defined that their events should be relative to the device rather than
> to the screen. However we can still fix the problem by simply adding
> 
> partial interface DeviceOrientationEvent
> {
>   readonly attribute double? screenAlpha;
>   readonly attribute double? screenBeta;
>   readonly attribute double? screenGamma;
> }
> 
> No new events needs to be defined.
> 
> I guess we can argue that this should be added to the
> DeviceOrientation spec, but that seems unlikely to happen in practice
> anytime soon. I think we would do developers a disservice by blaming
> procedural issues rather than trying to solve the problem.
> 
> I think mozilla would be happy to implement such an addition to the
> DeviceOrientation event (I'm currently checking to make sure). Are
> there other UAs that have opinions (positive or negative) to such an
> addition?

Maybe this feedback should be more for DeviceOrientation than Screen
Orientation. There has been a few discussions there
(public-geolocation).

Anyway. I am not convinced that adding new properties will really fix
how developers handle this. I asked around and it seems that native
platforms do not expose Device Orientation relative to the screen. I am
not sure why we should expose something different on the Web platform. I
think we should work on providing developers the right tools in order
for them to do the right thing. For example, without the Screen
Orientation API, they do not know the relative angle between the device
natural orientation and the screen. This API is not yet widely
available. Some version of it ships in Firefox and IE but is prefixed.
It should be in Chrome Beta soon.

In addition, Tim Volodine recently suggested (in public-geolocation)
that we could add a quaternion representation of the device orientation.
If we could introduce quaternions to the platform and offer tools to do
simple math operations on them, we could narrow the complexity of going
from the device origin to the screen origin to one operation.

Finally, my understanding is that the biggest problem with
DeviceOrientation isn't that the orientation is relative to the device
instead of the screen but the rather high incompatibility. Rich Tibbett
made a great VR demo [1] using DeviceOrientation. I had the chance to
chat with him and he told me that he faced a lot of problems with angles
being very different depending on the device, and the browser. Actually,
I tried to show the demo to a colleague a few days after on an old Nexus
7 and it was completely busted.

The number one problem we should tackle with DeviceOrientation is the
interop issue. The API is currently worthless because if you write it
for one browser on one device, the chance of it working as expected on
another device or browser are fairly low. It is a shame for example that
even Chrome and Firefox running on Android do not have full
interoperability. We should start by working together toward a fully
interoperable implementation (at least for browsers running on Android).
Then we should figure out why some devices are outliers.

[1] http://richtr.github.io/threeVR/examples/vr_basic.html

-- Mounir

Received on Friday, 8 August 2014 13:44:30 UTC