Compare commits

..

11 Commits

Author SHA1 Message Date
e33730b124 Bump version to 1.3.2 2023-07-17 18:46:26 +07:00
8b4f26155c Update README.md 2023-07-17 18:45:54 +07:00
a52ba7dddf Work-around of "Force high quality stream" feature for Firefox (#4) 2023-07-17 18:42:20 +07:00
a8eb296bcf Merge branch 'main' of https://github.com/redphx/better-xcloud 2023-07-17 17:06:37 +07:00
f4a3c38cca Update texts in Settings 2023-07-17 17:06:34 +07:00
e8ab19c318 Update README.md 2023-07-17 15:09:46 +07:00
89e4dd0003 Update README.md 2023-07-17 11:25:54 +07:00
9874d36f3a Update README.md 2023-07-17 09:05:27 +07:00
ed54d1ed38 Fix IPv6 feature not working 2023-07-17 08:54:53 +07:00
4676e42215 Update README.md 2023-07-16 18:36:36 +07:00
ad791bdc45 Work-around for forcing high quality stream 2023-07-16 18:34:11 +07:00
2 changed files with 51 additions and 30 deletions

View File

@ -2,11 +2,11 @@
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 mobile 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. 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/4f60c2e6-9706-4326-940f-f46998177633"> <img width="500" alt="Settings UI" src="https://github.com/redphx/better-xcloud/assets/96280/2f5b81f7-f739-4f8e-bb30-7b404fa35628">
<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**
@ -14,9 +14,9 @@ Give this project a 🌟 if you like it. Thank you.
- **Prefer IPv6 streaming server** - **Prefer IPv6 streaming server**
> Might reduce latency > Might reduce latency
- **Force high quality stream** - **Force high quality stream**
> Force xCloud to use the best streaming codec profile (same as desktop). You don't have to change User-Agent anymore. > Force xCloud to use the best streaming codec profile (same as desktop & TV). You don't have to change User-Agent anymore.
> Some browsers (like Firefox) don't support this feature. Check [the full list](https://caniuse.com/?search=setCodecPreferences). > Use more bandwitdh & battery.
> If you're on Android and want to use it, try [Hermit](https://hermit.chimbori.com). > Comparison video with the setting ON & OFF: https://youtu.be/-9PuBJJSgR4
- **Disable bandwidth checking** - **Disable bandwidth checking**
> xCloud won't reduce quality when the internet speed is slow > xCloud won't reduce quality when the internet speed is slow
- **Skip Xbox splash video** - **Skip Xbox splash video**
@ -61,7 +61,7 @@ To update manually, just install the script again (you won't lose your settings)
Don't see your browser in the table? If it supports Tampermonkey/Userscript then the answer is likely **"YES"**. 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>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. <sup>3</sup> NOT RECOMMENDED at the moment since its Userscript implementation is not working properly (see https://github.com/redphx/better-xcloud/issues/5 for full details). 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 ## FAQ
1. **Will I get banned for using this?** 1. **Will I get banned for using this?**
@ -79,14 +79,15 @@ No you can't. You'll have to modify the app.
5. **Will you able to enable "Clarity Boost" feature on non-Edge browsers?** 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. 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
> You're no longer needed to change User-Agent since you can just use the **Force high quality stream** setting. 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. If your browser doesn't support **Force high quality stream** setting, try changing User-Agent to:
```
Mozilla/5.0 (SMART-TV; LINUX; Tizen 7.0) AppleWebKit/537.36 (KHTML, like Gecko) 94.0.4606.31/7.0 TV Safari/537.36
```
This will change your device to a Samsung TV running Tizen OS. It will improve the stream quality.
---
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
@ -99,7 +100,10 @@ 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.
## 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.3.1 // @version 1.3.2
// @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.3.1'; const SCRIPT_VERSION = '1.3.2';
const SCRIPT_HOME = 'https://github.com/redphx/better-xcloud'; const SCRIPT_HOME = 'https://github.com/redphx/better-xcloud';
const SERVER_REGIONS = {}; const SERVER_REGIONS = {};
@ -51,13 +51,13 @@ class Preferences {
{ {
'id': Preferences.USE_DESKTOP_CODEC, 'id': Preferences.USE_DESKTOP_CODEC,
'label': 'Force high quality stream (same as desktop)', 'label': 'Force high quality stream',
'default': false, 'default': false,
}, },
{ {
'id': Preferences.DISABLE_BANDWIDTH_CHECKING, 'id': Preferences.DISABLE_BANDWIDTH_CHECKING,
'label': 'Disable bandwitdh checking', 'label': 'Disable bandwidth checking',
'default': false, 'default': false,
}, },
@ -81,7 +81,7 @@ class Preferences {
{ {
'id': Preferences.BLOCK_SOCIAL_FEATURES, 'id': Preferences.BLOCK_SOCIAL_FEATURES,
'label': 'Disable social features (Friends, Chat...)', 'label': 'Disable social features',
'default': false, 'default': false,
}, },
@ -209,9 +209,9 @@ function addCss() {
} }
.better_xcloud_settings_wrapper { .better_xcloud_settings_wrapper {
width: 400px; width: 450px;
margin: auto; margin: auto;
padding: 12px; padding: 12px 6px;
} }
.better_xcloud_settings_wrapper *:focus { .better_xcloud_settings_wrapper *:focus {
@ -356,10 +356,9 @@ function updateIceCandidates(candidates) {
const newCandidates = []; const newCandidates = [];
let order = 1; let order = 1;
let priority = 100;
lst.forEach(item => { lst.forEach(item => {
item.order = order; item.order = order;
item.priority = priority; item.priority = (order == 1) ? 100 : 1;
newCandidates.push({ newCandidates.push({
'candidate': `a=candidate:${item.order} 1 UDP ${item.priority} ${item.ip} ${item.the_rest}`, 'candidate': `a=candidate:${item.order} 1 UDP ${item.priority} ${item.ip} ${item.the_rest}`,
@ -369,7 +368,6 @@ function updateIceCandidates(candidates) {
}); });
++order; ++order;
--priority;
}); });
newCandidates.push({ newCandidates.push({
@ -428,6 +426,8 @@ function interceptHttpRequests() {
}; };
const PREF_PREFER_IPV6_SERVER = PREFS.get(Preferences.PREFER_IPV6_SERVER); const PREF_PREFER_IPV6_SERVER = PREFS.get(Preferences.PREFER_IPV6_SERVER);
const PREF_USE_DESKTOP_CODEC = PREFS.get(Preferences.USE_DESKTOP_CODEC);
const HAS_CODECS_API_SUPPORT = hasRtcSetCodecPreferencesSupport();
const orgFetch = window.fetch; const orgFetch = window.fetch;
window.fetch = async (...arg) => { window.fetch = async (...arg) => {
@ -468,8 +468,29 @@ function interceptHttpRequests() {
}); });
} }
// Work-around for browsers with no setCodecPreferences() support
if (PREF_USE_DESKTOP_CODEC && !HAS_CODECS_API_SUPPORT && url.endsWith('/sdp') && url.includes('/sessions/cloud/') && request.method === 'GET') {
const promise = orgFetch(...arg);
return promise.then(response => {
return response.clone().text().then(text => {
if (!text.length) {
return response;
}
const obj = JSON.parse(text);
obj.exchangeResponse = obj.exchangeResponse.replaceAll('profile-level-id=42', 'profile-level-id=4d');
response.json = () => Promise.resolve(obj);
response.text = () => Promise.resolve(JSON.stringify(obj));
return response;
});
});
}
// ICE server candidates // ICE server candidates
if (PREF_PREFER_IPV6_SERVER && url.endsWith('/ice') && url.includes('/sessions/cloud/')) { if (PREF_PREFER_IPV6_SERVER && url.endsWith('/ice') && url.includes('/sessions/cloud/') && request.method === 'GET') {
const promise = orgFetch(...arg); const promise = orgFetch(...arg);
return promise.then(response => { return promise.then(response => {
@ -484,6 +505,8 @@ function interceptHttpRequests() {
obj.exchangeResponse = JSON.stringify(exchangeResponse); obj.exchangeResponse = JSON.stringify(exchangeResponse);
response.json = () => Promise.resolve(obj); response.json = () => Promise.resolve(obj);
response.text = () => Promise.resolve(JSON.stringify(obj));
return response; return response;
}); });
}); });
@ -607,12 +630,6 @@ 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'},