Video binary returned by PHP
$file = fopen("./test.wmv", "rb"); -sharprb wb
$blob = fread($file,filesize("./test.wmv"));
if($blob) {
echo $blob;
exit;
}else{
echo "";
exit;
}
js gets video binary data
xhr=new XMLHttpRequest()
xhr.open("POST", "http://localhost/video_blob.php", true);
xhr.responseType = "blob";
xhr.onload = function(e) {
if (this.status==200) {
var blob = this.response; // blob
// blobvideo
document.getElementById("mv").src= window.URL.createObjectURL(blob);
}
}
xhr.send()
but I can"t play it. What"s going on
<video controls="" id="mv" src="blob:http://localhost/5d3064ca-aa5e-45b9-9c2f-9c0a2c0bdc6a"</video>