mirror of
https://github.com/revanced/revanced-integrations
synced 2024-11-24 20:07:14 +01:00
fix(YouTube - Spoof client): Restore livestream audio only playback with iOS spoofing (#673)
This commit is contained in:
parent
a0f3d7a0f7
commit
5bf5fbd1a7
@ -273,7 +273,6 @@ public class Utils {
|
|||||||
@NonNull MatchFilter<View> filter) {
|
@NonNull MatchFilter<View> filter) {
|
||||||
for (int i = 0, childCount = viewGroup.getChildCount(); i < childCount; i++) {
|
for (int i = 0, childCount = viewGroup.getChildCount(); i < childCount; i++) {
|
||||||
View childAt = viewGroup.getChildAt(i);
|
View childAt = viewGroup.getChildAt(i);
|
||||||
Logger.printDebug(() -> "View id: " + childAt.getId() + " tag: " + childAt.getTag());
|
|
||||||
|
|
||||||
if (filter.matches(childAt)) {
|
if (filter.matches(childAt)) {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
@ -285,6 +284,7 @@ public class Utils {
|
|||||||
if (match != null) return match;
|
if (match != null) return match;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import android.media.MediaCodecList;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import app.revanced.integrations.shared.Logger;
|
import app.revanced.integrations.shared.Logger;
|
||||||
|
import app.revanced.integrations.youtube.patches.BackgroundPlaybackPatch;
|
||||||
import app.revanced.integrations.youtube.settings.Settings;
|
import app.revanced.integrations.youtube.settings.Settings;
|
||||||
import org.chromium.net.ExperimentalUrlRequest;
|
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 String UNREACHABLE_HOST_URI_STRING = "https://127.0.0.0";
|
||||||
private static final Uri UNREACHABLE_HOST_URI = Uri.parse(UNREACHABLE_HOST_URI_STRING);
|
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.
|
* Injection point.
|
||||||
* Blocks /get_watch requests by returning an unreachable URI.
|
* Blocks /get_watch requests by returning an unreachable URI.
|
||||||
@ -128,6 +122,14 @@ public class SpoofClientPatch {
|
|||||||
return SPOOFING_TO_IOS || original;
|
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.
|
* Injection point.
|
||||||
@ -144,19 +146,6 @@ public class SpoofClientPatch {
|
|||||||
return builder.build();
|
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 {
|
private enum ClientType {
|
||||||
// https://dumps.tadiphone.dev/dumps/oculus/eureka
|
// https://dumps.tadiphone.dev/dumps/oculus/eureka
|
||||||
ANDROID_VR(28,
|
ANDROID_VR(28,
|
||||||
|
Loading…
Reference in New Issue
Block a user