Created
June 30, 2019 19:37
-
-
Save Shadid12/3aed8301b79f0751b69b94ebeca0cfeb 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
//public/index.js | |
... | |
pc.onaddstream = function (obj) { | |
var vid = document.createElement('video'); | |
vid.setAttribute('class', 'video-small'); | |
vid.setAttribute('autoplay', 'autoplay'); | |
vid.setAttribute('id', 'video-small'); | |
document.getElementById('users-container').appendChild(vid); | |
vid.srcObject = obj.stream; | |
} | |
navigator.getUserMedia({video: true, audio: true}, function (stream) { | |
var video = document.querySelector('video'); | |
video.srcObject = stream; | |
pc.addStream(stream); | |
}, error); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment