[whatwg] VIDEO tag height/width best fit

João Eiras joao.eiras at gmail.com
Mon Aug 11 17:12:54 PDT 2008


Hi !

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.

Bye.


On , Biju Gm at il <bijumaillist at gmail.com> wrote:

> I apologize if I did not understood
> http://www.whatwg.org/specs/web-apps/current-work/#video
>
> I see a situation where we want to specify the height and width of the
> BOX in which a video need to be displayed. And while writing HTML code
> we dont know the height/width of the video. But when playing we want
> the video to be displayed with maximum size which can fit in the BOX
> without loosing the aspect ratio.
>
> After reading the <video> tag specification I dont see a way to
> achieve this with out javascript code.
>
> We should have one more attribute to tell how to "fit" the image/video
>
> == "fit" attribute values ===
> * center          - if it is small keep at center
> * stretch         - stretch/skew height and width to fit
> * stretch-height  - stretch/skew height only to fit,
>                     adjust width to maintain aspect ratio.
> * stretch-width   - stretch/skew width only to fit,
>                     adjust height to maintain aspect ratio.
> * stretch-best    - stretch/skew height or width to maximum
>                     so that other will fit in
>                     and maintain aspect ratio.
>
> May be we can also have a "tile" option
>
> This problem also exist for <img> tag.





More information about the whatwg mailing list