The video link created by window.URL.createObjectURL (blob) cannot be played by video.

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>

Jul.11,2022

I have the same problem. Have you solved it?


from your screenshot, it looks like the video is corrupted.
if the video is normal, add bolb video resources through createObjectURL. You can't play () directly. You need to take the initiative of the user to trigger play ().
I hope it will be helpful to you.


video tags do not support converting videos in this format to MP4 format (H.264), and your video tags are missing

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf6dae-30d76.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf6dae-30d76.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?