Zoom VideoSDK UI Toolkit
    Preparing search index...

    Interface PTZController

    PTZ (Pan-Tilt-Zoom) camera control interface

    Need to call joinSession before using this API

    interface PTZController {
        approveControl(userId: number): Promise<void>;
        control(
            options: { cmd: number; range?: number; userId: number },
        ): Promise<void>;
        declineControl(userId: number): Promise<void>;
        getCapability(): Promise<unknown>;
        getFarEndCapability(userId: number): Promise<unknown>;
        giveUpControl(userId: number): Promise<void>;
        isBrowserSupported(): boolean;
        requestControl(userId: number): Promise<void>;
    }
    Index

    Methods

    • Approves a camera control request from another participant

      Parameters

      • userId: number

        The user ID of the participant requesting control

      Returns Promise<void>

      Promise that resolves when the approval is processed

      await UIToolkit.ptz.approveControl(12345);
      
    • Sends a PTZ control command to a remote participant's camera

      Parameters

      • options: { cmd: number; range?: number; userId: number }

        Object containing cmd (command type), userId, and range (magnitude)

        • cmd: number

          PTZ command type (e.g., 1 for left, 2 for right, 3 for up, 4 for down, 5 for zoom in, 6 for zoom out)

        • Optionalrange?: number

          Optional magnitude of the control action (0-100)

        • userId: number

          The user ID of the participant

      Returns Promise<void>

      Promise that resolves when the command is sent

      // Pan left
      await UIToolkit.ptz.control({ cmd: 1, userId: 12345, range: 50 });

      // Zoom in
      await UIToolkit.ptz.control({ cmd: 5, userId: 12345, range: 30 });
    • Declines a camera control request from another participant

      Parameters

      • userId: number

        The user ID of the participant requesting control

      Returns Promise<void>

      Promise that resolves when the decline is processed

      await UIToolkit.ptz.declineControl(12345);
      
    • Gets the PTZ capability of the local camera

      Returns Promise<unknown>

      Promise resolving to the PTZ capability object

      const capability = await UIToolkit.ptz.getCapability();
      console.log('PTZ capabilities:', capability);
    • Gets the PTZ capability of a remote participant's camera

      Parameters

      • userId: number

        The user ID of the participant

      Returns Promise<unknown>

      Promise resolving to the PTZ capability object

      const capability = await UIToolkit.ptz.getFarEndCapability(12345);
      
    • Gives up control of a remote participant's camera

      Parameters

      • userId: number

        The user ID of the participant whose camera control to release

      Returns Promise<void>

      Promise that resolves when control is released

      await UIToolkit.ptz.giveUpControl(12345);
      
    • Checks if the browser supports PTZ camera control

      Returns boolean

      true if PTZ is supported, false otherwise

      const supported = UIToolkit.ptz.isBrowserSupported();
      if (supported) {
      console.log('PTZ camera control is supported');
      }
    • Requests control of a remote participant's camera

      Parameters

      • userId: number

        The user ID of the participant

      Returns Promise<void>

      Promise that resolves when the request is sent

      await UIToolkit.ptz.requestControl(12345);