Mediarecorder“ onstop”活动在野生动物园两次发射
在我的应用程序中,我正在使用Mediarecorder从用户录制一个简短的视频(最多30秒),然后将其发送到后端。为了检测录制已经停止,我使用了Mediarecorder的“ onStop”事件,在回调中,我构建了一个视频文件并调用上传过程。在Chrome和Edge中,它可以正常工作。该事件仅调用一次,但是在野生动物园中,我看到了不同的行为,“ onstop” 和“ ondataavailable” 事件两次调用。因此,我的逻辑被打破了,后端收到两个视频文件,第一个文件通常被打破,第二个是可以的。
this.mediaRecorder = new MediaRecorder(stream, {
mimeType,
videoBitsPerSecond,
});
this.mediaRecorder.addEventListener('dataavailable', () => {
console.debug('dataavailable');
});
this.mediaRecorder.addEventListener('stop', () => {
console.debug('stop');
});
this.mediaRecorder.start();
console.debug('start');
这是野生动物园还是正常行为的错误?
In my app, I'm using MediaRecorder to record a short video (up to 30s) from a user and then send it to the backend. To detect that recording has stopped, I use "onstop" event of MediaRecorder and in its callback I construct a video file and invoke uploading process. In Chrome and Edge it works fine. The event invokes only once, but in Safari I see different behavior, the "onstop" and "ondataavailable" events invoke twice. Therefore, my logic is broken, the backend receives two video files, the first one is broken usually, the second one is ok.
this.mediaRecorder = new MediaRecorder(stream, {
mimeType,
videoBitsPerSecond,
});
this.mediaRecorder.addEventListener('dataavailable', () => {
console.debug('dataavailable');
});
this.mediaRecorder.addEventListener('stop', () => {
console.debug('stop');
});
this.mediaRecorder.start();
console.debug('start');
Is this a bug of Safari or normal behavior?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论