muaz-khan / RecordRTC

RecordRTC is WebRTC JavaScript library for audio/video as well as screen activity recording. It supports Chrome, Firefox, Opera, Android, and Microsoft Edge. Platforms: Linux, Mac and Windows.
https://www.webrtc-experiment.com/RecordRTC/
MIT License
6.45k stars 1.75k forks source link

blob.size on Android is twice+ bigger than on Windows #864

Open Aroxed opened 5 months ago

Aroxed commented 5 months ago

Hi! Firstly, thanks for the great library. I have an issue related to ondataavailable function and its 'blob' argument size. Here is the snippet of my code:

        recorder = RecordRTC(microphone, {
            recorderType: StereoAudioRecorder,
            type: 'audio/wav',
            mimeType: 'audio/webm;codecs=pcm',
            numberOfAudioChannels: 1,
            bufferSize: 1024,
            desiredSampRate: 8000,
            timeSlice: 40,
            ondataavailable: function(blob) {
                document.getElementById('print').innerHTML += ' ' + blob.size
                //...
            }
        }

When I run this code on Windows 10 Chrome browser I have such a list of blob.sizes:

726 726 726 726 1068 726 1068 726 1068 726 726 726 1068 726 1068 726 1068 726 1068 726 726 1068 726 726 1068 726 726 1068 726 726 1068 726 726 1068 726 726 1068 726 726 1068 1068 726 726 1068 726 1068 1068 386 1410 726 726 1068 726 726 726 1068 1068 726 726 1068 726

When I run the same code using Android Chrome browser I have another list of blob.sizes:

8236 2434 2774 2774 2774 2774 2774 1410 1410 2774 2774 2774 2774 2774 2774 2092 726 2774 2774 2774 2774 2774 2774 2774 2434 2774 2774 2774 2774 1410 1410 2774 2774 2774 2774

Settings timeSlice as 100 or 20 leads to the same results: on Android values are close to 2000-2800 bytes.

Please help me either to have the same values of sizes or explain to me how to deal with Android-related data. Thanks in advance.