Camera PTZ Control Comes to the Web

Room-scale video conferencing setups have long relied on cameras with pan, tilt, and zoom (PTZ) hardware capabilities to keep participants framed. As of Chrome 87, websites can now control those functions natively through media track constraints in MediaDevices.getUserMedia() and MediaStreamTrack.applyConstraints().

Detection and Permission Model

Feature detection for hardware PTZ works differently than typical browser feature detection. Checking for "pan", "tilt", and "zoom" in navigator.mediaDevices.getSupportedConstraints() only confirms the browser supports the API—not that the connected camera hardware does. In Chrome 87, PTZ control is available on desktop, while Android currently supports zoom only.

Websites can only manipulate camera PTZ after the user explicitly grants PTZ permission through a prompt. Request it by calling navigator.mediaDevices.getUserMedia() with PTZ constraints. This triggers prompts for both regular camera access and camera-with-PTZ permission. If the hardware lacks PTZ support, the user sees only the standard camera prompt.

One subtlety: a previously granted camera permission without PTZ access does not automatically upgrade when PTZ becomes available—even if the hardware supports it. The permission must be requested again. The Permissions API can be used to query and monitor PTZ permission status.

For Chromium-based browsers, the internal about://media-internals page can verify hardware support. The "Video Capture" tab's "Pan-Tilt-Zoom" column shows "pan tilt" and "zoom" when the camera supports the "PanTilt (Absolute)" and "Zoom (Absolute)" UVC controls. Relative UVC controls are not supported in Chromium browsers.

Controlling PTZ

PTZ capabilities and settings are manipulated through the MediaStreamTrack from the granted stream. mediaStreamTrack.getCapabilities() returns a dictionary of supported capabilities with ranges or allowed values, and MediaStreamTrack.getSettings() reports the current settings. These are only available when the camera hardware supports PTZ and the user has granted PTZ permission.

js const [videoTrack] = stream.getVideoTracks(); const capabilities = videoTrack.getCapabilities(); const settings = videoTrack.getSettings();

Call videoTrack.applyConstraints() with the appropriate PTZ advanced constraints to adjust the camera. The returned promise resolves on success, and rejects if the user has not granted PTZ permission, the hardware does not support the requested constraint, or the page is not visible. Use the Page Visibility API to detect when the page is hidden.

PTZ can also be configured directly in MediaDevices.getUserMedia() using ideal constraint values, which is convenient when the camera's PTZ capabilities are known in advance. Mandatory constraints such as min, max, and exact are not permitted in this context.

Hardware PTZ capabilities are accessible via MediaDevices.getSupportedConstraints() for browser-level detection, and through the media track's capabilities and settings for individual camera hardware. The API is gated by the same permission model as the broader Media Capture and Streams API, and PTZ control is only possible while the page is visible to the user.

Specification authors have prioritized user control, transparency, and ergonomics in the design of this API. The core constraint of visible-page-only operation ensures the user is always aware of active PTZ adjustments.