Reputation: 17053
Has anyone tried using binary data from an XHR request to be the content of a video file?
Upvotes: 2
Views: 2993
Reputation: 35830
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.
Upvotes: 1