> ## Documentation Index
> Fetch the complete documentation index at: https://docs.streampixel.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Input controls

> Configure mouse, keyboard, touch, gamepad, WebXR, and text input forwarding from the browser to the Unreal Engine application.

The SDK captures browser input events and forwards them to the Unreal Engine application. This page describes each input type and how to configure it.

## Video tutorial

<iframe width="100%" height="420" src="https://www.youtube.com/embed/aR49pH5gJUM" title="Toggle Mouse Visibility in Pixel Streaming" frameborder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen" allowfullscreen />

## Configuration

Enable or disable input types during initialization:

```javascript theme={"dark"}
await StreamPixelApplication({
  appId: 'your-project-id',
  mouseInput: true,
  keyBoardInput: true,
  touchInput: true,
  gamepadInput: true,
  xrInput: true,
  hoverMouse: true,
  fakeMouseWithTouches: false,
});
```

All input options default to their dashboard-configured values.

## Mouse input

When `mouseInput` is enabled, the SDK captures mouse clicks, movement, and scroll events on the video element and sends them to UE.

### Hover mouse mode

When `hoverMouse` is enabled, mouse movement events are sent to UE even when the mouse button is not pressed. This is useful for hover effects, tooltips, and cursor-driven UI in the UE application.

Toggle at runtime:

```javascript theme={"dark"}
UIControl.toggleHoveringMouse(true);   // Enable hover events
UIControl.toggleHoveringMouse(false);  // Disable hover events
```

## Keyboard input

When `keyBoardInput` is enabled, keypress and keydown events are forwarded to UE.

The SDK includes special handling for the **Backspace** key, which is explicitly sent via the `KeyPress` handler to ensure it works correctly across browsers.

### Active key release

The SDK automatically releases all active keys when:

* The browser tab loses focus (`blur` event)
* The page visibility changes (user switches to another tab)

This prevents keys from getting "stuck" in UE when the user switches away from the stream.

<Info>
  You don't need to handle key release manually. The SDK automatically releases all held keys when the user switches tabs or the window loses focus, preventing "stuck key" issues in UE.
</Info>

## Touch input

When `touchInput` is enabled, touch events on the video element are sent to UE. This enables interaction with UE applications on mobile and tablet devices.

### Fake mouse with touches

Set `fakeMouseWithTouches: true` to convert touch events into mouse events. This is useful when the UE application only handles mouse input and you want it to work on touch devices.

<Warning>
  Only enable `fakeMouseWithTouches` when your UE application does **not** handle touch input natively. If your app already processes touch events, enabling this will cause duplicate or conflicting input.
</Warning>

## Gamepad input

When `gamepadInput` is enabled, the SDK detects connected gamepads/controllers and forwards their input to UE.

## WebXR input

When `xrInput` is enabled, WebXR controller input (VR/AR headsets and controllers) is forwarded to UE.

## Text input

UE can request text input from the user by sending a `showOnScreenKeyboard` command. The SDK responds by displaying a floating text input modal (EditTextModal). When the user submits text, it's sent back to UE via the `TextboxEntry` handler.

You can also send text programmatically:

```javascript theme={"dark"}
// Send text to UE's focused text field
pixelStreaming.streamMessageController
  .toStreamerHandlers.get('TextboxEntry')?.(['Hello from the web!']);
```

## Next steps

<CardGroup cols={2}>
  <Card title="Audio and media input" href="/resources/web-sdk/features/audio-media-input">
    Configure microphone and camera streams sent to UE.
  </Card>

  <Card title="AFK (idle timeout)" href="/resources/web-sdk/features/afk-idle-timeout">
    Disconnect inactive users to free up UE instances.
  </Card>
</CardGroup>
