Skip to main content
Version: next

Camera Control

info

Added in Scrcpy v4.0

Control the device camera settings including torch (flashlight) and zoom levels.

These control messages only work when using videoSource: "camera" option.

Options​

cameraSetTorch​

Turn the camera flashlight on or off.

interface ScrcpyCameraSetTorchControlMessage {
enabled: boolean;
}
  • enabled: Whether to enable (true) or disable (false) the camera flashlight.

cameraZoomIn​

Zoom in the camera by one step.

This is an empty control message with no additional parameters.

cameraZoomOut​

Zoom out the camera by one step.

This is an empty control message with no additional parameters.

Usage​

// Using `ScrcpyControlMessageSerializer`
const torchMessage: Uint8Array = serializer.cameraSetTorch(true);
const zoomInMessage: Uint8Array = serializer.cameraZoomIn();
const zoomOutMessage: Uint8Array = serializer.cameraZoomOut();

// Using `ScrcpyControlMessageWriter`
await writer.cameraSetTorch(true);
await writer.cameraZoomIn();
await writer.cameraZoomOut();

// Using `AdbScrcpyClient`
await client.controller!.cameraSetTorch(true);
await client.controller!.cameraZoomIn();
await client.controller!.cameraZoomOut();