Skip to content
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

Merged
merged 4 commits into from
Aug 8, 2024

Conversation

massicottem
Copy link
Contributor

Resolves #7141

Copy link
Contributor

@Boubalou Boubalou left a 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";
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

@shaka-bot
Copy link
Collaborator

Incremental code coverage: 0.00%

@joeyparrish joeyparrish merged commit d93a019 into shaka-project:main Aug 8, 2024
12 of 15 checks passed
@joeyparrish
Copy link
Member

Thank you for contributing, and for writing a good PR description / commit message. It's very helpful.

@massicottem massicottem deleted the fix-xbox-webview2 branch August 8, 2024 18:52
avelad pushed a commit that referenced this pull request Aug 19, 2024
avelad pushed a commit that referenced this pull request Aug 19, 2024
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Oct 7, 2024
@shaka-project shaka-project locked as resolved and limited conversation to collaborators Oct 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't play 4k content on Xbox using WebView2
4 participants