frontend: vue
I have been using MediaRecorder API to record videos in the frontend and using S3 multipart to upload the videos to S3 chunk by chunk
minimum limit in S3 multipart upload is 5MB unless it is the last part
Here I want to dynamically create a chunk for 5MB,
but chunks are created on a time basis
this.mediaRecorder = new MediaRecorder(this.stream,{
videoBitsPerSecond: 2500000,
mimeType: 'video/webm'
}
this.mediaRecorder.start(5000) # => 5000 ms
this.mediaRecorder.ondataavailable = event => {
this.blobs.push(event.data)
console.log(event.data.size) # => returns size
}
I gave 5 seconds initially but for 5 seconds it only create a blob with a size of ~0.6MB, so I increased the time to 50 seconds, now each blob is larger than 5MB, but what if the low-resolution camera or high-resolution camera is used?
Is there any workaround to achieve without giving static time?