JSFiddle - React, Tailwind, and code Playground

by shahrukh007

HTML

<video id="myVideo"></video>
<button onclick="myfunc();">
click to start video
</button>

JavaScript

function myfunc(){
var video = document.querySelector('video'), recorder="";
           navigator.mediaDevices.getUserMedia({
               video: true,
               audio: true
           }).then(function (stream) {
               recorder = RecordRTC(stream, {
                   type: "video",
               });
               recorder.startRecording();
               video.srcObject = stream;
               video.play();
               video.muted = true;
               recorder.stream = stream;
           });
}