Skip to content

Commit bf8262f

Browse files
Merge remote-tracking branch 'upstream/dev' into fix/spoof_stream_force_avc
# Conflicts: # extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/ClientType.java # extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/DeviceHardwareSupport.java
2 parents 65e12af + 5aedc09 commit bf8262f

File tree

21 files changed

+555
-481
lines changed

21 files changed

+555
-481
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# [5.3.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v5.2.4-dev.3...v5.3.0-dev.1) (2024-12-08)
2+
3+
4+
### Features
5+
6+
* **YouTube Music:** Add `Spoof video streams` patch to fix playback ([#4065](https://github.com/ReVanced/revanced-patches/issues/4065)) ([cf3116a](https://github.com/ReVanced/revanced-patches/commit/cf3116a7583d09c25c798a85687a056f143656f0))
7+
18
## [5.2.4-dev.3](https://github.com/ReVanced/revanced-patches/compare/v5.2.4-dev.2...v5.2.4-dev.3) (2024-12-07)
29

310

extensions/shared/library/src/main/java/app/revanced/extension/shared/settings/BaseSettings.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
package app.revanced.extension.shared.settings;
22

3+
import app.revanced.extension.shared.spoof.ClientType;
4+
import app.revanced.extension.shared.spoof.SpoofVideoStreamsPatch;
5+
36
import static java.lang.Boolean.FALSE;
47
import static java.lang.Boolean.TRUE;
58
import static app.revanced.extension.shared.settings.Setting.parent;
69

710
/**
811
* Settings shared across multiple apps.
9-
*
12+
* <p>
1013
* To ensure this class is loaded when the UI is created, app specific setting bundles should extend
1114
* or reference this class.
1215
*/
@@ -16,4 +19,10 @@ public class BaseSettings {
1619
public static final BooleanSetting DEBUG_TOAST_ON_ERROR = new BooleanSetting("revanced_debug_toast_on_error", TRUE, "revanced_debug_toast_on_error_user_dialog_message");
1720

1821
public static final IntegerSetting CHECK_ENVIRONMENT_WARNINGS_ISSUED = new IntegerSetting("revanced_check_environment_warnings_issued", 0, true, false);
22+
23+
public static final BooleanSetting SPOOF_VIDEO_STREAMS = new BooleanSetting("revanced_spoof_video_streams", TRUE, true, "revanced_spoof_video_streams_user_dialog_message");
24+
public static final BooleanSetting SPOOF_VIDEO_STREAMS_IOS_FORCE_AVC = new BooleanSetting("revanced_spoof_video_streams_ios_force_avc", FALSE, true,
25+
"revanced_spoof_video_streams_ios_force_avc_user_dialog_message", new SpoofVideoStreamsPatch.ForceiOSAVCAvailability());
26+
public static final EnumSetting<ClientType> SPOOF_VIDEO_STREAMS_CLIENT_TYPE = new EnumSetting<>("revanced_spoof_video_streams_client", ClientType.ANDROID_VR, true, parent(SPOOF_VIDEO_STREAMS));
27+
1928
}

extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/spoof/ClientType.java renamed to extensions/shared/library/src/main/java/app/revanced/extension/shared/spoof/ClientType.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package app.revanced.extension.youtube.patches.spoof;
1+
package app.revanced.extension.shared.spoof;
22

33
import android.os.Build;
44

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package app.revanced.extension.youtube.patches.spoof;
1+
package app.revanced.extension.shared.spoof;
22

33
import android.media.MediaCodecInfo;
44
import android.media.MediaCodecList;
@@ -41,4 +41,12 @@ public class DeviceHardwareSupport {
4141
? "Device supports VP9 hardware decoding"
4242
: "Device does not support VP9 hardware decoding"));
4343
}
44+
45+
public static boolean allowVP9() {
46+
return DEVICE_HAS_HARDWARE_DECODING_VP9 && !Settings.SPOOF_VIDEO_STREAMS_IOS_FORCE_AVC.get();
47+
}
48+
49+
public static boolean allowAV1() {
50+
return allowVP9() && DEVICE_HAS_HARDWARE_DECODING_AV1;
51+
}
4452
}
+11-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package app.revanced.extension.youtube.patches.spoof;
1+
package app.revanced.extension.shared.spoof;
22

33
import android.net.Uri;
44

@@ -12,20 +12,12 @@
1212
import app.revanced.extension.shared.Utils;
1313
import app.revanced.extension.shared.settings.BaseSettings;
1414
import app.revanced.extension.shared.settings.Setting;
15-
import app.revanced.extension.youtube.patches.spoof.requests.StreamingDataRequest;
16-
import app.revanced.extension.youtube.settings.Settings;
15+
import app.revanced.extension.shared.spoof.requests.StreamingDataRequest;
16+
import app.revanced.extension.shared.settings.BaseSettings;
1717

1818
@SuppressWarnings("unused")
1919
public class SpoofVideoStreamsPatch {
20-
public static final class ForceiOSAVCAvailability implements Setting.Availability {
21-
@Override
22-
public boolean isAvailable() {
23-
return Settings.SPOOF_VIDEO_STREAMS.get() && Settings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.get() == ClientType.IOS;
24-
}
25-
}
26-
27-
private static final boolean SPOOF_STREAMING_DATA = Settings.SPOOF_VIDEO_STREAMS.get();
28-
20+
private static final boolean SPOOF_STREAMING_DATA = BaseSettings.SPOOF_VIDEO_STREAMS.get();
2921
/**
3022
* Any unreachable ip address. Used to intentionally fail requests.
3123
*/
@@ -165,4 +157,11 @@ public static byte[] removeVideoPlaybackPostBody(Uri uri, int method, byte[] pos
165157

166158
return postData;
167159
}
160+
161+
public static final class ForceiOSAVCAvailability implements Setting.Availability {
162+
@Override
163+
public boolean isAvailable() {
164+
return BaseSettings.SPOOF_VIDEO_STREAMS.get() && BaseSettings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.get() == ClientType.IOS;
165+
}
166+
}
168167
}
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package app.revanced.extension.youtube.patches.spoof.requests;
1+
package app.revanced.extension.shared.spoof.requests;
22

33
import org.json.JSONException;
44
import org.json.JSONObject;
@@ -10,7 +10,7 @@
1010
import app.revanced.extension.shared.Utils;
1111
import app.revanced.extension.shared.requests.Requester;
1212
import app.revanced.extension.shared.requests.Route;
13-
import app.revanced.extension.youtube.patches.spoof.ClientType;
13+
import app.revanced.extension.shared.spoof.ClientType;
1414

1515
final class PlayerRoutes {
1616
static final Route.CompiledRoute GET_STREAMING_DATA = new Route(
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package app.revanced.extension.youtube.patches.spoof.requests;
1+
package app.revanced.extension.shared.spoof.requests;
22

3-
import static app.revanced.extension.youtube.patches.spoof.requests.PlayerRoutes.GET_STREAMING_DATA;
3+
import static app.revanced.extension.shared.spoof.requests.PlayerRoutes.GET_STREAMING_DATA;
44

55
import androidx.annotation.NonNull;
66
import androidx.annotation.Nullable;
@@ -22,8 +22,7 @@
2222
import app.revanced.extension.shared.Logger;
2323
import app.revanced.extension.shared.Utils;
2424
import app.revanced.extension.shared.settings.BaseSettings;
25-
import app.revanced.extension.youtube.patches.spoof.ClientType;
26-
import app.revanced.extension.youtube.settings.Settings;
25+
import app.revanced.extension.shared.spoof.ClientType;
2726

2827
/**
2928
* Video streaming data. Fetching is tied to the behavior YT uses,
@@ -70,7 +69,7 @@ protected boolean removeEldestEntry(Entry eldest) {
7069

7170
static {
7271
ClientType[] allClientTypes = ClientType.values();
73-
ClientType preferredClient = Settings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.get();
72+
ClientType preferredClient = BaseSettings.SPOOF_VIDEO_STREAMS_CLIENT_TYPE.get();
7473

7574
CLIENT_ORDER_TO_USE = new ClientType[allClientTypes.length];
7675
CLIENT_ORDER_TO_USE[0] = preferredClient;

extensions/youtube/src/main/java/app/revanced/extension/youtube/patches/FullscreenPanelsRemoverPatch.java

-12
This file was deleted.

0 commit comments

Comments
 (0)