duanhuan2301 2011-06-23 16:54
浏览 48
已采纳

IE MP3流媒体。 适用于Firefox,但不适用于IE和Chrome。 标头问题

I have a bit of a problem with streaming MP3s in IE and Chrome (it works fine in Firefox)

We have a voicemail server. The web app streams the wav file by converting it on the fly to MP3 (using lame, not great, but we have to do it is this way because of limitations of asterisk) and then outputs the content as a binary stream.

header("Content-Type: audio/mpeg");
header("Content-Transfer-Encoding: binary");    
header('X-Pad: avoid browser bug');
header('Cache-Control: no-cache');    
$file->readFromInbox($f);

The MP3 audio player we're using is: http://wpaudioplayer.com/standalone/

If the file is (I think) less than 100k in size, the audio streams fine and the MP3 flash audio player status bar is updated(the seconds go up, and the bar moves along).

However, if the file is bigger than 100k then there is a problem. The audio plays in IE7/8 and Chrome but the status bar doesn't change. It continues to say 'Connecting...' even though the audio is being played. Odd.

In Firefox, I have no problems.

What could be the problem? Why does firefox not have any problems but IE and Chrome? Do I need to specify the size of the file being streamed? (Which isn't possible as the file is being converted on the fly and being outputted straight away because of the passthru command)

Thanks guys!

  • 写回答

1条回答 默认 最新

  • 普通网友 2011-06-23 17:23
    关注

    Convert the file first and store it as a tempfile. Then send that file along with the Content-Length header.

    A temp file cam be created with this:

    $tempfile = tempnam('/tmp','mp3')
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 用verilog实现tanh函数和softplus函数
  • ¥15 Hadoop集群部署启动Hadoop时碰到问题
  • ¥15 求京东批量付款能替代天诚
  • ¥15 slaris 系统断电后,重新开机后一直自动重启
  • ¥15 QTableWidget重绘程序崩溃
  • ¥15 谁能帮我看看这拒稿理由啥意思啊阿啊
  • ¥15 关于vue2中methods使用call修改this指向的问题
  • ¥15 idea自动补全键位冲突
  • ¥15 请教一下写代码,代码好难
  • ¥15 iis10中如何阻止别人网站重定向到我的网站