From 54145d5d1f4f8175659c04ffd9936c5004d58ad7 Mon Sep 17 00:00:00 2001 From: Jose Luis Pereira Date: Thu, 4 Sep 2025 11:40:45 +0100 Subject: [PATCH] Recompute rects with loadeddata to set videoRect correctly on iOS --- custom_components/webrtc/www/digital-ptz.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/custom_components/webrtc/www/digital-ptz.js b/custom_components/webrtc/www/digital-ptz.js index 684bcce..54162a5 100644 --- a/custom_components/webrtc/www/digital-ptz.js +++ b/custom_components/webrtc/www/digital-ptz.js @@ -52,6 +52,7 @@ export class DigitalPTZ { if (o.touch_drag_pan) h.push(startTouchDragPan(gestureParam)); if (o.touch_pinch_zoom) h.push(startTouchPinchZoom(gestureParam)); this.videoEl.addEventListener("loadedmetadata", this.recomputeRects); + this.videoEl.addEventListener("loadeddata", this.recomputeRects); this.resizeObserver = new ResizeObserver(this.recomputeRects); this.resizeObserver.observe(this.containerEl); this.recomputeRects(); @@ -59,6 +60,7 @@ export class DigitalPTZ { destroy() { for (const off of this.offHandles) off(); this.videoEl.removeEventListener("loadedmetadata", this.recomputeRects); + this.videoEl.removeEventListener("loadeddata", this.recomputeRects); this.resizeObserver.unobserve(this.containerEl); } }