【问题标题】:I want to fit the video to the screen我想让视频适合屏幕
【发布时间】:2022-11-30 04:38:25
【问题描述】:
<!DOCTYPE html>
<html>
  <head>
  <style>
    .videosize {
position:absolute;
z-index:-1;
top:0;
left:0;
width:100%;
height:auto;
}
</style>
<script src="https://cdn.jsdelivr.net/npm/indigo-player@1/lib/indigo-player.js"></script>
</head>

  <body>
    <div id="playerContainer" class="videosize">
    <script>
      const config = {
        sources: [
          {
            type: 'hls',
            src: 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8',
          }
        ],
      };

      const element = document.getElementById('playerContainer');
      const player = IndigoPlayer.init(element, config);
          </script>
    </div>
  </body>
</html>

我想让视频适合屏幕并且需要禁用滚动。但它不是全屏,而是从屏幕溢出。我哪里做错了?

【问题讨论】:

    标签: html css html5-video live-streaming


    【解决方案1】:

    使 &lt;body&gt; 元素有一个类,其中 position: relativewidth: 100%overflow: hidden 已声明或使用内联 style="..."

    执行此操作后,视频应采用具有相对位置的父级宽度。

    【讨论】:

      猜你喜欢
      • 2023-03-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-29
      • 2016-08-25
      • 2015-03-29
      相关资源
      最近更新 更多