mirror of
https://github.com/pavlobu/deskreen.git
synced 2025-05-18 08:20:10 -07:00
24 lines
804 B
TypeScript
24 lines
804 B
TypeScript
export default function setDisplaySizeFromLocalStream(
|
|
peerConnection: PeerConnection
|
|
) {
|
|
if (
|
|
!peerConnection.localStream ||
|
|
!peerConnection.localStream.getVideoTracks()[0]
|
|
)
|
|
return;
|
|
if (!peerConnection.localStream.getVideoTracks()[0].getSettings().width)
|
|
return;
|
|
if (!peerConnection.localStream.getVideoTracks()[0].getSettings().height)
|
|
return;
|
|
peerConnection.sourceDisplaySize = {
|
|
width: peerConnection.localStream.getVideoTracks()[0].getSettings().width
|
|
? (peerConnection.localStream.getVideoTracks()[0].getSettings()
|
|
.width as number)
|
|
: 640,
|
|
height: peerConnection.localStream.getVideoTracks()[0].getSettings().height
|
|
? (peerConnection.localStream.getVideoTracks()[0].getSettings()
|
|
.height as number)
|
|
: 480,
|
|
};
|
|
}
|