I'm trying to record video from a user's computer in the browser and directly upload it to a secure online location. I'm anticipating users of an age group where the more streamlined the process the better -- i.e. having them download the video file and then uploading it elsewhere might be too confusing for them -- so I'm looking to upload directly from the browser.
I have the code to record the video in the browser, but I currently can only get it to download to the user's computer as an mp4 file.
let vidSave = document.getElementById('vid2');
let mediaRecorder = new MediaRecorder(mediaStreamObj);
let chunks = [];
mediaRecorder.ondataavailable = function(ev) {
chunks.push(ev.data);
}
mediaRecorder.onstop = (ev)=>{
let blob = new Blob(chunks, { 'type' : 'video/mp4;' });
chunks = [];
let videoURL = window.URL.createObjectURL(blob);
vidSave.src = videoURL;
}