MEDIA_ERR_SRC_NOT_SUPPORTED HTML5音频困境 [英] MEDIA_ERR_SRC_NOT_SUPPORTED html5 audio woes

查看:2132
本文介绍了MEDIA_ERR_SRC_NOT_SUPPORTED HTML5音频困境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个HTML5音频播放器和一切工作正常,当我从服务器在同一台主机作为HTML页面中的.OGG文件。当我把OGG文件在我的CDN失败和错误code是MEDIA_ERR_SRC_NOT_SUPPORTED

例如,这工作正常。

 <音频SRC =/ song.oggID =玩家>
  您的浏览器不支持的< code>音频< / code>元件。
< /音频>

但失败并出现上述错误code

 <音频SRC =htt​​p://mycdn.com/song.oggID =玩家>
  您的浏览器不支持的< code>音频< / code>元件。
< /音频>

有关失败是这个样子(这是从中表现出同样的行为不同的OGG文件)

该音频文件的标题

  HTTP / 1.1 200 OK
服务器:CacheFlyServe v26b
日期:星期六,2010 GMT 21点10分48秒2月13日
内容类型:应用程序/八位字节流
连接:关闭
ETag的:c6ee7d86e808cc44bbd74a8db94a5aae
的X CF1:fA.syd1:CF:cacheD.syd1-01
内容长度:2398477
最后一次修改:星期六,2010 2月13日20时五十分56秒GMT
接受-范围:字节
的X缓存:错过deliveryD-syd1


解决方案

内容类型=字节/流头的问题,但如果我正确读取规格,它不应该是。下面是一个测试用例:<一href=\"http://mozilla.doslash.org/stuff/video-test/video.html\">http://mozilla.doslash.org/stuff/video-test/video.html

Mozilla的这个bugzilla中提交了错误。 响应:


  

我们没有做任何内容嗅摸出内容是什么 - 我们依赖于
  所提供的正确的MIME类型。这就是为什么应用程序/八位字节流呢
  不玩,这样我们返回为canPlayType。


I am working on an html5 audio player and everything is working fine when I server the .ogg file from the same host as the html page. When I put the ogg file in my cdn it fails and the error code is MEDIA_ERR_SRC_NOT_SUPPORTED

For example, this works fine

<audio src="/song.ogg" id="player">
  Your browser does not support the <code>audio</code> element.
</audio>

But this fails with the above error code

<audio src="http://mycdn.com/song.ogg" id="player">
  Your browser does not support the <code>audio</code> element.
</audio>

The headers for the audio file that fails look something like this (this is from a different ogg file which exhibits the same behavior)

HTTP/1.1 200 OK
Server: CacheFlyServe v26b
Date: Sat, 13 Feb 2010 21:10:48 GMT
Content-Type: application/octet-stream
Connection: close
ETag: "c6ee7d86e808cc44bbd74a8db94a5aae"
X-CF1: fA.syd1:cf:cacheD.syd1-01
Content-Length: 2398477
Last-Modified: Sat, 13 Feb 2010 20:50:56 GMT
Accept-Ranges: bytes
X-Cache: MISS from deliveryD-syd1

解决方案

The Content-Type=octet/stream header is the problem, although if I'm reading the spec correctly, it shouldn't be. Here's a testcase: http://mozilla.doslash.org/stuff/video-test/video.html

I filed a bug in Mozilla's bugzilla about this. [edit] the response:

We don't do any content sniffing to work out what the content is - we rely on the correct mime type being provided. This is why application/octet-stream does not play and way we return "" for canPlayType.

这篇关于MEDIA_ERR_SRC_NOT_SUPPORTED HTML5音频困境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆