This feature is not Baseline because it does not work in some of the most widely-used browsers.
The playEffect() method of the GamepadHapticActuator interface causes the hardware to play a specific vibration effect.
playEffect(type, params)
typeA string representing the desired effect. Possible values are "dual-rumble" and "trigger-rumble", and their effects can vary depending on the hardware type. See GamepadHapticActuator.effects for further details of the effect types.
paramsAn object to describe a desired haptic effect.
Expected values are:
duration OptionalThe duration of the effect in milliseconds. Defaults to 0.
startDelay OptionalThe delay in milliseconds before the effect is started. Defaults to 0.
strongMagnitude OptionalThe rumble intensity of the low-frequency (strong) rumble motors, normalized to the range between 0.0 and 1.0. Defaults to 0.0.
weakMagnitude OptionalThe rumble intensity of the high-frequency (weak) rumble motors, normalized to the range between 0.0 and 1.0. Defaults to 0.0.
leftTrigger (relevant to "trigger-rumble" effects only) OptionalThe rumble intensity of the bottom-left front trigger, normalized to the range between 0.0 and 1.0. Defaults to 0.0.
rightTrigger (relevant to "trigger-rumble" effects only) OptionalThe rumble intensity of the bottom-right front trigger, normalized to the range between 0.0 and 1.0. Defaults to 0.0.
Note: A new call to playEffect() overrides a previous ongoing call.
A promise that resolves with "complete" when the effect successfully completes, or "preempted" if the current effect is stopped or replaced by another effect.
The promise may reject with the following exception types:
InvalidStateError DOMException
The current document is not active or hidden.
NotSupportedError DOMException
The requested type is not supported by the current gamepad's actuator.
TypeError DOMException
The requested type is not a valid effect type.
const gamepad = navigator.getGamepads()[0];
gamepad.vibrationActuator
.playEffect("dual-rumble", {
startDelay: 0,
duration: 200,
weakMagnitude: 1.0,
strongMagnitude: 1.0,
})
.then((result) => console.log(result));
// Should log "complete" if effect successfully runs
| Specification |
|---|
| Gamepad> # dom-gamepadhapticactuator-playeffect> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
playEffect |
68 | 15 | No | 55 | 16.4 | 68 | No | 48 | No | 10.0 | 68 | No |
params_leftTrigger_parameter |
126 | 126 | No | 112 | No | 126 | No | 83 | No | 28.0 | 126 | No |
params_rightTrigger_parameter |
126 | 126 | No | 112 | No | 126 | No | 83 | No | 28.0 | 126 | No |
type_trigger-rumble |
126 | 126 | No | 112 | No | 126 | No | 83 | No | 28.0 | 126 | No |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/GamepadHapticActuator/playEffect