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 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)