Is there a way to overlay a over a fullsc

2019-02-14 07:01发布

问题:

I'm using videojs to play video, and I've done some manipulation on the video content frame by frame and display it in a <canvas> (ID: 'display').

When the video is playing, <canvas> can display in front of the <video> with the following css.

<style type="text/css">
    canvas#display {
        z-index: 1;
        postion: relative;
        top: some-video-height-px;
    }

    video#videoDiv_html5_api {
        z-index: -2;
    }

    div.vjs-controls {
        z-index: 3;
    }

</style>

It seems that z-index attribute is not working when <video> enters full screen mode. It keeps in the front and <canvas> cannot overlay over <video>


In W3C Documents https://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#ui

we have

:fullscreen {
  position:fixed;
  top:0;
  left:0;
  right:0;
  bottom:0;
  z-index:2147483647;
  box-sizing:border-box;
  margin:0;
  width:100%;
  height:100%;
}

It seems that z-index has been set to the Integer.MAX_VALUE...

回答1:

I find the answer myself. you just need to set the canvas.style.z-index to be 2147483647, then the will cover