fix error with no media

This commit is contained in:
Timo K
2026-06-03 10:43:26 +02:00
parent b554ce4a87
commit 308a042076

View File

@@ -1195,9 +1195,11 @@ export function createCallViewModel$(
.pipe( .pipe(
switchMap((media) => { switchMap((media) => {
let layout; let layout;
switch (media[0].type) { const pipMedia = media[0];
if (pipMedia === undefined) return of(undefined);
switch (pipMedia.type) {
case "user": case "user":
layout = media[0].videoOrientation$; layout = pipMedia.videoOrientation$;
break; break;
case "ringing": case "ringing":
layout = of("landscape" as const); layout = of("landscape" as const);
@@ -1211,6 +1213,7 @@ export function createCallViewModel$(
scope.bind(), scope.bind(),
) )
.subscribe((orientation) => { .subscribe((orientation) => {
if (orientation === undefined) return;
logger.info("controls api pip orientation updated:", orientation); logger.info("controls api pip orientation updated:", orientation);
window.controls.onPipMediaOrientationUpdate?.(orientation); window.controls.onPipMediaOrientationUpdate?.(orientation);
}); });