Skip to content

Video maximum height rule is not enforced for fluid mode #7612

Open
@pavlexander

Description

@pavlexander

Description

Fluid mode, while allowing the height to auto-adjust - completely ignores the maximum height, therefore making the video non-responsive to viewport size changes.

Steps to reproduce

  1. Set the fluid: true flag, enforce max-height: 60vh rule.
  2. Try resizing the viewport - max-height rule is ignored when viewport size is <60vh

Results

Expected

Video is scaled down

image

Actual

Video remains in original height

image

Additional Information

versions

videojs

7.17.0

browsers

all (Chrome, Opera)

OSes

Win 10 (all?)

Code to reproduce

<div class="container-fluid">
  <div class="row g-1">
    <div class="col-6 text-center">
      <h3>Video</h3>
    </div>
    <div class="col-6 text-center">
      <h3>Image</h3>
    </div>
  </div>
  <div class="row g-1">
    <div class="col-6">
      <div id="carouselExampleControls" class="carousel" data-bs-interval="false">
        <div class="carousel-inner">
          <div class="carousel-item active">
            <video id="my_video_1" class="video-js vjs-default-skin vjs-big-play-centered vjs-show-big-play-button-on-pause carouselitemmedia" controls preload="auto" data-setup='{ "fluid": true  }'>
              <source src="http://vjs.zencdn.net/v/oceans.mp4" type='video/mp4'>
            </video>
          </div>
          <div class="carousel-item">
            <img src="https://dummyimage.com/960x400/000/fff." class="carouselitemmedia">
          </div>
        </div>
        <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleControls" data-bs-slide="prev">
          <span class="carousel-control-prev-icon" aria-hidden="true"></span>
          <span class="visually-hidden">Previous</span>
        </button>
        <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleControls" data-bs-slide="next">
          <span class="carousel-control-next-icon" aria-hidden="true"></span>
          <span class="visually-hidden">Next</span>
        </button>
      </div>
    </div>
    <div class="col-6">
      <div id="carouselExampleControls2" class="carousel" data-bs-interval="false">
        <div class="carousel-inner">
          <div class="carousel-item">
            <video id="my_video_1" class="video-js vjs-default-skin vjs-big-play-centered vjs-show-big-play-button-on-pause carouselitemmedia" controls preload="auto" data-setup='{ "fluid": false, "fill": false  }'>
              <source src="http://vjs.zencdn.net/v/oceans.mp4" type='video/mp4'>
            </video>
          </div>
          <div class="carousel-item active">
            <img src="https://dummyimage.com/960x400/000/fff." class="carouselitemmedia">
          </div>
        </div>
        <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleControls2" data-bs-slide="prev">
          <span class="carousel-control-prev-icon" aria-hidden="true"></span>
          <span class="visually-hidden">Previous</span>
        </button>
        <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleControls2" data-bs-slide="next">
          <span class="carousel-control-next-icon" aria-hidden="true"></span>
          <span class="visually-hidden">Next</span>
        </button>
      </div>
    </div>
  </div>
</div>
body: {
  height: 100%;
  width: 100%;
}

#column {
  height: 100vh;
  width: 40vw;
  background-color: grey;
}

.carousel {
  width: 100%;
  background-color: red;
}

.carousel-item {
  text-align: center;
}

.carouselitemmedia {
  max-width: 100%;
  max-height: 60vh;
}

.video-js {
  background: content-box;
}

Fiddle: http://jsfiddle.net/w5v7f6ut/1/

When vh > 60 (OK)

image

I can manage to achieve the expected result by disabling the fluidicity (fluid: false), but then when the vh > 60 - video is no longer fitting the content size:

image

If the result is expected - could you tell if it's possible to achieve a mix of fit-fluid mode somehow?

Metadata

Metadata

Assignees

No one assigned

    Labels

    outdatedThings closed automatically by stalebot

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions