【问题标题】:Read data from blob url [duplicate]从blob url读取数据[重复]
【发布时间】:2018-06-15 18:09:09
【问题描述】:

我已经用 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

【问题讨论】:

    标签: javascript xmlhttprequest blob filereader arraybuffer


    【解决方案1】:

    我做了一些研究,因为我也对这个问题感兴趣,我认为唯一的可能性是对 XHR 请求进行处理。我想这里已经讨论过了:How to get a file or blob from an object URL?

    如果您有一个 blob,您可以使用 FileReader 将其转换为 ArrayBuffer。但也许以下方法也可以工作:

    xhr.responseType = 'arraybuffer';
    

    【讨论】:

      猜你喜欢
      • 2020-03-20
      • 2016-06-10
      • 1970-01-01
      • 2013-02-21
      • 2016-12-22
      • 2011-04-14
      • 2012-07-11
      • 2011-10-30
      • 1970-01-01
      相关资源
      最近更新 更多