1

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;
        }
  • This may help: https://stackoverflow.com/a/37374545/334402 – Mick Jul 02 '19 at 09:51
  • Thanks for the information! Is there a way to upload not to a server but rather to a drive (e.g. Box, DropBox, Google Drive)? – Hale Jaeger Jul 03 '19 at 15:02
  • Yes, most of those provide REST API;s you can use to upload the file - e.g.https://www.dropbox.com/developers/documentation/http/documentation#files-upload – Mick Jul 03 '19 at 16:18

0 Answers0