AnsweredAssumed Answered

Opening/Streaming Audio Files in Chrome

Question asked by Noor Diya on Aug 16, 2018

Hi, All:

 

I am attempting open a .wav file for streaming (as opposed to downloading locally). In the IE browser, the windows player opens and plays the file correctly.  However, in Chrome, a new browser tab with the embedded player opens but, file does not load and does not play.

 

I made the following changes to the download.php file:

if($mime_type == "audio/wav" || (strpos($mime_type, 'image/') === 0)) {
   header("Content-Type: audio/wav");

   header('Content-Disposition: inline;filename= '. $name .'');

   header('Content-Transfer-Encoding: binary');

   header('Content-Length: ' . filesize($name));

}

 

Also, a side-note, the SELECT statement in download.php is missing the mime_type field and needed to be added:

Was:

if($file_type == 'documents') {

   $query = "SELECT filename name FROM document_revisions INNER JOIN documents ON documents.id =       document_revisions.document_id "

Should be:

if($file_type == 'documents') {

   $query = "SELECT filename name, file_mime_type FROM document_revisions INNER JOIN documents ON documents.id =       document_revisions.document_id ";

 

Thank you in advance.

Outcomes