title: HTML5 and PHP: Play base 64 encoded video file
body: <p>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. </p>
  
  <p>On the client side I have:</p>
  
  <pre><code>document.getElementById("video_holder").src = "data:video/mp4;base64,"  + xmlhttp.responseText;
  </code></pre>
  
  <p>HTML something like:</p>
  
  <pre><code>&lt;video controls&gt; &lt;source type="video/webm" src="" id="video_holder" /&gt;...
  </code></pre>
  
  <p>I am fetching the file using PHP and base64 encode it before sending it to the user:</p>
  
  <pre><code>$file = file_get_contents($path);
  echo chunk_split(base64_encode(trim($file)));
  </code></pre>
  
  <p>I also tried:</p>
  
  <pre><code>$file = file_get_contents($path);
  echo base64_encode(trim($file));
  </code></pre>
  
  <p>Any suggestions?</p>