import getDesktopSourceStreamBySourceID from './getDesktopSourceStreamBySourceID' ; import Logger from '../../utils/LoggerWithFilePrefix' ; import DesktopCapturerSourceType from '../DesktopCapturerSourcesService/DesktopCapturerSourceType' ; const log = new Logger ( __filename ) ; export default async function createDesktopCapturerStream ( peerConnection , sourceID ) { try { if ( process . env . RUN_MODE === 'test' ) return ; if ( sourceID . includes ( DesktopCapturerSourceType . SCREEN ) ) { const stream = await getDesktopSourceStreamBySourceID ( sourceID , peerConnection . sourceDisplaySize ?. width , peerConnection . sourceDisplaySize ?. height , 0.5 , 1 ) ; peerConnection . localStream = stream ; } else { const stream = await getDesktopSourceStreamBySourceID ( sourceID ) ; peerConnection . localStream = stream ; } } catch ( e ) { log . error ( e ) ; } }