Created
February 10, 2021 16:39
-
-
Save enricop89/6b69b32c4d978d59f375a9e825ea0196 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let publisher; | |
const handleError = (e) => console.log(e); | |
const startScreenShareWithAudio = async () => { | |
let stream; | |
try { | |
stream = await navigator.mediaDevices.getDisplayMedia({video: true, audio: true}); | |
} catch (e) { | |
handleError(e); | |
} | |
if (stream) { | |
publisher = OT.initPublisher({ | |
videoSource: stream.getVideoTracks()[0], | |
audioSource: stream.getAudioTracks()[0] | |
}, handleError); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment