EDIT # 2
Okay, the problem is different from what I originally thought, so I put this “edit” up. I also updated the title of the question (the old one was "Streaming audio wav from mysql blob").
Now the problem is with CodeIgniter sessions. The above script will only be run if the user is logged in. For some reason, when I manually set the response headers (either with the php header () output class or codeigniters). It can be seen from my logs that everything is rebooting and reinitializing - and that the session data is lost, so the user is no longer logged in, so the script actually displays an error.
As soon as I delete any requirement or link to the session data, the sound plays normally ... but this is not quite an option if I can not authenticate the user in any other way. Very frustrating.
.
.
,
** Source **
I have mysql blob that contains audio data in wav format. I am trying to bring this to a stream browser in any audio player plugin that the browser wants to use.
The sound player works fine if I point it to a physical .wav file, so that doesn't seem like a problem. However, if I point it to my PHP script, do I get "Search for a suitable plugin"? a popup in Firefox (which finds nothing) and just an empty inactive player in Chrome.
PHP, $aud , :
header("Content-length: $aud->size");
header("Content-type: audio/x-wav");
echo $aud->recording;
exit();
( "Content-Disposition: attachment; filename = $name" ); , , , , .
CodeIgniter, . , /audio/ $id.wav .
- , ?
, php script:
Date: Tue, 22 Mar 2011 22:12:06 GMT
Server: Apache/2.2.16 (Ubuntu)
X-Powered-By: PHP/5.3.3-1ubuntu9.3
Set-Cookie: ci_session=<long encrypted session string>; expires=Wed, 23-Mar-2011 00:12:06 GMT; path=/
Content-Length: 12345
Keep-Alive: timeout=15, max=98
Connection: Keep-Alive
Content-Type: audio/x-wav
200 OK
, , wav :
Date: Tue, 22 Mar 2011 22:10:53 GMT
Server: Apache/2.2.16 (Ubuntu)
Last-Modified: Tue, 22 Mar 2011 22:08:30 GMT
Etag: "200a83-3039-49f197bfcb380"
Accept-Ranges: bytes
Content-Length: 12345
Content-Type: audio/x-wav
200 OK
. PHP script .