"onstop" event not firing
See original GitHub issueHello!
I see a new release just went up an hour ago, so I’m not sure if this is related.
The onstop
event listener doesn’t seem to fire for me.
(I’m using Vue.js)
import { MediaRecorder, register } from "extendable-media-recorder";
import { connect } from "extendable-media-recorder-wav-encoder";
export default {
name: "Recorder",
data() {
return {
mediaRecorder: null,
chunks: [],
urls: []
};
},
methods: {
record() {
this.mediaRecorder.start();
},
stop() {
this.mediaRecorder.stop();
},
handleData(e) {
console.log(e);
this.chunks.push(e.data);
},
handleStop() {
var blob = new Blob(this.chunks, { type: "audio/wav" });
this.chunks = [];
this.urls.push(URL.createObjectURL(blob));
}
},
async mounted() {
await register(await connect());
const stream = await navigator.mediaDevices.getUserMedia({
audio: {
echoCancellation: false
}
});
this.mediaRecorder = new MediaRecorder(stream, { mimeType: "audio/wav" });
this.mediaRecorder.ondataavailable = this.handleData;
this.mediaRecorder.onstop = this.handleStop;
}
};
ondataavailable
fires without any issues.
If I remove the extendable-media-recorder
imports and default to the standard recorder, it fires correctly.
I tried using addEventListener('stop', ...)
too, but no luck…
It’s happening in the latest version of Chrome & Firefox. Let me know if there’s anything else I can do to help debug the issue.
Thanks! Ger
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Windows Service Does Not Fire OnStart Event - Stack Overflow
OnStart is firing, your timer is not. You must either do timer1.Start() or timer1.Enabled = true in OnStart for the timer to start...
Read more >Windows service onstop() event not fired when someone kills ...
I am trying to send mail when someone stops my service. But when someone kills the process then OnStop event not fired. It...
Read more >Events not firing when using Seek; works without ... - GitHub
If i use the seek as shown above, the onend events do not fire. If I play without using the seek, then the...
Read more >Windows Services OnShutDown() event is not firing - C# Corner
I want to create a service which note the time of OS in OnStart event and save that start time and end time...
Read more >onstop event | stop event JavaScript - Dottoro Web Reference
Occurs when the user aborts the loading of the document. If an onstop event occurs, the onload event is not fired on the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Okay, great.
At least in theory it should perform a bit better. I think RecorderJS always uses the
ScriptProcessorNode
since that was the only option back then. extendable-media-recorder only uses that when used in Safari. And even that should not be necessary for much longer since Safari getsAudioWorklet
support as well. I tried to explain the inner workings in the readme.Feel free to create another issue if you run into any problems.
Hi @NoClipDigital, you’re absolutely right. The
stop
event is not yet implemented. But as far as I remember there was no particular reason, despite of the usual too-many-things-not-enough-time problem.Did you find a workaround for your use case?
It’s for example possible to check the state of the MediaRecorder whenever the
dataavailable
event fires. If the state is'inactive'
it’s safe to assume that the recording is done.