Merge pull request #4004 from element-hq/toger5/controls-api-onPipMediaOrientation

Controls api `onPipMediaOrientation`
This commit is contained in:
Timo
2026-06-12 16:03:35 +08:00
committed by GitHub
6 changed files with 79 additions and 6 deletions

View File

@@ -1199,6 +1199,33 @@ export function createCallViewModel$(
})),
);
spotlight$
.pipe(
switchMap((media) => {
let layout;
const pipMedia = media[0];
if (pipMedia === undefined) return of(undefined);
switch (pipMedia.type) {
case "user":
layout = pipMedia.videoOrientation$;
break;
case "ringing":
layout = of("landscape" as const);
break;
case "screen share":
layout = of("landscape" as const);
break;
}
return layout;
}),
scope.bind(),
)
.subscribe((orientation) => {
if (orientation === undefined) return;
logger.info("controls api pip orientation updated:", orientation);
window.controls.onPipMediaOrientationUpdate?.(orientation);
});
/**
* The media to be used to produce a layout.
*/