tags:

views:

211

answers:

2

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
+2  A: 

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.

Nickolay
thanks, I think I was in need of sleep when I posted this. I could have sworn I looked at the Content-Type of the one that worked and that it was application/octet-stream. Looking at it now it's application/ogg
jshen
+1  A: 

The problem is the mime type you are serving the audio file with. It needs to be 'audio/ogg', 'application/ogg' or 'video/ogg' for Firefox to play it. Firefox doesn't do any form of 'content sniffing' to work out what format the file is in - it relies entirely on the mime type.