[theora] recommendations for web video bit rates

Philip Jägenstedt philip at foolip.org
Mon Mar 15 10:10:55 PDT 2010

2010/3/16 Ivo Emanuel Gonçalves <justivo at gmail.com>:
> On 3/15/10, Henri Sivonen <hsivonen at iki.fi> wrote:
>> Is there a vendor-neutral site for promoting Theora-playback in browsers?
>> PlayOgg.org seems to be about promoting VLC--not in-browser Ogg playing.
>> I'd like to see a promo site that authors could point users who don't have
>> HTML5/Theora capable browsers to while still respecting the browser choices
>> the users have already made and without the authors having to maintain
>> browser advice themselves.
> I actually had a similar idea two years ago for something to add to
> spreadopenmedia.org, but I'm afraid nothing came out of it.
> I think I could have a stab at it now that there are actual browsers
> with video support.  What's the most feasible way to check for video
> support right now?  Javascript?  User-agent sniffing?  And if it's the
> former, is there a library or plugin out there that already does this?
> Oh, and on the IE issue, I think perhaps recommending instead for the
> user to install the Ogg DirectShow filters would be a better idea.
> The current author of said filters has been hacking its way to make
> them work on IE with <video> with successful results, as far as I
> know.
> Installing a plugin like Flash is no big deal for most users.
> Switching browsers, however, is a big no-no to the majority.

There are many ways to check if <video> is supported, here are a few
random ones (mostly equivalent):

var supported = typeof HTMLVideoElement != 'undefined';

var supported = document.createElement('video') instanceof HTMLVideoElement;

var supported = typeof document.createElement('video').play == 'function';

To figure out if Ogg Theora+Vorbis is supported, just use canPlayType.
Since there exists browser versions that support <video> but not
canPlayType or still return "no" instead of "", wrapping it like this
might be the safest:

function canPlayOgg() {
  var v = document.createElement("video");
  if (v.canPlayType) {
    var canPlay = v.canPlayType("video/ogg;codecs=theora,vorbis");
    return canPlay == "no" ? "" : canPlay;
  return "maybe";

In the end, the only way to know for sure if Ogg is supported is to
try playing it.

Philip Jägenstedt

More information about the theora mailing list