How can I make HTML 5 video playback fit to frame instead of maintaining aspect ratio?

后端 未结 6 1763
渐次进展
渐次进展 2021-02-03 11:14

I\'ve been experimenting with HTML5 video playback. For example I have this video object embedded on my page:

6条回答
  •  無奈伤痛
    2021-02-03 11:35

    Yes, I do think theres is at least one way to do it, but it's quite ugly: Scale the video element using CSS Transforms (or maybe SVG). The problem is that I think you would have to some Javascript to calculate the appropriate scale ratio based on the size of the container.

    The good news would be that WebKit and Gecko has supported CSS Transforms for quite some time and also Opera 10.50 supports it. And they all support SVG.

    http://dev.opera.com/articles/view/css3-transitions-and-2d-transforms/#transforms https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Transforms/Using_CSS_transforms

提交回复
热议问题