Rumble & snapshots

Rumble — fire haptics on a GamepadDevice when the browser exposes actuators.

Snapshots — read plain-object state from the device, or call `readPads()`` when you do not need the full manager.

Rumble on GamepadDevice

When pad.hasVibration is true, the browser exposes actuators. Helpers:

MethodBehavior
vibrateSingle pulse: intensity (0–1) and duration (ms).
vibratePatternOn/off pattern in pattern: number[] (ms).
vibrateDualweak / strong motors (0–1) for duration ms.
stopVibrationCancels active effects.

Each async helper accepts an optional AbortSignal for cancellation from UI or teardown.

Real hardware varies by browser, OS, and transport (Bluetooth can lag). Check hasVibration and handle rejected promises in user-facing code.

Types and edge cases: GamepadDevice in the API reference.

Snapshots without a manager

readPads() returns PadSnap[] from navigator.getGamepads(). It does not require WebHID.

import { readPads } from "@interfaces-technology/play-u1";
// or
import { readPads, type PadSnap } from "@interfaces-technology/play-u1/hid";

Use readPads() for one-off reads or custom loops. For named inputs, gestures, and rumble, prefer createGamepadManager and GamepadDevice: Input events.

GamepadSnapshot vs PadSnap

  • GamepadSnapshot — from GamepadDevice.snapshot() / onChange: layout-resolved buttons, axes, triggers, plus metadata like id and hasVibration.
  • PadSnap — a row from readPads(); lighter-weight (see TypeDoc for fields).

WebHID

Pairing HID for permissions or vendor reports is separate from rumble: WebHID.