W3C home > Mailing lists > Public > public-webrtc-logs@w3.org > March 2021

Re: [mediacapture-image] Does PTZ look good to you? (#263)

From: louisparks-sta via GitHub <sysbot+gh@w3.org>
Date: Mon, 22 Mar 2021 14:13:40 +0000
To: public-webrtc-logs@w3.org
Message-ID: <issue_comment.created-804095035-1616422418-sysbot+gh@w3.org>
I know relative was more what we finally implemented, but let me see if we got absolute working as well.

Below is the code for UVCControl lib and that Logitech camera

this.uvcCamera = new UVCControl(1133, 2143);

ptz(action: string): void {
    switch (action) {
      case "up":
        this.ptzCommandRelative(0, 1);
        break;
      case "down":
        this.ptzCommandRelative(0, -1);
        break;
      case "left":
        this.ptzCommandRelative(1, 0);
        break;
      case "right":
        this.ptzCommandRelative(-1, 0);
        break;
      case "stop":
        this.ptzCommandRelative(0, 0);
        break;
      case "zoomIn":
        this.ptzCommandZoomRelative(1);
        break;
      case "zoomOut":
        this.ptzCommandZoomRelative(-1);
        break;
      case "zoomStop":
        this.zoomStop();
        break;

      default:
    }
  }
  ptzCommandRelative(pan: number, tilt: number): void {
    // PAN  1=left -1=right
    // TILT 1=up -1=down
    const buffer = Buffer.alloc(4);
    buffer.writeIntLE(pan, 0, 2);
    buffer.writeIntLE(tilt, 2, 2);
    this.uvcCamera.setRaw("relativePanTilt", buffer).catch(console.error);
  }

-- 
GitHub Notification of comment by louisparks-sta
Please view or discuss this issue at https://github.com/w3c/mediacapture-image/issues/263#issuecomment-804095035 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 22 March 2021 14:13:41 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 6 May 2023 21:19:53 UTC