video dimensions are handled correctly

fixes: #1
This commit is contained in:
buttle 2021-08-28 15:33:08 +02:00
parent a8d2c3ac66
commit f4d75b5b78
2 changed files with 14 additions and 6 deletions

View File

@ -26,7 +26,7 @@ class VimeoMediaIngester implements IngesterInterface
} }
public function getLabel() public function getLabel()
{ {
return 'Vimeo model'; // @translate return 'Vimeo video'; // @translate
} }
public function getRenderer() public function getRenderer()
{ {

View File

@ -3,7 +3,7 @@ $this->headScript()->appendFile($this->assetUrl('js/height_calculator.js',
'Vimeo')); 'Vimeo'));
?> ?>
<div id="vimeo_<?= $video_id ?>" class="vimeo-wrap" style="position:relative;"> <div id="vimeo_<?= $video_id ?>" class="vimeo-embed-wrapper" style="position:relative;">
<?php if ($renderSourceLink) { ?> <?php if ($renderSourceLink) { ?>
<div class="source-link"> <div class="source-link">
@ -22,10 +22,18 @@ $this->headScript()->appendFile($this->assetUrl('js/height_calculator.js',
</div> </div>
<script> <script>
function adjust_height() {
$(".vimeo-embed-wrapper").each(function() {
var iframe = $(this).find('iframe')
$(iframe).prop("width", "<?= $width ?>%")
var height = get_height(iframe, <?= $ratio ?>)
$(iframe).prop("height", height)
});
}
jQuery(document).ready(function() { jQuery(document).ready(function() {
var vimeo = $("#vimeo_<?= $video_id ?>").find('iframe'); adjust_height();
$(vimeo).prop("width", "<?= $width ?>%") });
var height = get_height(vimeo, <?= $ratio ?>) $( window ).resize(function() {
$(vimeo).prop("height", height) adjust_height();
}); });
</script> </script>