[whatwg] HTML5 video <source> dimensions and bitrate

Chris Double chris.double at double.co.nz
Mon Aug 9 17:23:35 PDT 2010

On Tue, Aug 10, 2010 at 11:00 AM, Zachary Ozer <zach at longtailvideo.com> wrote:
> As a result, I was wondering if there's some way to attach metadata
> like the dimensions and bitrate to <source> elements of
> HTMLMediaElements in the DOM. I realize that we could wait for
> metadata to arrive for each source, but it would be nice if it was
> possible to make an intelligent choice before attempting to play all
> of them.

You don't get metadata for each source, you only get the metadata for
the source that is actually selected to play. I don't think listing
video's which are only different due to bitrate in the source as being
a good approach since most players will iterate through all sources
trying to play them. So if you have 5 '.ogg' videos first in the
source list, different only by bitrate, a non-ogg player is going to
check each of those, possibly sniffing them and causing network

Since your player is already JavaScript is having a JS object holding
the URL, dimensions and bitrate not an option? Or you could have a
seperate file that is retrieved via XMLHttpRequest that is parsed to
extract these details and dynamically adjust 'source' elements after

How are you working out the current playback rate to decide when to
switch to a different bitrate version? Is having an attribute of the
media element that contains this information useful?


More information about the whatwg mailing list