Monday, October 27th, 2008

Firefox 3.1 to support HTML 5 video and audio

Category: Firefox, HTML

<p>Firefox 3.1 now includes support for the HTML 5 video and audio tags. A nice new article just went up on using these on the Mozilla Developer portal. Firefox 3.1 currently supports the Ogg format, but other formats are being discussed for future support.

Here’s an example use from the documentation:

  1. <video src="http://v2v.cc/~j/theora_testsuite/320x240.ogg" autoplay>  
  2. Your browser does not support the <code>video</code> element.  
  3. </video>

Nice and simple. You can provide several source options for different formats:

  1. <video autoplay>  
  2.    <source src="foo.ogg" type="video/ogg"></source>  
  3.    <source src="foo.mov"></source>  
  4.    Your browser does not support the <code>video</code> element.  
  5. </video>

Note, though, that the source element is not fully supported yet.

Media playback can be controlled with JavaScript:

javascript
< view plain text >
  1. var v = document.getElementsByTagName("video")[0];  
  2. v.play();

There are a whole slew of events that you can listen to as well (there are 22!), so that you can attach behavior and update your UI based on different media events:

javascript
< view plain text >
  1. var v = document.getElementsByTagName("video")[0];
  2.  
  3. v.addEventListener("seeked", function() { document.getElementsByTagName("video")[0].play(); }, true);
  4. v.currentTime = 10.0;

This gets run when a seek operation happens.

Related Content:

Posted by Brad Neuberg at 8:00 am
9 Comments

+++--
3.5 rating from 11 votes

9 Comments »

Comments feed TrackBack URI

as much as i like the idea of and .. thats how much i am not looking forward at them cause they’re a way to more browser incompatibilities. i dont ever expect IE to support OGG, or Safari to support windows media. In the end the burden will fall on the website developers who will have to cater for multiple codecs.

Comment by kyriakos — October 27, 2008

@kyriakos
Well, the solution is pretty easy, support the std (ogg) and don’t give a damn…
If enough people did that IE *would* come around, it’s called “consumer power” and it wouldn’t really take that many sites before they would be forced to do it…
And if YouTube did this… ;)
(Hint, hint…! Consider this a *really* great strategic advice G ;)

Comment by ThomasHansen — October 27, 2008

Kinda nervous they are trying to throw the kitchen sink in there.

How about they just fix all the little broken things first like full support for HttpOnly cookies and newlines inside of title text?

Comment by ck2 — October 28, 2008

@ThomasHansen.. well.. supporting standards for all these years has indeed made IE standards compliant. (sarcasm included) :)

Comment by kyriakos — October 28, 2008

“seeked”? Is this the new “referer”?

Comment by randomrandom — October 30, 2008

It is no good if one browser decides to support a certain format. It has to be accepted by the browser community so that it is implemented across all browsers uniformly. It is no good just making a website for Firefox.

Comment by HostingITrust — December 9, 2008

@HostingITrust:

The whole point in this is so every brower can support a certain format. The web should be platform agnostic. The OGG format is free (gratis and libre), there are no patents or licensing issues for developers to worry about.

‘It is no good just making a website for Firefox’, this is not the case, it’s just that Firefox implemented the feature first. Microsoft and Apple are more than welcome to implement this feature but they are too busy trying to lock you into their respective platforms. Besides, how many times have there been sites that only work with IE because they have been coded to Microsoft’s f**ked up of the standards?

Comment by diazamet — March 17, 2009

@HostingITrust:

HTML 5, and therefore the tag, are standards of the W3C standards body (http://www.w3.org/TR/html5), and since it’s a joint effort between Opera, Apple, Mozilla, WHATWG and W3C I can guarantee that every major browser apart from IE will be committed to supporting the standards, once they have been finalised.

Now I agree that IE had no trouble completely ignoring standards for years, but the times they are a-changin’. Back then, the ratio of people-who-understand-the-internet to casual users was a ten-millionth of what it is today. Microsoft are no longer the omnipotent giant they once were, and they know it – if they don’t watch their step they’ll wither away altogether within the next decade.

So. The audio and video tags *will* be supported. You mark my words.

Comment by nottRobin — April 13, 2009

@diazamet:

You wrote:
“Microsoft and Apple are more than welcome to implement this feature but they are too busy trying to lock you into their respective platforms.”

Actually, Apple (much as I despise them in every other context) were one of the evangelists of HTML5 and the first to support the audio and video tags:

http://www.betanews.com/article/Apple-introduces-Safari-31-with-some-HTML-5-support/1205855382

Comment by nottRobin — April 13, 2009

Leave a comment

You must be logged in to post a comment.