Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting Event change in fullscreen mode Internet explorer

I am trying to write an event handler that detects whether a video player I have is in fullscreen or 'regular' mode.

I have tried using

 document.addEventListener("fullscreenchange", myfunc, false);

but this doesn't work in IE, I have implemnted the same thing for firefox and chrome using webkitfullscreenchange and mozfullscreenchange event. Is there any other event I can use in IE for this? Or another way of doing this?

Any help would be appreciated. Thanks!

like image 457
lboyel Avatar asked Apr 17 '13 20:04

lboyel


2 Answers

You have jQuery, so use it:

var screen_change_events = "webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange";
$(document).on(screen_change_events, function () {

});

(addEventListener isn't supported in versions earlier than IE 9 anyways)

At the same time, it doesn't look like full screen is supported in any version of IE:

  • http://caniuse.com/fullscreen

MDN Reference:

  • https://developer.mozilla.org/en-US/docs/DOM/Using_fullscreen_mode

Here's a possible hack around it:

  • onfullscreenchange DOM event
like image 156
Ian Avatar answered Oct 04 '22 02:10

Ian


There is a jQuery plugin named jquery-fullscreen that will do exactly what you want. Until the Fullscreen-API standard has crystallized this is probably the best option.

You can also use the Modernizr fullscreen-api check and shim it if the browser doesn't support it by firing the event yourself (see this question for a detection method)

like image 37
dtech Avatar answered Oct 04 '22 04:10

dtech