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); } }