export function getScreen ( ) { return new Promise < MediaStream > ( resolve => { const nav = navigator . mediaDevices as any ; nav . getUserMedia ( { audio : { mandatory : { chromeMediaSource : "desktop" } } , video : { mandatory : { chromeMediaSource : "desktop" } } } ) . then ( ( stream ) => { resolve ( stream ) ; } ) . catch ( ( ) => { nav . getUserMedia ( { video : { mandatory : { chromeMediaSource : "desktop" } } } ) . then ( ( stream ) => { resolve ( stream ) ; } ) ; } ) ; } ) ; }