fix-webm-duration
fix-webm-duration copied to clipboard
Duration section is missing
I've been getting the message [fix-webm-duration] Duration section is missing when trying to add this to my app. On the latest Chrome on desktop Mac. I've tried both methods but it doesn't add the duration.
I've played around with it a fair bit but can't get it to work. Any tips on what I might be doing wrong?
const options = {
mimeType: this.mimeType, // audio/webm;codecs=opus
bitsPerSecond: 64000, // For video-only recording
audioBitsPerSecond: 64000, // For audio recording
numberOfAudioChannels: 1, // Mono
audioBitrateMode: "variable", // For variable bitrate
}
this.mediaRecorder = new MediaRecorder(this.stream, options)
this.mediaRecorder.onstop = (e) => {
const blob = new Blob(this.chunks, { type: this.mimeType })
ysFixWebmDuration(blob, 10000, (fixedBlob) => {
console.log(fixedBlob, "after1")
})
ysFixWebmDuration(blob, 10000, { logger: true }).then((fixedBlob) => {
console.log(fixedBlob, "after2")
})
}
The log looks like
Blob {size: 38123, type: 'audio/webm;codecs=opus'}
Didn't test the library with audio-only files... I'll check it
Also getting this error with recorded audio files. This isn't really a big issue because you can set logger:false, but I'm not sure why the duration is not being set correctly.
"Duration section is missing" is not an error, it's just a debugging info. It means that the library will add the missing duration section after logging that.
The logger could be silenced by providing logger: false option if the output is not desirable. I also could change the default logger from console.log to console.debug