Javascript - fullscreen API issue webkit browsers

677 Views Asked by At

I have a script where I can toggle a fixed DIV in FullScreen mode. This div can also contains an HTML5 video which allows fullscreen (a video in a lightbox for example). However, in webkit browsers it creates a big conflict if the div goes in fullscreen and the div is also in fullscreen. When the fullscreen mode is exited from the video player and the div, the layout is completely destroy because webkit browser still think that we are in FullScreen mode... In fact when everything is not in FullScreen, the user user agent stylesheet for the HTML5 video (:-webkit-full-screen-ancestor:not(iframe)) is still present and even with !important rules it doesn't change anything.

Does anyone have a solution about this issue? Is there some workarounds or maybe a way to turn off fullscreen from the DIV before the video goes in fullscreen...

Here a small example (the video styles are not preserved when turn off fullscreen): https://fiddle.jshell.net/VbfPC/4/

It's working fine in IE, FireFox but not in Google Chrome and Safari.

0

There are 0 best solutions below