I am trying to play a base 64 encoded MP4 using the HTML5 data URI. For some reason, the video won't play. The approach works fine for image files (jpeg and png), however for some reason it won't work for media files.
On the client side I have:
document.getElementById("video_holder").src = "data:video/mp4;base64," + xmlhttp.responseText;
HTML something like:
<video controls> <source type="video/webm" src="" id="video_holder" />...
I am fetching the file using PHP and base64 encode it before sending it to the user:
$file = file_get_contents($path);
echo chunk_split(base64_encode(trim($file)));
I also tried:
$file = file_get_contents($path);
echo base64_encode(trim($file));
Any suggestions?