Skip to content

Instantly share code, notes, and snippets.

@enricop89
Created February 10, 2021 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enricop89/6b69b32c4d978d59f375a9e825ea0196 to your computer and use it in GitHub Desktop.
Save enricop89/6b69b32c4d978d59f375a9e825ea0196 to your computer and use it in GitHub Desktop.
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