MediaElement.js - how to dynamically resize a video?

I know how to upload videos in different sizes, but I cannot figure out how to change them. For example, in my application you can resize the video panel - I would like to resize the video. The problem is that multiple elements were created, and I tried to avoid resizing each child element and just use some built-in function.

I discovered this option , but he looked a little tough decision.

+3
source share
2 answers
<div id="video-wrapper">
    <video width="640" height="360" style="width: 100%; height: 100%;" id="player1">
        <source/>
    </video>
</div>

demos/mediaelementplayer-responsive.html 2.9.3 ( github). , , ... ! - ( jquery):

var newHeight = 360 / 640 * newWidth;
$('#video-wrapper').css('width',newWidth);
$('#video-wrapper').css('height',newHeight+'px');
+4

YouTube Vimeo " " : http://FitVidsjs.com/

, WordPress MediaElement.js; , . , 2 .:)

0

All Articles