如何使视频具有相同的形状和高度

How to make videos same shape and height

我已经将两个视频上传到数据库并且正在我的网站上显示。我试图使它们具有相同的形状和高度。宽度很好,但其中一个形状像正方形,高度较长,而另一个是矩形,高度较短,我知道这是因为拍摄视频的方式,一个是垂直拍摄的,另一个是水平拍摄的。我如何让它们具有相同的形状和高度。你能帮帮我吗?

     I tried this 

    <video class="video1" id="cb" preload="auto" video="src="{{$proo->video}}#t=1""   style=" height:80%; max-height:20em; width:100%; max-width:20em; object-fit: cover; 
 float:left; clear:both; 
     padding-left:2%;  margin-top:0px;     cursor:pointer; "><source="video1.jpg" playsinline alt="Video Unavailable"   id="" ></source>
  </video>

      this the javascript part to  handle the onclick,onmouseleave


  $(document).on('mouseover touchstart', 'video', function() { 
        $(this).get(0).play();
        this.muted=true;
    }); 



    //pause video on mouse leave
    $(document).on('mouseleave', 'video', function() { 

        this.currentTime = 1;
        $(this).get(0).pause(); 

    });

    $(document).on('click touchstart', 'video', function() { 
        $(this).get(0).play();
        this.muted=false;
        this.currentTime = 0;

    }); 

当我需要在 iframe 中输出 YouTube 视频时,我想到了这个小东西,它的响应非常灵敏,这意味着它会根据当前屏幕尺寸调整其高度和宽度。

<style>
       #mediaPlayer{
        position: relative;
        height: auto;
        padding-bottom: 56.25%;
        padding-top: 1.875em; 
        overflow: hidden;
        border: 0.1875em double #185875; 
        background-image:url('../video_loading.gif'); 
        background-repeat: no-repeat;
        background-size: cover;
        -webkit-background-size: cover;
        -moz-background-size: cover;
        -o-background-size: cover;
        background-position: center;
        background-attachment: fixed;
       }

    #mediaPlayer iframe{
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        max-width: 100%;
        max-height: 100%;   
    }
</style>

/*use the div to specify the exact height and width you want*/ 

<div style="height: 50%; width:50%;">
 <center>
  <div id="mediaPlayer">
    <iframe id="play_now" width="100%" height="100%" src="source here" value="value here" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
  </div>
 </center>
</div>

对于网络速度较慢的用户来说,video_loading.gif 背景通常是一个好主意,可以在您的 iframe 内容加载时在后台设置一些东西

但您必须找到自己独特的 gif file/image 并在 background-image:url('../file-location-here.gif');

中设置它的位置