From 308a0420760d960e6ce4cd88efb040becfbce9cd Mon Sep 17 00:00:00 2001 From: Timo K Date: Wed, 3 Jun 2026 10:43:26 +0200 Subject: [PATCH] fix error with no media --- src/state/CallViewModel/CallViewModel.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/state/CallViewModel/CallViewModel.ts b/src/state/CallViewModel/CallViewModel.ts index bd89c7c58..477e5f478 100644 --- a/src/state/CallViewModel/CallViewModel.ts +++ b/src/state/CallViewModel/CallViewModel.ts @@ -1195,9 +1195,11 @@ export function createCallViewModel$( .pipe( switchMap((media) => { let layout; - switch (media[0].type) { + const pipMedia = media[0]; + if (pipMedia === undefined) return of(undefined); + switch (pipMedia.type) { case "user": - layout = media[0].videoOrientation$; + layout = pipMedia.videoOrientation$; break; case "ringing": layout = of("landscape" as const); @@ -1211,6 +1213,7 @@ export function createCallViewModel$( scope.bind(), ) .subscribe((orientation) => { + if (orientation === undefined) return; logger.info("controls api pip orientation updated:", orientation); window.controls.onPipMediaOrientationUpdate?.(orientation); });