mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-03 03:52:50 +08:00
Fix screen share player sizing
This commit is contained in:
1 parent
13499541e0
commit
a4e54d6341
5 files changed
+86
-5
No files matched your search
@@ -10,6 +10,20 @@ interface ScreenShareResolutionOption {
|
||||
label: string;
|
||||
}
|
||||
|
||||
export function calculateScreenSharePlayerSize(
|
||||
sourceWidth: number,
|
||||
sourceHeight: number,
|
||||
maxWidth: number,
|
||||
maxHeight: number,
|
||||
): { width: number; height: number } | null {
|
||||
if (![sourceWidth, sourceHeight, maxWidth, maxHeight].every((value) => Number.isFinite(value) && value > 0)) return null;
|
||||
const scale = Math.min(maxWidth / sourceWidth, maxHeight / sourceHeight);
|
||||
return {
|
||||
width: Math.max(1, Math.floor(sourceWidth * scale)),
|
||||
height: Math.max(1, Math.floor(sourceHeight * scale)),
|
||||
};
|
||||
}
|
||||
|
||||
interface UseWebClientScreenShareOptions {
|
||||
streams: ScreenShareStream[];
|
||||
viewing: Ref<boolean>;
|
||||
|
||||
Reference in new issue
Block a user