开发者

XMLHttpRequest for Video Tag?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜