从 Apache 提供 GZipped MIDI 内容在浏览器上的 Quicktime 中播放时遇到问题。解决方法?
我需要通过 Apache 提供大型 MIDI 文件,这些文件被预压缩为 .mid.gz 格式,我终于设法让所有内容类型和内容协商工作到我有一个包含正确内容的压缩 MIDI 的程度- 类型和编码。我遇到的最后一个障碍是,当我在浏览器中加载文件并尝试在 QuickTime 中播放它时,Quicktime 向我显示一个问号图标,表明它无法播放该文件。
我搜索了一下,发现了这个:
“媒体文件是在标头中设置“传输编码:分块”发送的,并且标头中没有“内容长度”条目。这是因为 Apache 无法计算出文件有多大。已被压缩,因此它会以分块形式发送它们。各种播放器无法处理分块数据,因此他们会播放第一个块或几个块,假设这是整个文件。”
1)我的标头中没有分块传输编码。我确实有一个内容长度。那么为什么这仍然不起作用呢?
这是我的标题
Accept-Ranges:bytes
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:646
Content-Location:compressed.mid.gz
Content-Type:audio/midi
Date:Sat, 12 Mar 2011 01:36:39 GMT
ETag:"23b8d-286-49e3e12c899e7;49e3f0864a38f"
Keep-Alive:timeout=15, max=100
Last-Modified:Sat, 12 Mar 2011 00:22:27 GMT
Server:Apache/2.2.16 (Ubuntu)
TCN:choice
Vary:negotiate
2)如果即使使用正确的标题,上述观点仍然成立,是否有解决此问题的方法?
作为参考,这里是我的压缩 MIDI 文件的链接: http://174.129.57.199/compressed.mid
I need to serve large MIDI files over Apache that are precompressed to a .mid.gz format and I've finally managed to get all the content-type and content negotiation working to the point that I have a compressed MIDI delivered with the right content-type and encoding. The final hurdle I'm running into is that when I load the file in the browser and try to play it in QuickTime, Quicktime shows me a Question mark icon indicating that it can't play the file.
I googled around and found this:
"Media files are sent with "Transfer encoding: chunked" set in the header and no "Content length" entry in the headers. This is because Apache can't work out how large the files are once they have been compressed, so it send them chunked. Various players can't handle chunked data so they play the first chunk or few chunks, assuming that to be the entire file."
1) I dont have chunked Transfer encoding in my header. And I do have a content-length. So why does this still not work?
Here's my header
Accept-Ranges:bytes
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:646
Content-Location:compressed.mid.gz
Content-Type:audio/midi
Date:Sat, 12 Mar 2011 01:36:39 GMT
ETag:"23b8d-286-49e3e12c899e7;49e3f0864a38f"
Keep-Alive:timeout=15, max=100
Last-Modified:Sat, 12 Mar 2011 00:22:27 GMT
Server:Apache/2.2.16 (Ubuntu)
TCN:choice
Vary:negotiate
2) If the above point still holds even with the right headers, is there a workaround for this problem?
As a reference, here's a link to my compressed MIDI file:
http://174.129.57.199/compressed.mid
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论