W3C home > Mailing lists > Public > public-device-apis@w3.org > January 2016

Re: [vibration] Returning false if vibration hardware is not present?

From: Frederick Hirsch <w3c@fjhirsch.com>
Date: Tue, 19 Jan 2016 15:36:18 -0500
Cc: public-device-apis@w3.org
Message-Id: <FBF1F0D7-942F-4FF7-84E4-662A97757993@fjhirsch.com>
To: Philip Rogers <pdr@chromium.org>
Philip

In the Recommendation ( https://www.w3.org/TR/2015/REC-vibration-20150210/#vibration-interface ) do not the following steps in the Vibration recommendation address the need to return false if the vibration hardware is not present?

[[

To perform vibration using pattern, run these steps:

1 An implementation may return false and terminate these steps.

(NOTE
For example, an implementation might abort the algorithm because the user has set a preference indicating that pages at a given origin should never be able to vibrate the device, or an implementation might cap the total amount of time a page may cause the device to vibrate and reject requests in excess of this limit.)

]]

I believe the MAY allows the implementation to return false as you desire, even though that is not outlined in the note...


regards, Frederick

Frederick Hirsch
Chair, W3C Device APIs WG (DAP)

www.fjhirsch.com
@fjhirsch



> On Jan 19, 2016, at 3:11 PM, Philip Rogers <pdr@chromium.org> wrote:
> 
> The vibration api is currently spec'd to return false from vibrate(...) if the page is not visible or (optionally) if the user has disabled vibration. Can the spec be amended to return false if vibration hardware is not present too?
> 
> Some mobile devices such as the Nexus 7 do not have hardware support for vibration. I'd like to provide feedback to users when their hardware doesn't support vibration. There is an Android API for accessing this: Vibration.hasVibrator(), though I couldn't find an API on iOS.
> 
> Ideally we would return a promise but that change is probably not web compatible. Another option is to add something like hasVibrator(). Because false is already returned for a variety of cases where vibration is not possible, I think it makes sense to also return false when hardware support prevents vibration.
Received on Tuesday, 19 January 2016 20:36:52 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 14:54:07 UTC