Compare commits

..

8 Commits
v1.4 ... v1.4.2

Author SHA1 Message Date
3c4248c1c7 Update README.md 2023-07-21 16:51:40 +07:00
de834fcb80 Bump version to 1.4.2 2023-07-21 16:49:28 +07:00
baf2c2a35d Fix "Force high quality codec" feature not working with Kiwi Browser 2023-07-21 16:42:57 +07:00
522830a47d Update README.md 2023-07-21 15:16:57 +07:00
7207646379 Bump version to 1.4.1 2023-07-21 09:02:37 +07:00
597c150c77 Update README.md 2023-07-21 09:02:10 +07:00
e7980c186d Add Kiwi Browser support (#11)
* Catch exception when trying to force desktop codec profile on Kiwi Browser

* Improve setCodecPreferences(), avoid crashing

* Improve codec status detection

* Fix codec detection
2023-07-21 08:57:05 +07:00
0c38b54c38 Update README.md 2023-07-20 21:06:49 +07:00
2 changed files with 53 additions and 26 deletions

View File

@ -17,12 +17,11 @@ Give this project a 🌟 if you like it. Thank you 🙏.
> By default you only get 1080p stream when playing on desktop.
> This feature will give you 1080p stream even on mobile, without having to change User-Agent.
> Not working in Hermit ([#5](https://github.com/redphx/better-xcloud/issues/5)).
- **Force high quality codec <sup>(\*)</sup>**
> Force xCloud to use the best streaming codec profile (same as desktop & TV). You don't have to change User-Agent anymore.
- **Force high quality codec (if possible)<sup>(\*)</sup>**
> Force xCloud to use the best streaming codec profile (same as desktop & TV) if possible. You don't have to change User-Agent anymore.
> You should enable this feature even if you're on desktop.
> Use more bandwidth & battery.
> Comparison video with the setting ON & OFF: https://youtu.be/-9PuBJJSgR4
> Disable if it causes crashes.
- **Prefer IPv6 streaming server**
> Might reduce latency
- **Disable bandwidth checking**
@ -64,18 +63,23 @@ To update manually, just install the script again (you won't lose your settings)
✅ = confirmed to be working
❓ = not yet tested
❌ = not supported (mostly because of lacking Userscript/extension support)
= unavailable
⚠️ = see custom notes
| | Desktop | Android | iOS |
|----------------------------------------|------------------|------------------|-----------------|
| | Desktop | Android | iOS |
|----------------------------------------|------------------|------------------|------------------|
| Chrome/Edge/Chromium variants | ✅ | ❌ | ❌ |
| Firefox | ✅ | ✅ | ❌ |
| Safari | ✅<sup>(1)</sup> | | ✅<sup>(2)</sup> |
| [Hermit](https://hermit.chimbori.com) | | ⚠️<sup>(3)</sup> | |
| Firefox | ✅ | ✅<sup>(1)</sup> | ❌ |
| Safari | ✅<sup>(2)</sup> | | ✅<sup>(3)</sup> |
| [Hermit](https://hermit.chimbori.com) | | ⚠️<sup>(4)</sup> | |
| Kiwi Browser | | ✅ | |
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) (free & open source).
<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.
<sup>1</sup> Follow [this guide](https://support.mozilla.org/en-US/kb/find-and-install-add-ons-firefox-android) to install Tampermonkey on Firefox Android.
<sup>2, 3</sup> Requires [Userscripts app](https://apps.apple.com/us/app/userscripts/id1463298887) (free & open source).
<sup>4</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).
In general, at the moment the best Android browser to use **Better xCloud** with is **Kiwi Browser**. All features work, it means you can get 1080p stream + high quality codec profile (the best possible quality).
## FAQ
1. **Will I get banned for using this?**

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @name Better xCloud
// @namespace https://github.com/redphx
// @version 1.4
// @version 1.4.2
// @description Improve Xbox Cloud Gaming (xCloud) experience
// @author redphx
// @license MIT
@ -13,7 +13,7 @@
// ==/UserScript==
'use strict';
const SCRIPT_VERSION = '1.4';
const SCRIPT_VERSION = '1.4.2';
const SCRIPT_HOME = 'https://github.com/redphx/better-xcloud';
const SERVER_REGIONS = {};
@ -83,7 +83,7 @@ class Preferences {
{
'id': Preferences.USE_DESKTOP_CODEC,
'label': 'Force high quality codec',
'label': 'Force high quality codec (if possible)',
'default': false,
},
@ -1021,19 +1021,22 @@ function patchRtcCodecs() {
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',
const newCodecs = codecs.slice();
newCodecs.forEach((codec, i) => {
// Find high quality codecs
if (codec.sdpFmtpLine && codec.sdpFmtpLine.includes('profile-level-id=4d')) {
// Move it to the top of the array
newCodecs.splice(i, 1);
newCodecs.unshift(codec);
}
].concat(codecs);
this.orgSetCodecPreferences(codecs);
});
try {
this.orgSetCodecPreferences(newCodecs);
} catch (e) {
console.log(e);
this.orgSetCodecPreferences(codecs);
}
}
}
@ -1275,10 +1278,30 @@ if (document.readyState === 'complete' && !onLoadTriggered) {
RTCPeerConnection.prototype.orgSetRemoteDescription = RTCPeerConnection.prototype.setRemoteDescription;
RTCPeerConnection.prototype.setRemoteDescription = function(...args) {
StreamStatus.hqCodec = false;
const sdpDesc = args[0];
if (sdpDesc.sdp) {
StreamStatus.hqCodec = sdpDesc.sdp.includes('profile-level-id=4d');
const sdp = sdpDesc.sdp;
let lineIndex = 0;
let endPos = 0;
let line;
while (lineIndex > -1) {
lineIndex = sdp.indexOf('a=fmtp:', endPos);
if (lineIndex === -1) {
break;
}
endPos = sdp.indexOf('\n', lineIndex);
line = sdp.substring(lineIndex, endPos);
if (line.includes('profile-level-id')) {
StreamStatus.hqCodec = line.includes('profile-level-id=4d');
break;
}
}
}
return this.orgSetRemoteDescription.apply(this, args);
}