JSFiddle - React, Tailwind, and code Playground

HTML

<button>Start</button>
<video autoplay="true">

JavaScript

navigator.getUserMedia = navigator.getUserMedia ||  
                         navigator.webkitGetUserMedia || 
                         navigator.mozGetUserMedia || 
                         navigator.msGetUserMedia;
                         
window.URL = window.URL || 
             window.webkitURL || 
             window.mozURL || 
             window.msURL;

var button = document.querySelector('button');

button.addEventListener('click', function() {
  
  navigator.getUserMedia({
      video: true
    }, 
    function(stream) {
      var src = window.URL.createObjectURL(stream),
          video = document.querySelector('video');
      video.src = src;      
    }, 
    function(e) {
      console.log(e);
    });
  
}, false);