我已经在此容器中尝试使video.js响应。请让我知道我该怎么做。我尝试了很多,但在移动视图中,其控件始终浮出播放器,并且不固定在其位置:http://jsbin.com/idinaf/627/edit

videojs.autoSetup();

videojs('example_video_1').ready(function(){
  console.log(this.options()); //log all of the default videojs options

   // Store the video object
  var myPlayer = this, id = myPlayer.id();
  // Make up an aspect ratio
  var aspectRatio = 264/640;

  function resizeVideoJS(){
    var width = document.getElementById(id).parentElement.offsetWidth;
    myPlayer.width(width).height( width * aspectRatio );

  }

  // Initialize resizeVideoJS()
  resizeVideoJS();
  // Then on resize call resizeVideoJS()
  window.onresize = resizeVideoJS;
});

最佳答案

对于较小的屏幕,应使用媒体查询来更改播放器控件的css。
我是用这种方式做到的,而且有效。希望它也对您有用。

07-24 09:54
查看更多