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 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3