我已经使用 xhr 预加载了 mp4 视频并将其保存到 blob url
xhr.responseType = 'blob'
// xhr send and get response
var url = URL.createObjectURL(xhr.response);
player.src(url);
// It's worked, it's playable and seekable.
//url = blob url string
现在我需要处理该视频,因此我需要将数据作为 arrayBuffer 获取,当您有 blob url 时如何获取数据(blob 对象) Blob :http://domain/9d0d26c3-b7ba-4302-9186-d23c6ad53bd5
最佳答案
我做了一些研究,因为我也对这个问题感兴趣,我认为唯一的可能性是处理 XHR 请求。我认为这里已经讨论过:How to get a file or blob from an object URL?
如果您有一个 blob,您可以使用 FileReader
将其转换为 ArrayBuffer
。但也许以下方法也可行:
xhr.responseType = 'arraybuffer';
关于javascript - 从 blob url 读取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48121910/