title: How to stream a media file using PHP?
body: <p>I am trying to build an application in which i have to stream the media files (audio and video) to the browser. I am reading the file through php and send the data to browser. I am using the following code.</p>
  
  <pre><code>header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
  header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
  header("Content-Type: {$file-&gt;getMimetype()}");
  header("Content-Disposition: inline; filename=".$filename.";");
  header("Content-Length: ".strlen($file_content));
  
  echo $file_content;
  </code></pre>
  
  <p>Every thing is working fine, except when i try to forward the video or audio, (I mean suppose current play location is 0:15 and it directly go to 1:25), media stops and when i press the play button again, it starts from the beginning.</p>
  
  <p>I think the problem is with the buffering, but can't figure it out. Am i doing something wrong in header or something else is required.</p>
  
  <p>Thanks.</p>