-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Video EXIT fullscreen with ESC key giving wrong isFullscreen info #5814
Comments
Yeah, things got a bit hairy in recent chrome when they un-prefixed the fullscreen API. We have plans on refactoring how we handle fullscreen related stuff but that isn't a short term solution. |
@gkatsev Yes, as I stated in my inline code comments, I did get it working with a SetTimeout wrapper, so I'll stick with that until hopefully the refactor finds a good solution. Did you want to leave the issue open for addressing subsequently, or if not then close as you see fit. Thanks. |
Ah, cool, totally missed that. |
Actually, the setTimeout hack didn't solve my issue. I have just realised that whilst setTimeout did fix the issue with ESC, it concurrently broke the Video Fullscreen Exit Button (which works without the setTimeout). So, it's XOR. You can't have both. isFullscreen() will always report falsely as the result of one or the other. Will leave this issue open as suggested. |
Have a live example of what you're seeing? |
Sure, open:
Then, play video, make it fullscreen with Video Fullscreen Button. |
Closed via 3fbc4f5 |
Hello @richardbushell I checked the code and found the fullscreenchange will fire before documentFullscreenChange_ while use esc on fullscreen mode. And I have no idea with that. Still use setTimout to solve problem. |
@lanxan Yes, the fix mentioned above was actually a bug fix for the separate Nested Fullscreen issue: I actually closed this thread at the same time (only because I'd worked around it using alternative methods so I no longer relied upon the timing), but you are correct that the timing of the event firing with the ESC key remains inconsistent against exiting via the video fullscreen-exit button. I haven't looked at the official spec for ESC but I wonder if this uses Capture rather than Bubble phasing as the order seems inconsistent between the two. Please re-open the issue if you wish. |
Going to re-open this. The issue has to do with how we know whether things change and when we trigger the fullscreenchange event on the player. Things broke with Chrome unprefixing the fullscreen API as it changed our expectations of event ordering, which is why current you'll need a setTimeout. |
OK, in advance of looking at a possible fullscreen refactor, let me donate some code ideas:-
You obviously wouldn't need to use BOTH pseudo-class tests concurrently (I include them only for reference and discussion). Bizarrely, the only way to definitively test whether on element is fullscreen is through CSS! Several elements can be fullscreen concurrently, only one of which is topmost in the fullscreen Stack. But it is a Stack, not an array, and only the topmost element in the stack is exposed to standard Javascript methods, but CSS provides a way to know whether the element is in the fullscreen stack. See: whatwg/fullscreen#70 (comment) And my test page here:- |
p.s. Firefox, Edge, and IE (amazingly) do report ALL fullscreen elements correctly when several are fullscreen concurrently. Chrome and WebKit (Safari) have bugs filed (by me) to fix this. BUT when fixed the fullscreen pseudo-class test should probably be the only test required to determine if an element is fullscreen. |
I have submitted a PR here: |
One idea I had for fixing this without needing a whole refactor of the entire fullscreen workflow is to update our checks (maybe even if we're not using prefixed APIs) to see whether |
For non-prefixed APIs, check directly against the fullscreen element rather than using the cached value. Fixes #5814.
@richardbushell hey, can you give #6009 a test? (for example, via https://deploy-preview-6009--videojs-docs.netlify.com/test-example/) |
Apologies, I have been away on vacation, but saw that you were doing some work on this. I am back next week so hopefully will have a chance to test too. Thanks. |
@gkatsev Yep, works as expected now, so LGTM. |
Thanks for verifying! |
For non-prefixed APIs, check directly against the fullscreen element rather than using the cached value. Fixes #5814.
I am currently having the same issue, although strangely, this sandbox works for me. I am using videojs.7.6.6 straight from the CDN.
In the console, I always see what's happening here? :/ |
Hi
When exiting Video Fullscreen using the ESC key, I get an incorrect value back from the fullscreenchange listener. BUT it's fine when exiting with the Video Fullscreen Exit Button instead.
Here's my self-explanatory function used to test, with notes inline.
Is this a known issue? Is there already a best-practice or solution to this as we were getting entirely inconsistent behaviour.
Please advise, thanks.
The text was updated successfully, but these errors were encountered: