From f5a26c5962be8f3a84132db332a573189edeeb30 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Fri, 15 Mar 2024 07:03:14 -0600 Subject: [PATCH] Add ability to zoom in to live and recordings views (#10475) * Make live view zoomable * Add zooming to full recordings --- web/package-lock.json | 14 ++++ web/package.json | 1 + web/src/components/player/HlsVideoPlayer.tsx | 87 +++++++++++--------- web/src/views/live/LiveCameraView.tsx | 25 +++--- 4 files changed, 77 insertions(+), 50 deletions(-) diff --git a/web/package-lock.json b/web/package-lock.json index 35a75663a..e3bec267b 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -52,6 +52,7 @@ "react-tracked": "^1.7.11", "react-transition-group": "^4.4.5", "react-use-websocket": "^4.7.0", + "react-zoom-pan-pinch": "^3.4.3", "recoil": "^0.7.7", "scroll-into-view-if-needed": "^3.1.0", "sonner": "^1.4.0", @@ -6694,6 +6695,19 @@ "react-dom": ">= 18.0.0" } }, + "node_modules/react-zoom-pan-pinch": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/react-zoom-pan-pinch/-/react-zoom-pan-pinch-3.4.3.tgz", + "integrity": "sha512-x5MFlfAx2D6NTpZu8OISqc2nYn4p+YEaM1p21w7S/VE1wbVzK8vRzTo9Bj1ydufa649MuP7JBRM3vvj1RftFZw==", + "engines": { + "node": ">=8", + "npm": ">=5" + }, + "peerDependencies": { + "react": "*", + "react-dom": "*" + } + }, "node_modules/read-cache": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", diff --git a/web/package.json b/web/package.json index a9ea40891..0eebdaec1 100644 --- a/web/package.json +++ b/web/package.json @@ -57,6 +57,7 @@ "react-tracked": "^1.7.11", "react-transition-group": "^4.4.5", "react-use-websocket": "^4.7.0", + "react-zoom-pan-pinch": "^3.4.3", "recoil": "^0.7.7", "scroll-into-view-if-needed": "^3.1.0", "sonner": "^1.4.0", diff --git a/web/src/components/player/HlsVideoPlayer.tsx b/web/src/components/player/HlsVideoPlayer.tsx index 0ede0ea3c..4492bae43 100644 --- a/web/src/components/player/HlsVideoPlayer.tsx +++ b/web/src/components/player/HlsVideoPlayer.tsx @@ -27,6 +27,7 @@ import { } from "react-icons/md"; import useKeyboardListener from "@/hooks/use-keyboard-listener"; import { Slider } from "../ui/slider-volume"; +import { TransformComponent, TransformWrapper } from "react-zoom-pan-pinch"; const HLS_MIME_TYPE = "application/vnd.apple.mpegurl" as const; const unsupportedErrorCodes = [ @@ -169,48 +170,54 @@ export default function HlsVideoPlayer({ } onClick={isDesktop ? undefined : () => setControls(!controls)} > -