26

I want to add overlay hotspots on a html5 video which will help me give info about that video. I was able to successfully add it on HTML5 Video's normal mode. But, when i change the video mode to fullscreen, it disappears. Want someone to help me please!!!.

Suraj Jadhav
  • 632
  • 1
  • 5
  • 19

2 Answers2

33

The best way to do this is to have a <div> containing the <video> and hotspots, and request fullscreen on the containing <div>.

I implemented the fullscreen and (parts of the) <video> APIs in Firefox. This z-index hack isn't the specified behaviour, so it will stop working once we update our implementation to match the latest draft of the W3C fullscreen spec.

soviet-onion
  • 3
  • 1
  • 3
Chris Pearce
  • 371
  • 3
  • 4
  • Spent half a day trying to figure out the z-index thing below in Firefox. This is a much better solution. – Cody Moniz Dec 08 '16 at 20:06
  • I don't think this is possible using the video control's fullscreen button which will set the video to fullscreen and can't be cancelled. – junvar Sep 22 '19 at 18:27
  • @junvar - maybe overlay the fullscreen button as well? – Ropstah May 16 '20 at 00:23
  • 1
    as a chrome extension, NOT web dev, is there any way to fullscreen the `
    ` containing the video, if the video was fullscreened using video fullscreen button: this emits no clickevent, so there's no way to exitFullScreen, then enterFullScreen of container `div`(requires user input!), one workaround I can think of is to replace the native controls of EVERY `video` with custom buttons, of which I can listen to the clickevent. W3C spec Solutions? : add onclick/keydown event to video fullscreen button. OR make onfullscreenchange able to call requestFullscreen if it DID come from mouse/keyboard
    – Mr. Doge Oct 14 '21 at 22:01
19

This can be solved with a trick. Have a look on this example here: http://jsfiddle.net/carmijoon/pZbkX/show/

z-index: 2147483647;

You can also see the code here: http://jsfiddle.net/carmijoon/pZbkX/

z-index: 2147483647;

you need to add maximum value of z-index which is (z-index: 2147483647;) in to the overlay element. That trick will solve your issue.

Can you also share your file on jsfiddle?

Carmijoon
  • 477
  • 5
  • 11