mardi 18 février 2020

How to record only audio in MediaStreamRecorder?

I have a small problem but I can't fix it with myself, I created a program that can video call conference and record the entire video but it takes 1 hour, and the file size is too big.

Is there any solution to reduce the file size or else just record the Audio only. I am using MultiStreamRecorder.js in MediaRecorder.js.

Here is my code.

multiStreamRecorder.ondataavailable = function (blob) {
    data.push(blob);

    var fileName = getFileName('webm');
    var scheduleId = $('#stop-recording').data('id');
    var fileObject = new File([data[0]], fileName, {
        type: data[0].type
    });
    var objectUrl = URL.createObjectURL(data[0]);

    var formData = new FormData();
        formData.append('video_blob', fileObject);
        formData.append('video_filename', fileObject.name);
        formData.append('schedule_id', scheduleId);

    $.ajax({
        url: '/store',
        data: formData,
        cache: false,
        contentType: false,
        processData: false,
        type: 'POST',
        success: function(response) {
            //
        }
    });
};
multiMediaRecorder.start();

//
function getFileName(fileExtension) {
    var d = new Date();
    var year = d.getUTCFullYear();
    var month = d.getUTCMonth();
    var date = d.getUTCDate();
    return year + month + date + '-' + getRandomString() + '.' + fileExtension;
}


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2SSyMge
via IFTTT

Aucun commentaire:

Enregistrer un commentaire