Streaming MP3 (using SWF) over SSL works in Firefox and Chrome but not in IE 7 or 8
I'm using WP Audio player to steam mp3 files.
This is how I embed the player:
AudioPlayer.embed("player_new_7b4c6a94c8f3cc3f79ce7b8cc4946103", {
soundFile: "file/read/Mdjk7EGOzSzNUmNa8NYhgn6oCQwxoKhzw27EL27cgwCUUd9BLYpRIkt",
noinfo: "yes",
autostart: "no" ,
animation: "no",
buffer: 1,
remaining: "yes"
});
PHP gets the file and then outputs the contents:
$file = new File();
if($data = $file->readFromInbox($request->get('file'))
{
header("Content-Type: audio/mpeg");
header("Content-Transfer-Encoding: binary");
header('Content-Length: ' . $data->getSize());
header('X-Pad: avoid browser bug');
header("Cache-Control:开发者_运维知识库 no-store");
header("Cache-Control: no-store, must-revalidate");
header("Cache-Control: no-store,max-age=0,must-revalidate");
header("Cache-Control: max-age=0,must-revalidate");
header("Cache-Control: must-revalidate");
echo $data->getData();
exit();
}
else
{
$this->redirect404();
}
The whole application is using SSL. There is no standard HTTP port 80 access.
This works fine on Chrome, Firefox, Opera etc. but not for IE.
I read this post: http://faindu.wordpress.com/2008/04/18/ie7-ssl-xml-flex-error-2032-stream-error/
Apparently flash has problems opening files over SSL when using IE.
Any help would be greatly appreciated. thanks.
EDIT: This works in IE9. Just not IE7 or IE8
I found a solution.
These headers is what solved the problem:
header ("Cache-Control: no-store");
header ("Expires: -1");
header ("Pragma: public");
Plus, of course, with the standard headers:
header("Content-Type: audio/mpeg");
header("Content-Transfer-Encoding: binary");
header('Content-Length: ' . $data->getSize());
header('X-Pad: avoid browser bug');
精彩评论