IE MP3 流媒体。在 Firefox 中工作正常,但在 IE 和 Chrome 中不行。标头问题
我在 IE 和 Chrome 中播放 MP3 时遇到了一些问题(在 Firefox 中工作正常)
我们有一个语音邮件服务器。 Web 应用程序通过将 wav 文件即时转换为 MP3 来流式传输(使用 lame,不是很好,但由于星号的限制,我们必须这样做),然后将内容作为二进制流输出。
header("Content-Type: audio/mpeg");
header("Content-Transfer-Encoding: binary");
header('X-Pad: avoid browser bug');
header('Cache-Control: no-cache');
$file->readFromInbox($f);
我们使用的 MP3 音频播放器是: http://wpaudioplayer.com/standalone/
如果文件是(我认为)大小小于 100k,音频流正常,MP3 闪存音频播放器状态栏更新(秒数增加,条形移动)。
但是,如果文件大于 100k,就会出现问题。音频在 IE7/8 和 Chrome 中播放,但状态栏没有变化。即使正在播放音频,它仍然显示“正在连接...”。奇怪的。
在 Firefox 中,我没有任何问题。
可能是什么问题?为什么firefox没有问题,而IE和Chrome却没有问题?我需要指定正在传输的文件的大小吗? (这是不可能的,因为文件正在动态转换并由于 passthru 命令而立即输出)
谢谢大家!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先转换文件并将其存储为临时文件。然后将该文件与 Content-Length 标头一起发送。
可以使用以下命令创建临时文件:
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: