johndyer/mediaelement — Issue #305: Video fit/cover stretching to fit the container
Author: bez4pieci
Created: 2011-11-17 10:24:12+00:00
State: open

It would be great to introduce an option to stretch the video to fit (or cover) the container element, similarly as css background-size property does that for background images.

When in html5 mode, it's easily achievable with *not* specifying video size and in CSS adjusting width and height of the following elements:

.mejs-video video,
.mejs-video embed,
.mejs-video object,
.mejs-video .mejs-container,
.mejs-video .mejs-inner,
.mejs-video .mejs-layers,
.mejs-video .mejs-overlay,
.mejs-video .me-plugin { display: block; width: 100%; height: 100%; }

but in plugin mode it's not possible without changing the source code of flash/silverlight player.

for the flash player it's not more than changing scale mode from NO_SCALE to

stage.scaleMode = StageScaleMode.EXACT_FIT;

and changing the scaling mechanism in repositionVideo function:

_video.width = stage.stageWidth;
_video.height = stage.stageHeight;
(_video.scaleX < _video.scaleY)
? _video.scaleY = _video.scaleX
: _video.scaleX = _video.scaleY;

i have no clue, however, how to do it in silverlight. i hope this feature could be implemented — it's an awesome media player!!