Hi,

Screen orientation lock is critical to a whole set of mobile games (especially 
those which rely on the accelerometer to control the gameplay). It's great that 
it is now considered for specification and implementation.

I had collected some use cases a while back[1], some of which led to 
use-cases[2], requirements[3] and suggestions[4] in the Coremob report.

While some of the original use cases required dynamically modifying orientation 
lock (e.g. the Game within a game experience[5]), key use cases simply require 
a declarative, page-wide setting, as described by David Bruant on the WHAT WG 
mailing list[6].

The current proposal[7] only targets the dynamic setting through a JS API and 
leaves the more declarative approach to other specs[8]. It mentions the Web 
Application Manifest Format and Management APIs[9] and CSS Device 
Adaptation[10].

Now, CSS Device Adaptation, as used in the Viewport META element[11] is 
ubiquitous on mobile. It seems like a natural fit for a declarative orientation 
lock, so much so that it's already specified in the spec[12].

However, the syntax to dynamically read or modify the Viewport META element is 
cumbersome and error prone (you're talking document.cookie-like string 
splitting/concatenation with unspecified separators, etc.[12]).

Instead of providing a dedicated API to cater strictly for the screen 
orientation lock use case, wouldn't it make more sense and be more consistent 
to provide a CSSOM[14] API for the whole Viewport META element, and use 
matchMedia listeners[15] instead of orientationchange events?

This would allow declarative setting through the Viewport META element, dynamic 
modification through the CSSOM API, and event handling through the matchMedia 
interface, all of which are well known and commonly used by developers.

Thanks for your time.

--tobie
---
[1]: http://tobie.github.io/ORIENTATIONLOCK-UCR/index.html
[2]: 
http://coremob.github.io/coremob-2012/FR-coremob-20130131.html#play-a-2d-game
[3]: 
http://coremob.github.io/coremob-2012/FR-coremob-20130131.html#req-orientation-lock
[4]: 
http://coremob.github.io/coremob-2012/FR-coremob-20130131.html#screen-orientation
[5]: 
http://tobie.github.io/ORIENTATIONLOCK-UCR/index.html#game-within-a-game-experience
[6]: http://lists.w3.org/Archives/Public/public-whatwg-archive/2013Apr/0078.html
[7]: https://dvcs.w3.org/hg/screen-orientation/raw-file/tip/Overview.html
[8]: 
https://dvcs.w3.org/hg/screen-orientation/raw-file/tip/Overview.html#declarative-orientation-locking
[9]: https://dvcs.w3.org/hg/app-manifest/raw-file/tip/index.html
[10]: http://dev.w3.org/csswg/css-device-adapt/
[11]: http://dev.w3.org/csswg/css-device-adapt/#viewport-meta
[12]: 
http://dev.w3.org/csswg/css-device-adapt/#the-lsquoorientationrsquo-descriptor
[13]: 
https://developer.mozilla.org/en-US/docs/Mobile/Viewport_meta_tag#Background
[14]: http://dev.w3.org/csswg/cssom/
[15]: http://dev.w3.org/csswg/cssom-view/#the-mediaquerylist-interface





Reply via email to