Created
June 10, 2020 07:50
-
-
Save enricop89/5d64bc0e954eeb80b39e1d0a48956744 to your computer and use it in GitHub Desktop.
getDiplayMedia with audio constraint
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