Compare commits

..

18 Commits

Author SHA1 Message Date
a318db4ec2 Update better-xcloud.user.js 2023-07-16 15:56:08 +07:00
aaa8348984 Update README.md 2023-07-16 15:55:44 +07:00
2cea30cf16 Check support of RTCRtpTransceiver.setCodecPreferences() 2023-07-16 15:50:44 +07:00
0fe99f8f2d Update README.md 2023-07-16 15:16:43 +07:00
0cb09bb455 Update README.md 2023-07-16 12:41:51 +07:00
14cf9d5877 Stop recommending changing User-Agent 2023-07-16 12:39:28 +07:00
b96b115182 Bump version to 1.3 2023-07-16 12:30:55 +07:00
766c5b8682 Update README.md 2023-07-16 12:30:14 +07:00
5f9564de45 Update CSS of reload page button 2023-07-16 12:01:22 +07:00
3a7dea6c75 Add missing code 2023-07-16 11:54:40 +07:00
8dd17bb021 Add setting to force HQ codec 2023-07-16 11:54:23 +07:00
e63f998f5a Update README.md 2023-07-16 06:43:49 +07:00
0685cd8038 Update README.md 2023-07-15 21:48:05 +07:00
f246faf796 Update README.md 2023-07-15 21:26:10 +07:00
68ef703bdb Update README.md 2023-07-15 21:17:01 +07:00
f9d683a2e4 Update README.md 2023-07-15 21:11:51 +07:00
fec2c4a22a Update README.md 2023-07-15 21:04:15 +07:00
c3df18d7be Update README.md 2023-07-15 20:59:10 +07:00
2 changed files with 136 additions and 54 deletions

121
README.md
View File

@ -1,24 +1,39 @@
# Better xCloud # Better xCloud
Improve [Xbox Cloud Gaming (xCloud)](https://www.xbox.com/play/) experience on web browser. Improve [Xbox Cloud Gaming (xCloud)](https://www.xbox.com/play/) experience on web browser.
The main target of this script is Android users, but it should work great on desktop too. The main target of this script is mobile users, but it should work great on desktop too.
Give this project a 🌟 if you like it. Thank you.
## Features ## Features
<img width="500" alt="Settings UI" src="https://github.com/redphx/better-xcloud/assets/96280/db9b4f88-6958-4ec8-90cb-3cf37da5ab26"> <img width="500" alt="Settings UI" src="https://github.com/redphx/better-xcloud/assets/96280/4f60c2e6-9706-4326-940f-f46998177633">
<img width="500" alt="Video Settings UI" src="https://github.com/redphx/better-xcloud/assets/96280/130aa870-6938-4604-9e23-45e217b800cc"> <img width="500" alt="Video Settings UI" src="https://github.com/redphx/better-xcloud/assets/96280/130aa870-6938-4604-9e23-45e217b800cc">
- **Switch region of streaming server**
- Switch region of streaming server. > Connect to another server instead of the default one. Check [FAQ section](#faq) for some notes.
- Prefer IPv6 streaming server (might reduce latency). - **Prefer IPv6 streaming server**
- Force HD stream by disabling bandwidth checking -> xCloud always tries to use the best possible quality. > Might reduce latency
- Skip Xbox splash video (save 3 seconds). - **Force high quality stream**
- Make the top-left dots icon invisible while playing. You can still click on it, but it doesn't block the screen anymore. > Force xCloud to use the best streaming codec profile (same as desktop). You don't have to change User-Agent anymore.
- Stretch video to full sctreen. Useful when you don't have a 16:9 screen. > Some browsers (like Firefox) don't support this feature. Check [the full list](https://caniuse.com/?search=setCodecPreferences).
- Adjust video filters (brightness/contrast/saturation). > If you're on Android and want to use it, try [Hermit](https://hermit.chimbori.com).
- Hide footer and other UI elements. - **Disable bandwidth checking**
- Reduce UI animations (the smooth scrolling cannot be disabled). > xCloud won't reduce quality when the internet speed is slow
- Disable social features (friends, chat...). - **Skip Xbox splash video**
- Disable xCloud analytics. The analytics contains statistics of your streaming session, so I'd recommend to allow analytics to help Xbox improve xCloud's experence in the future. > Save 3 seconds
- **Hide Dots icon while playing**
> You can still click on it, but it doesn't block the screen anymore
- **Reduce UI animations**
> Disable `transition` CSS property in some elements. The smooth scrolling cannot be disabled.
- **Stretch video to full sctreen**
> Useful when you don't have a 16:9 screen
- **Adjust video filters**
> Brightness/Contrast/Saturation
- **Disable social features**
> Features like friends, chat... Disable these will make the page load faster.
- **Disable xCloud analytics**
> The analytics contains statistics of your streaming session, so I'd recommend to allow analytics to help Xbox improve xCloud's experence in the future.
- **Hide footer and other UI elements**
## How to use ## How to use
1. Install [Tampermonkey extension](https://www.tampermonkey.net/) on suppported browsers. It's also available for Firefox on Android. 1. Install [Tampermonkey extension](https://www.tampermonkey.net/) on suppported browsers. It's also available for Firefox on Android.
@ -27,13 +42,52 @@ The main target of this script is Android users, but it should work great on des
- [Dev version](https://github.com/redphx/better-xcloud/raw/main/better-xcloud.user.js) - [Dev version](https://github.com/redphx/better-xcloud/raw/main/better-xcloud.user.js)
4. Refresh [xCloud web page](https://www.xbox.com/play/). 4. Refresh [xCloud web page](https://www.xbox.com/play/).
5. Click on the new "SERVER NAME" button next to your profile picture to adjust settings. 5. Click on the new "SERVER NAME" button next to your profile picture to adjust settings.
6. Optional but recommended: change your browser's User-Agent. Check the [User-Agent section](#user-agent) below for more info. 6. Don't forget to enable auto updating for the script in Tampermonkey.
7. Don't forget to reload the page after changing settings.
To update manually, just install the script again (you won't lose your settings).
## Compatibility
✅ = confirmed to be working
❓ = not yet tested
❌ = not supported (mostly because of lacking Userscript/extension support)
⚠️ = see custom notes
| | Desktop | Android | iOS |
|----------------------------------------|------------------|------------------|-----------------|
| Chrome/Edge/Chromium variants | ✅ | ❌ | ❌ |
| Firefox | ✅ | ✅ | ❌ |
| Safari | ✅<sup>(1)</sup> | ❌ | ✅<sup>(2)</sup> |
| [Hermit](https://hermit.chimbori.com) | ❌ | ⚠️<sup>(3)</sup> | ❌ |
Don't see your browser in the table? If it supports Tampermonkey/Userscript then the answer is likely **"YES"**.
<sup>1, 2</sup> Requires [Userscripts app](https://apps.apple.com/us/app/userscripts/id1463298887).
<sup>3</sup> NOT RECOMMENDED at the moment since its Userscript implementation is not working properly. Non-network related features (skip splash video, video settings...) still work. It's still my favorite app to play xCloud on because it's lightweight, supports Userscript (premium features, only $1.99) without having to install anything else. I built **Better xCloud** just so I could use it with Hermit.
## FAQ
1. **Will I get banned for using this?**
I think it's very unlikely that you'll get banned for using this. Most of the features only affect client-side, except for switching region of streaming server (you'll connect to another server instead of the default one). If you want to be safe just avoid using that. As always, use as your own risk.
2. **Why is it an Userscript and not extension?**
It's because not many browsers on Android support installing extensions (and not all extensions can be installed).
3. **I see "???" button instead of server's name**
That means Tampermonkey is not working properly. Please make sure you're using the latest version or switch to a well-known browser.
4. **Can I use this with the Xbox Android app?**
No you can't. You'll have to modify the app.
5. **Will you able to enable "Clarity Boost" feature on non-Edge browsers?**
No. "Clarity Boost" feature uses an exclusive API (`Video.msVideoProcessing`) that's only available on Edge browser for desktop at the moment.
## Acknowledgements
- [n-thumann/xbox-cloud-server-selector](https://github.com/n-thumann/xbox-cloud-server-selector) for the idea of IPv6 feature
- Icons by [Adam Design](https://www.iconfinder.com/iconsets/user-interface-outline-27)
## User-Agent ## User-Agent
Optional, as changing User-Agent won't guarantee a better streaming experience, but it's worth a try. You might need to install an external extension to do that. > You're no longer needed to change User-Agent since you can just use the **Force high quality stream** setting.
> I'll still keep this section because it has some interesting info.
It's recommended to change User-Agent to: Change User-Agent to:
``` ```
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.67 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.67
``` ```
@ -45,37 +99,6 @@ Other options (only do one of these):
- Add ` 36102dd3-6953-45f6-8b48-031fb95e0e0d` to become a Logitech G Cloud device. - Add ` 36102dd3-6953-45f6-8b48-031fb95e0e0d` to become a Logitech G Cloud device.
- Add ` 0ed22b6f-b61d-41eb-810a-a1ed586a550b` to become a Razer Edge device. - Add ` 0ed22b6f-b61d-41eb-810a-a1ed586a550b` to become a Razer Edge device.
## Compatibility
✅ = confirmed to be working
❓ = not yet tested
❌ = not supported (mostly because of lacking Userscript/extension support)
⚠️ = see custom notes
| | Desktop | Android | iOS |
|----------------------------------------|----------|------------------|-----|
| Chrome/Edge/Chromium variants | ✅ | ❌ | ❌ |
| Firefox | ✅ | ✅ | ❌ |
| Safari | ❓ | ❌ | ❓ |
| [Hermit](https://hermit.chimbori.com) | ❌ | ⚠️<sup>(1)</sup> | ❌ |
<sup>1</sup> NOT RECOMMENDED at the moment since its Userscript implementation is not working properly. Non-network related features (skip splash video, video settings...) still work. It's still my favorite app to play xCloud on because it's lightweight, supports both custom User-Agent and Userscript (premium features, only $1.99 for Userscript feature or $7.99 if you want both) without having to install anything else. I built **Better xCloud** just so I could use it with Hermit.
## FAQ
1. **Why is it an Userscript and not extension?**
It's because not many browsers on Android support installing extensions (and not all extensions can be installed).
2. **I see "???" button instead of server's name**
That means Tampermonkey is not working properly. Please make sure you're using the latest version or switch to a well-known browser.
3. **Can I use this with the Xbox Android app?**
No you can't. You'll have to modify the app.
4. **Will you able to enable "Clarity Boost" feature on non-Edge browsers?**
No. "Clarity Boost" feature uses an exclusive API (`Video.msVideoProcessing`) that's only available on Edge browser for desktop at the moment.
## Acknowledgements
- [n-thumann/xbox-cloud-server-selector](https://github.com/n-thumann/xbox-cloud-server-selector) for the idea of IPv6 feature
- Icons by [Adam Design](https://www.iconfinder.com/iconsets/user-interface-outline-27)
## Disclaimers ## Disclaimers
- Use as your own risk. - Use as your own risk.
- This project is not affiliated with Xbox in any way. All Xbox logos/icons/trademarks are copyright of their respective owners. - This project is not affiliated with Xbox in any way. All Xbox logos/icons/trademarks are copyright of their respective owners.

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name Better xCloud // @name Better xCloud
// @namespace https://github.com/redphx // @namespace https://github.com/redphx
// @version 1.2.1 // @version 1.3.1
// @description Improve Xbox Cloud Gaming (xCloud) experience // @description Improve Xbox Cloud Gaming (xCloud) experience
// @author redphx // @author redphx
// @license MIT // @license MIT
@ -13,7 +13,7 @@
// ==/UserScript== // ==/UserScript==
'use strict'; 'use strict';
const SCRIPT_VERSION = '1.2.1'; const SCRIPT_VERSION = '1.3.1';
const SCRIPT_HOME = 'https://github.com/redphx/better-xcloud'; const SCRIPT_HOME = 'https://github.com/redphx/better-xcloud';
const SERVER_REGIONS = {}; const SERVER_REGIONS = {};
@ -22,6 +22,7 @@ const SERVER_REGIONS = {};
class Preferences { class Preferences {
static get SERVER_REGION() { return 'server_region'; } static get SERVER_REGION() { return 'server_region'; }
static get PREFER_IPV6_SERVER() { return 'prefer_ipv6_server'; } static get PREFER_IPV6_SERVER() { return 'prefer_ipv6_server'; }
static get USE_DESKTOP_CODEC() { return 'use_desktop_codec'; }
static get BLOCK_TRACKING() { return 'block_tracking'; } static get BLOCK_TRACKING() { return 'block_tracking'; }
static get BLOCK_SOCIAL_FEATURES() { return 'block_social_features'; } static get BLOCK_SOCIAL_FEATURES() { return 'block_social_features'; }
@ -48,9 +49,15 @@ class Preferences {
'default': false, 'default': false,
}, },
{
'id': Preferences.USE_DESKTOP_CODEC,
'label': 'Force high quality stream (same as desktop)',
'default': false,
},
{ {
'id': Preferences.DISABLE_BANDWIDTH_CHECKING, 'id': Preferences.DISABLE_BANDWIDTH_CHECKING,
'label': 'Force HD stream', 'label': 'Disable bandwitdh checking',
'default': false, 'default': false,
}, },
@ -250,6 +257,16 @@ function addCss() {
line-height: 24px; line-height: 24px;
} }
@media (hover: hover) {
.better_xcloud_settings_wrapper .setting_button:hover {
background-color: #00753c;
}
}
.better_xcloud_settings_wrapper .setting_button:active {
background-color: #00753c;
}
/* Hide UI elements */ /* Hide UI elements */
#headerArea, #uhfSkipToMain, .uhf-footer { #headerArea, #uhfSkipToMain, .uhf-footer {
display: none; display: none;
@ -590,6 +607,12 @@ function injectSettingsButton($parent) {
setting.value = PREFS.get(setting.id); setting.value = PREFS.get(setting.id);
$control.checked = setting.value; $control.checked = setting.value;
if (setting.id === Preferences.USE_DESKTOP_CODEC && !hasRtcSetCodecPreferencesSupport()) {
$control.disabled = true;
$control.checked = false;
$control.title = 'Not supported by this browser';
}
} }
const $elm = CE('div', {'class': 'setting_row'}, const $elm = CE('div', {'class': 'setting_row'},
@ -824,6 +847,40 @@ function patchVideoApi() {
} }
function hasRtcSetCodecPreferencesSupport() {
return (typeof RTCRtpTransceiver !== 'undefined' && 'setCodecPreferences' in RTCRtpTransceiver.prototype)
}
function patchRtcCodecs() {
if (!PREFS.get(Preferences.USE_DESKTOP_CODEC)) {
return;
}
if (!hasRtcSetCodecPreferencesSupport()) {
console.log('[Better xCloud] RTCRtpTransceiver.setCodecPreferences() is not supported');
return;
}
RTCRtpTransceiver.prototype.orgSetCodecPreferences = RTCRtpTransceiver.prototype.setCodecPreferences;
RTCRtpTransceiver.prototype.setCodecPreferences = function(codecs) {
// Use the same codecs as desktop
codecs = [
{
'clockRate': 90000,
'mimeType': 'video/H264',
'sdpFmtpLine': 'level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d001f',
},
{
'clockRate': 90000,
'mimeType': 'video/H264',
'sdpFmtpLine': 'level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=4d001f',
}
].concat(codecs);
this.orgSetCodecPreferences(codecs);
}
}
function numberPicker(key) { function numberPicker(key) {
let value = PREFS.get(key); let value = PREFS.get(key);
let $text, $decBtn, $incBtn; let $text, $decBtn, $incBtn;
@ -1037,6 +1094,8 @@ if (PREFS.get(Preferences.DISABLE_BANDWIDTH_CHECKING)) {
}); });
} }
patchRtcCodecs();
interceptHttpRequests(); interceptHttpRequests();
patchVideoApi(); patchVideoApi();