1
mirror of https://github.com/revanced/revanced-integrations synced 2024-11-27 11:13:38 +01:00

fix(YouTube - Spoof client): Restore livestream audio only playback with iOS spoofing (#673)

This commit is contained in:
LisoUseInAIKyrios 2024-08-04 15:38:07 -04:00 committed by GitHub
parent a0f3d7a0f7
commit 5bf5fbd1a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 21 deletions

View File

@ -273,7 +273,6 @@ public class Utils {
@NonNull MatchFilter<View> filter) {
for (int i = 0, childCount = viewGroup.getChildCount(); i < childCount; i++) {
View childAt = viewGroup.getChildAt(i);
Logger.printDebug(() -> "View id: " + childAt.getId() + " tag: " + childAt.getTag());
if (filter.matches(childAt)) {
//noinspection unchecked
@ -285,6 +284,7 @@ public class Utils {
if (match != null) return match;
}
}
return null;
}

View File

@ -5,6 +5,7 @@ import android.media.MediaCodecList;
import android.net.Uri;
import android.os.Build;
import app.revanced.integrations.shared.Logger;
import app.revanced.integrations.youtube.patches.BackgroundPlaybackPatch;
import app.revanced.integrations.youtube.settings.Settings;
import org.chromium.net.ExperimentalUrlRequest;
@ -20,13 +21,6 @@ public class SpoofClientPatch {
private static final String UNREACHABLE_HOST_URI_STRING = "https://127.0.0.0";
private static final Uri UNREACHABLE_HOST_URI = Uri.parse(UNREACHABLE_HOST_URI_STRING);
/**
* Tracking URL authority to use when spoofing the client to iOS,
* because watch history is not working on brand accounts.
* See <a href="https://github.com/LuanRT/YouTube.js/blob/3153375bcaa6c03afba9da8474e6a9d37471ed29/src/core/mixins/MediaInfo.ts#L152">LuanRT/YouTube.js</a>.
*/
private static final String WWW_TRACKING_URL_AUTHORITY = "www.youtube.com";
/**
* Injection point.
* Blocks /get_watch requests by returning an unreachable URI.
@ -128,6 +122,14 @@ public class SpoofClientPatch {
return SPOOFING_TO_IOS || original;
}
/**
* Injection point.
* When spoofing the client to iOS, background audio only playback of livestreams fails.
* Return true to force enable audio background play.
*/
public static boolean overrideBackgroundAudioPlayback() {
return SPOOFING_TO_IOS && BackgroundPlaybackPatch.playbackIsNotShort();
}
/**
* Injection point.
@ -144,19 +146,6 @@ public class SpoofClientPatch {
return builder.build();
}
/**
* Injection point.
* When spoofing the client to iOS, history is not working on brand accounts.
* Replace the tracking URL authority to {@link SpoofClientPatch#WWW_TRACKING_URL_AUTHORITY} to fix this.
*/
public static Uri overrideTrackingUrl(Uri trackingUrl) {
if (SPOOF_CLIENT_ENABLED && SPOOF_CLIENT_TYPE == ClientType.IOS) {
return trackingUrl.buildUpon().authority(WWW_TRACKING_URL_AUTHORITY).build();
}
return trackingUrl;
}
private enum ClientType {
// https://dumps.tadiphone.dev/dumps/oculus/eureka
ANDROID_VR(28,