Device Orientation

I have a proposal for exposing device orientation in the browser. It is a pretty simple api that allows you to monitor motion changes from Javascript.

For example:


navigator.orientation.watchOrientation(draw);

function draw(o) {
// o.x, o.y, o.z
}

o in function draw is a vector in three dimensional space in meters /
(seconds^2) units.

This allows you to do some revolutionary stuff on the web. This is a simple test web page that moves a ball around a web page. I am just loading this web page directly with XUL Runner on Windows Mobile Professional 6.

Device Orientation on YouTube

This only supports exists on HTC devices but i do expect other devices that have accelerometers to have implementations.

I am tracking this feature in bug 485943. Please check it out and let me know what you think.

This entry was posted in mozilla and tagged , , , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

2 Comments

  1. Chris
    Posted March 31, 2009 at 1:14 am | Permalink

    This is an acceleration function, not an orientation function. We probably need both – i.e. what direction does the device point in (like a compass), plus what acceleration is it undergoing. So I think the naming should be changed

  2. Ian M
    Posted March 31, 2009 at 1:23 am | Permalink

    The only comment I can think of is “Do it! Do it now!” :)

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>