Javascript Element.requestFullscreen () - undefined
If it requestFullscreen
returns undefined
, it means that you cannot ask for full screen mode, because this function does not exist. Every browser other than IE10 and below supports it, but you need to use the right vendor prefix as you commented. A good way to do this is to do
var requestFullScreen = elem.requestFullscreen || elem.msRequestFullscreen || elem.mozRequestFullScreen || elem.webkitRequestFullscreen;
I think your problem is that you have defined some functions incorrectly. this is confusing because Mozilla uses .mozRequestFull S , while others use requestFull s . Capital S can be annoying.
where elem
is an element video
from the DOM. Then you can do requestFullScreen.call(elem)
and it will start full screen.
And as @ArunPJohny commented, definitely take a look at the MDN article .
source to share