|
@@ -12,9 +12,17 @@ export async function init() {
|
|
|
else throw "failure to getUserMedia";
|
|
|
|
|
|
if (stream) {
|
|
|
+
|
|
|
+ var mime;
|
|
|
+ if (MediaRecorder.isTypeSupported('audio/webm;codecs=OPUS')) {
|
|
|
+ mime = 'audio/webm;codecs=OPUS';
|
|
|
+ } else if (MediaRecorder.isTypeSupported("audio/mp4;codecs=mp4a.40.2")) {
|
|
|
+ mime = "audio/mp4;codecs=mp4a.40.2";
|
|
|
+ } else throw "No support audio recording codec in OPUS or MP4A";
|
|
|
+
|
|
|
recorder = new MediaRecorder(stream, {
|
|
|
audioBitsPerSecond: 64000,
|
|
|
- mimeType: 'audio/webm;codecs=OPUS'
|
|
|
+ mimeType: mime
|
|
|
});
|
|
|
|
|
|
recorder.ondataavailable = async (r) => {
|