views:

465

answers:

3

I'm trying to make a web based media player using the HTML5 audio element implemented in Firefox 3.5 and Chrome. Reading Mozillas documentation, omitting the autobuffer attribute should result in the audio src not being requested:

if specified, the audio will automatically begin being downloaded, even if not set to automatically play. This continues until the media cache is full, or the entire audio file has been downloaded, whichever comes first

However, on the server side I notice the files are being requested anyway. My sample page is very simple:

<html>
    <body>
        <audio src="1.ogg"></audio>
        <audio src="2.ogg"></audio>
    </body>
</html>
+2  A: 

Boolean attributes in HTML5 can't be false. If it's present at all, it's true.

You've been led astray by XHTML habits.

See: http://dev.w3.org/html5/spec/Overview.html#boolean-attributes

Quote:

"The values "true" and "false" are not allowed on boolean attributes. To represent a false value, the attribute has to be omitted altogether."

Bod
You're right, but omitting the autobuffer attribute altogether doesn't change this unwanted behavior: the ogg files are still being requested.
pthulin
+1  A: 

The autobuffer attribute has been replaced with preload which accepts the values none, metadata and auto.

A patch has been submitted for WebKit (issue #35385; unfortunately I can't link to it), but it seems that it hasn't made it into Safari 4.0.5.

craiga
A: 

According to the article "Configuring Servers for Ogg Media", Ogg media does not contain duration information, so to correctly display a slider you need to include an X-Content-Duration header. If you don't include such a header, Firefox will prefetch portions of the media* so that it can work out the duration and display a slider.

That could be your problem.

  • It will fetch the first few bites, which should give it a Content-Length header so it knows the file size. It will then use that file size to fetch the last few bites, from which it can work out the duration.
TRiG