Skip to content

Instantly share code, notes, and snippets.

@Shadid12
Created June 30, 2019 19:37
Show Gist options
  • Save Shadid12/3aed8301b79f0751b69b94ebeca0cfeb to your computer and use it in GitHub Desktop.
Save Shadid12/3aed8301b79f0751b69b94ebeca0cfeb to your computer and use it in GitHub Desktop.
//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