Intent to Prototype: Gamepad API Trigger-Rumble Extension

308 views
Skip to first unread message

Gabriel Brito

unread,
Jun 20, 2022, 4:21:02 PM6/20/22
to blink-dev, Steve Becker, Ben Mathwig

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

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?

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

Gabriel Brito

unread,
Mar 11, 2024, 6:18:07 PMMar 11
to blink-dev, Gabriel Brito, Steve Becker, Ben Mathwig
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 spec has already been modified  on PR #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,
      });
    }
  }
}


Reply all
Reply to author
Forward
0 new messages