Bug 251648

Summary: Unable to enter fullscreen in Counterstrike (http://game.play-cs.com) in Safari 16.3
Product: WebKit Reporter: Saam Barati <saam>
Component: New BugsAssignee: Andy Estes <aestes>
Status: RESOLVED FIXED    
Severity: Normal CC: aestes, jer.noble, mmaxfield, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 16   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=262963
Attachments:
Description Flags
Reduced testcase none

Description Saam Barati 2023-02-02 16:23:54 PST
http://game.play-cs.com is a website to play counterstrike in the browser. It's super buggy in Safari:
- It doesn't have sound
- Fullscreen doesn't work properly. Safari is constantly entering/exiting full screen every second or so.
Comment 1 Saam Barati 2023-02-02 16:30:45 PST
(In reply to Saam Barati from comment #0)
> http://game.play-cs.com is a website to play counterstrike in the browser.
> It's super buggy in Safari:
> - It doesn't have sound
> - Fullscreen doesn't work properly. Safari is constantly entering/exiting
> full screen every second or so.

There are lots of bugs around full screen. It seems to work a bit better if you full screen Safari itself using native macOS UI. But if you press the fullscreen button in the game without full screening the macOS app, that's when I was seeing the above bug.

Now, I just encountered a different bug. If I fullscreen in the macOS Safari window UI, and then press the full screen button in the game, sometimes it'll kick me out from the desktop that Safari is full screened in, and take me back to the desktop that doesn't have Safari in it.
Comment 2 Radar WebKit Bug Importer 2023-02-02 17:23:01 PST
<rdar://problem/104984915>
Comment 3 Saam Barati 2023-02-02 17:29:22 PST
I’m seeing this in Safari 16.3
Comment 4 Myles C. Maxfield 2023-02-02 17:35:01 PST
Saam says:

"It worked properly my first time through, but playing around with entering/exiting made madness ensue. Repro might not be 100%, though whatever it is my machine seems to hit it every time now. I quit and relaunched, and that didn’t fix it."
Comment 5 Tim Nguyen (:ntim) 2023-03-30 17:56:29 PDT
Created attachment 465694 [details]
Reduced testcase

Seems like a visibilitychange event is triggered when entering fullscreen, which triggers an event listener on the page that exits fullscreen.

Here is a reduced testcase.
Comment 6 Andy Estes 2023-10-09 21:20:14 PDT
*** Bug 262939 has been marked as a duplicate of this bug. ***
Comment 7 Andy Estes 2023-10-09 21:25:44 PDT
Re-titling to make this about the fullscreen issue. Let's track the audio issue in a new bug.
Comment 8 Andy Estes 2023-10-09 21:43:00 PDT
Pull request: https://github.com/WebKit/WebKit/pull/18883
Comment 9 Jer Noble 2023-10-10 09:24:17 PDT
Hi Saam! Aside from Andy's PR, why is play-cs.com exiting fullscreen when visibility changes? That means users can't switch spaces in Mac fullscreen without their game exiting. That's super annoying!
Comment 10 Jer Noble 2023-10-10 09:25:17 PDT
For the audio issue, if play-cs.com makes use of WebAudio, this commit may interest you: https://commits.webkit.org/268047@main
Comment 11 Andy Estes 2023-10-10 10:08:38 PDT
Filed https://bugs.webkit.org/show_bug.cgi?id=262963 to track the audio issue.
Comment 12 EWS 2023-10-10 10:11:13 PDT
Committed 269150@main (7e8c765bf94d): <https://commits.webkit.org/269150@main>

Reviewed commits have been landed. Closing PR #18883 and removing active labels.