The proposal has been modified to have an `effects` array instead of the 
`canPlay()`, because it reduces the number of potential `canPlay()` calls. 
The GamepadHapticActuator API 
<https://w3c.github.io/gamepad/#gamepadhapticactuator-interface> spec has 
already been modified  on PR #190 <https://github.com/w3c/gamepad/pull/190> 
to adopt `effects` and remove `canPlayEffectType()`. Given this, 
`canPlay()` will be removed from Chromium in M124. Callers are expected to 
check the `GamepadHapticActuator.effects` array for supported haptic 
effects, as in:

let gamepads = navigator.getGamepads();
if (gamepads.length > 0) {
  let gamepad = gamepads[0];
  if (gamepad.vibrationActuator) {
    if (gamepad.vibrationActuator.effects && 
gamepad.vibrationActuator.effects.includes("trigger-rumble")) {
      gamepad.vibrationActuator.playEffect("trigger-rumble", {
        duration: 1000,
        leftTrigger: 0.5,
        rightTrigger: 1.0,
      });
    } else {
      gamepad.vibrationActuator.playEffect("dual-rumble", {
        duration: 1000,
        strongMagnitude: 0.5,
        weakMagnitude: 1.0,
      });
    }
  }
}


On Monday, June 20, 2022 at 1:21:02 PM UTC-7 Gabriel Brito wrote:

> Contact emails 
>
> gabrie...@microsoft.com
>
> Explainer 
>
>
> https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/GamepadHapticsActuatorTriggerRumble/explainer.md
>
> Summary 
>
> Extend the GamepadHapticActuator interface to expose the trigger-rumble 
> capability in the Web for compatible gamepads. This extension will allow 
> web applications that take advantage of the Gamepad API to access a wider 
> set of haptic feedback options and provide their users with a richer and 
> more engaging experience on the Web.
>
>
>
> Blink component 
>
> Blink>GamepadAPI 
> <https://bugs.chromium.org/p/chromium/issues/list?q=component:Blink%3EGamepadAPI>
>
> Motivation 
>
> Xbox-compatible gamepads like the Microsoft Xbox Wireless Controller and 
> Razer Wolverine Ultimate come equipped with "impulse triggers" which 
> provide haptic feedback localized to the triggers. While the Gamepad 
> Haptics Extension proposal already provides support for haptic effects that 
> vibrate the whole gamepad, it does not expose an interface for issuing 
> "impulse trigger" effects.
>
>
>
> Risks 
>
>
>
> Interoperability and Compatibility 
>
>
> *Gecko*: No signal
>
> *WebKit*: No signal
>
> *Web developers*: No signals
>
> *Other signals*:
>
> WebView application risks This change does not pose any risk to Android 
> WebView-based applications.
>
> Is this feature fully tested by web-platform-tests 
> <https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md>
> ? 
>
> No
>
> Flag name 
>
> chrome://flags/#enable-windows-gaming-input-data-fetcher
>
> Requires code in //chrome? 
>
> False
>
> Tracking bug 
>
> https://bugs.chromium.org/p/chromium/issues/detail?id=1316534
>
> Launch bug 
>
> https://crbug.com/1316536
>
> Estimated milestones 
>
> M105
>
>
>
> Link to entry on the Chrome Platform Status 
>
> https://chromestatus.com/feature/5162940951953408
>

-- 
You received this message because you are subscribed to the Google Groups 
"blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to blink-dev+unsubscr...@chromium.org.
To view this discussion on the web visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/427661a2-80fe-443c-9dab-482792311965n%40chromium.org.

Reply via email to