Morgane Daniel
unread,Jun 13, 2017, 5:40:51 AM6/13/17You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to dev...@lists.mozilla.org
Hi,
I have a question regarding the MediaRecorder API, I hope this list is the
good place to ask this!
I try to record an audio track from the microphone and so far I succeed in
getting an array of bytes in a Blob. My problem is I could not get the
sample rate and the sample size. The method getSettings() seems to be the
perfect candidate but it is not supported on Chrome neither on Firefox. I
also tried the applyConstraints() method to fix a sample rate and a sample
size but it seems not being applied (I had no more bytes if I tried to
increase the sample rate for example), however I can read those constraints
in getConstraints.
Could you tell me what I am doing wrong please? I don't get it!
thank you !
let AudioFormat = {
sampleSize: 16,
channelCount: 1,
sampleRate: 16000
}
navigator.mediaDevices.getUserMedia({ audio: AudioFormat, video:
false })
.then( function(stream) {
const media_recorder = new MediaRecorder(stream);
media_recorder.start( recording_length );
media_recorder.onstart = function(){
console.log("Starting recording")
}
media_recorder.ondataavailable = function( event ){
var reader = new FileReader();
reader.addEventListener("loadend", function() {
console.log( new Uint8Array( reader.result ) )
});
}