-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix(Xbox): Support screen resolution detection on Xbox when using WebView2 #7144
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
to be manually added like this when initializing your WebView2: | ||
|
||
```CSharp | ||
webView.CoreWebView2.Settings.UserAgent += " Xbox One"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there some improvement we could make to UA detection to understand WebView2 as Xbox One without this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based only on the user agent, I don't think it will be possible:
Edge Chromium on Windows 11:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 Edg/127.0.0.0
WebView2 on Xbox (not modified):
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0
They are basically the same, except for the Chrome/Edge version, which is a bit newer on Windows.
Maybe that detecting the presence of the WinRT APIs could be enough. Something like
static isXboxOne() {
return shaka.util.Platform.userAgentContains_('Xbox One') || typeof Windows !== 'undefined' || typeof chrome?.webview?.hostObjects?.sync?.Windows !== 'undefined';
}
But it could still be a UWP running on Windows... Maybe there's a way to get the device type from WinRT once we can access to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, thanks for considering it. We are very open to improvements in detection later.
Incremental code coverage: 0.00% |
Thank you for contributing, and for writing a good PR description / commit message. It's very helpful. |
Resolves #7141