0

I am currently trying to use the <video> tag to, obviously, display videos. If the user clicks on the video (or poster image) it will trigger my script to set the video to fullscreen through the requestFullScreen method. When I exit fullscreen mode, I attempt to catch this by using a listener like so:

document.addEventListener('fullscreenchange', function() {
    // This is never triggered, I never arrive here.
    if (isFullScreen) { // do something}
    else { // do something else}
}

I have similar listeners for mozfullscreenchange, msfullscreenchange and webkitfullscreenchange.

Now my problem is that for some android devices with some browsers, the listener is not triggered. For instance, on a Samsung Galaxy Note the listener is not triggered when using Chrome, while when using Asus Transformer with Chrome it works. However, if I use Firefox on the same two devices, it only works on Samsung Galaxy Note and not the Asus Transformer.

Is there a simple explanation to this inconsistency? Have I done something wrong? Is there perhaps some different events I should listen to on different versions of Android and browsers?

Uirri
  • 263
  • 1
  • 10
  • 1
    possible duplicate of [Detect fullscreen mode](http://stackoverflow.com/questions/16755129/detect-fullscreen-mode) – bencripps Jul 29 '14 at 14:02
  • True. How could I have missed that one :p. Will see if this solves my problem. – Uirri Jul 29 '14 at 14:05
  • Depending on your needs. But you might want to consider using a JS player to help you with these issues. for example videojs.com – Ramy Nasr Jul 29 '14 at 14:45
  • I have a rather strict restriction to the use of plugins, sadly. I couldn't get it to work so I guess I'm forced to provide a fallback for browsers+devices which do not have the desired events. Thanks for the help! – Uirri Jul 30 '14 at 08:18

1 Answers1

1

You have missed the last outter right parenthesis. Also two curly brackets are commented away.

  • Upvoting because this is the solution (though I don't see the 2 commented curly brackets). Still upvoting the question because there's still a problem somewhere else. I'm using a Galaxy S9+, and Chrome throws the event, but Firefox doesn't. – trysis Sep 12 '18 at 20:03
  • The missing curly brackets hide in the comments... { // do something} should be { /* do something */ } –  Apr 19 '19 at 11:26
  • And... I counted 3 of '(' and 2 of ')'. It should always count the same. –  Apr 19 '19 at 11:33
  • Yes... not sure why I put that in my comment. – trysis Apr 20 '19 at 12:05
  • I edited it now.. hope you can see there are /* ... */. It may take a while to peer review. My post may be irrelevant and removed, if it is okay for you. –  Apr 20 '19 at 20:02