mirror of
https://github.com/redphx/better-xcloud.git
synced 2025-06-06 23:57:19 +02:00
Improve IPv6 server detection
This commit is contained in:
parent
f3b9ebdb22
commit
584509a53d
@ -3033,7 +3033,7 @@ class StreamBadges {
|
|||||||
let totalIn = 0;
|
let totalIn = 0;
|
||||||
let totalOut = 0;
|
let totalOut = 0;
|
||||||
stats.forEach(stat => {
|
stats.forEach(stat => {
|
||||||
if (stat.type === 'candidate-pair' && stat.state == 'succeeded') {
|
if (stat.type === 'candidate-pair' && stat.state === 'succeeded') {
|
||||||
totalIn += stat.bytesReceived;
|
totalIn += stat.bytesReceived;
|
||||||
totalOut += stat.bytesSent;
|
totalOut += stat.bytesSent;
|
||||||
}
|
}
|
||||||
@ -6793,6 +6793,9 @@ function onStreamStarted($video) {
|
|||||||
const allAudioCodecs = {};
|
const allAudioCodecs = {};
|
||||||
let audioCodecId;
|
let audioCodecId;
|
||||||
|
|
||||||
|
const allCandidates = {};
|
||||||
|
let candidateId;
|
||||||
|
|
||||||
stats.forEach(stat => {
|
stats.forEach(stat => {
|
||||||
if (stat.type == 'codec') {
|
if (stat.type == 'codec') {
|
||||||
const mimeType = stat.mimeType.split('/');
|
const mimeType = stat.mimeType.split('/');
|
||||||
@ -6810,6 +6813,10 @@ function onStreamStarted($video) {
|
|||||||
} else if (stat.kind === 'audio') {
|
} else if (stat.kind === 'audio') {
|
||||||
audioCodecId = stat.codecId;
|
audioCodecId = stat.codecId;
|
||||||
}
|
}
|
||||||
|
} else if (stat.type === 'candidate-pair' && stat.state === 'succeeded') {
|
||||||
|
candidateId = stat.remoteCandidateId;
|
||||||
|
} else if (stat.type === 'remote-candidate') {
|
||||||
|
allCandidates[stat.id] = stat.address;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -6837,6 +6844,12 @@ function onStreamStarted($video) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get server type
|
||||||
|
if (candidateId) {
|
||||||
|
console.log(candidateId, allCandidates);
|
||||||
|
StreamBadges.ipv6 = allCandidates[candidateId].includes(':');
|
||||||
|
}
|
||||||
|
|
||||||
if (PREFS.get(Preferences.STATS_SHOW_WHEN_PLAYING)) {
|
if (PREFS.get(Preferences.STATS_SHOW_WHEN_PLAYING)) {
|
||||||
StreamStats.start();
|
StreamStats.start();
|
||||||
}
|
}
|
||||||
@ -6934,16 +6947,6 @@ if (PREFS.get(Preferences.AUDIO_ENABLE_VOLUME_CONTROL)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RTCPeerConnection.prototype.orgAddIceCandidate = RTCPeerConnection.prototype.addIceCandidate;
|
|
||||||
RTCPeerConnection.prototype.addIceCandidate = function(...args) {
|
|
||||||
const candidate = args[0].candidate;
|
|
||||||
if (candidate && candidate.startsWith('a=candidate:1 ')) {
|
|
||||||
StreamBadges.ipv6 = candidate.substring(20).includes(':');
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.orgAddIceCandidate.apply(this, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PREFS.get(Preferences.STREAM_TOUCH_CONTROLLER) === 'all') {
|
if (PREFS.get(Preferences.STREAM_TOUCH_CONTROLLER) === 'all') {
|
||||||
TouchController.setup();
|
TouchController.setup();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user