[whatwg] VIDEO tag height/width best fit

Ian Hickson ian at hixie.ch
Mon Oct 13 15:52:14 PDT 2008


On Tue, 12 Aug 2008, João Eiras wrote:
> 
> In this regard, <video> should be handled like <img>.
>
> While handling an image, if you specify a width and leave height as 
> auto, the UA will resize the height to keep the aspect ratio, because 
> the UA known the images intrinsic dimensions. The same behavior happens 
> if you specific height and leave width as auto. IF you specifi non, 
> intrinsic dimensions will be used.
> 
> So, for <video>, the behavior should be the same. The UA knowns the 
> video file intrisinc dimensions, so the samebehavior can be applied too.
> 
> This way we would not overspecify new behavior, which is good, and IMO 
> enough, therefore simplifying the work of the web authors by reusing the 
> old algorithm used for images.

For <video> we're treating the element as a canvas, rather than as 
representing the video itself -- so the dimensions give the dimensions of 
the canvas, and then the video data gets rendered in the correct ratio 
filling as much of the video as possible. It's like a TV -- it's one size, 
and the video data is shown letter boxed to fit within the screen. Your TV 
doesn't size to fit the video data. :-)

(Unlike with images, where the frames are constructed to fit each image 
they are to contain.)

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the whatwg mailing list