通过SSL传输MP3(使用SWF)适用于Firefox和Chrome,但不适用于IE 7或8


Streaming MP3 (using SWF) over SSL works in Firefox and Chrome but not in IE 7 or 8

我正在使用WP Audio player来steam mp3文件。

我是这样嵌入播放器的:

            AudioPlayer.embed("player_new_7b4c6a94c8f3cc3f79ce7b8cc4946103", {  
                soundFile: "file/read/Mdjk7EGOzSzNUmNa8NYhgn6oCQwxoKhzw27EL27cgwCUUd9BLYpRIkt",  
                noinfo: "yes",
                autostart: "no" ,
                animation: "no",
                buffer: 1,
                remaining: "yes"
            });  

PHP获取文件,然后输出内容:

$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();
}

整个应用程序使用SSL。没有标准的HTTP 80端口访问

这在Chrome, Firefox, Opera等上运行良好,但不适合IE。

我读了这篇文章:http://faindu.wordpress.com/2008/04/18/ie7-ssl-xml-flex-error-2032-stream-error/

显然flash在使用IE时无法通过SSL打开文件。

任何帮助都将非常感激。谢谢。

编辑:这适用于IE9。但不是IE7或IE8

我找到了一个解决方案。

这些头文件解决了这个问题:

header ("Cache-Control: no-store");
header ("Expires: -1");
header ("Pragma: public");

当然还要加上标准的头文件:

header("Content-Type: audio/mpeg");
header("Content-Transfer-Encoding: binary");    
header('Content-Length: ' . $data->getSize());
header('X-Pad: avoid browser bug'); 
相关文章: