JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<video id="videoLocal" width=100 height=50 autoplay playsinline controls style="border: 2px solid blue;"> Loal Video </video>
</div>
JavaScript
videoLocal = document.getElementById("videoLocal");
navigator.mediaDevices.getUserMedia()
.then( stream => {
videoLocal.srcObject = stream;
});
myPC = new RTCPeerConnection();
myPC.createOffer()
.then( function(offer) {
console.log("OFFER: " + offer.sdp);
return myPC.setLocalDescription(offer);
})
.then( function() {
console.log("Send the offer to server.");
});
console.log("Sent the offer to the server.");