目录

What should I do if the video component is covered by the page content during fullscreen playback?

Symptom

A developer applies position: absolute to a component on the page, sets the CSS z-index value to 100000, and uses the video component to load a video on the page. After a user triggers fullscreen playback, the custom content is displayed on top of the video.

For example, create an ASCF page with the following content:

<view class="page">
  <view class="nav-title">Custom content</view>
  <video src="https://www.example.com/demo.mp4" controls="true"></video>
</view>

The style-related code is as follows:

.nav-title {
  width: 100%;
  height: 50px;
  background: white;
  color: red;
  font-size: 24px;
  padding-top: 18px;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 100000;
}

Possible causes

Fullscreen playback of the video component is implemented using position: absolute. To prevent the fullscreen video from being obscured, the component is assigned a fixed z-index value (99999). If z-index is also set for other components on the page, the rendering engine compares these z-index values during rendering. The component with the highest z-index value is displayed on the top layer. Therefore, if the z-index value of another component is greater than 99999, it will cover the fullscreen video.

Solution

Check whether other CSS styles set a z-index value greater than 99999. If so, set the z-index value to be less than 99999.