admin管理员组文章数量:1122832
I am trying to convert a recording captured with MediaRecorder
from WebM to WAV.
const mediaRecorder = new MediaRecorder(stream); // stream passed from navigator.mediaDevices.getUserMedia
let chunks = [];
mediaRecorder.ondataavailable = function(event) {
if (event.data.size > 0) {
chunks.push(event.data);
}
};
mediaRecorder.onstop = function() {
const wavBlob = new Blob(chunks, { type: 'audio/wav' });
};
When the media recorder stops, the console outputs the following error:
Uncaught (in promise) TypeError: Failed to execute 'arrayBuffer' on 'Blob': Illegal invocation
window.Blob
produces the same error.
I believe this is because Blob
is being overwritten with the Blob
class from wp-includes/js/plupload/moxie.js (Line 3421). This Blob does not work the same as the HTML5 Blob and I do not see a way to access the HTML5 Blob from it.
I tried saving a reference to the HTML5 Blob on page load like so:
<head>
<script>const htmlBlob = Blob;</script>
</head>
However, new htmlBlob
creates a plupload Blob and causes the same console error.
I assume moxie.js is required for WordPress to run properly, so unqueuing it does not seem like a good solution.
I also tried setting the mimeType to WAV when constructing the MediaRecorder:
const mediaRecorder = new MediaRecorder(stream, { mimeType: 'audio/wav' });
This produces the following console error:
NotSupportedError: Failed to construct 'MediaRecorder': Failed to initialize native MediaRecorder the type provided (audio/wav) is not supported.
本文标签: pluploadHow can I access the native HTML5 Blob in WordPress
版权声明:本文标题:plupload - How can I access the native HTML5 Blob in WordPress? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736293018a1929056.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论