开发者

XMLHttpRequest for Video Tag?

开发者 https://www.devze.com 2023-03-05 14:05 出处:网络
Ha开发者_开发技巧s anyone tried using binary data from an XHR request to be the content of a video file?In Blob-supporting browsers, you can do the following and use a generate, given req is a new XML

Ha开发者_开发技巧s anyone tried using binary data from an XHR request to be the content of a video file?


In Blob-supporting browsers, you can do the following and use a generate, given req is a new XMLHttpRequest:

var some_video_element = ...;
req.onload = function () {
    var blob_uri = URL.createObjectURL(this.response);
    some_video_element.appendChild(document.createElement("source"))
        .src = blob_uri;
};
req.responseType = "blob";
req.open(...);
req.send(null);

Refer to this workaround for Google Chrome until responseType = "blob" is implemented.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号