Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(YouTube - Spoof video streams): Resolve playback issues after changing from cellular to wifi #4277

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ public enum ClientType {
true,
"Android TV"
),
// Cannot play livestreams and lacks HDR, but can play videos with music and labeled "for children".
ANDROID_CREATOR(
14,
"ANDROID_CREATOR",
Build.MANUFACTURER,
Build.MODEL,
"Android",
"11",
"com.google.android.apps.youtube.creator/24.45.100 (Linux; U; Android 11) gzip",
"30",
"24.45.100",
true,
"Android Creator"
),
ANDROID_VR(
ANDROID_VR_NO_AUTH.id,
ANDROID_VR_NO_AUTH.clientName,
Expand Down Expand Up @@ -76,19 +90,6 @@ public enum ClientType {
forceAVC()
? "iOS TV Force AVC"
: "iOS TV"
),
ANDROID_CREATOR(
14,
"ANDROID_CREATOR",
Build.MANUFACTURER,
Build.MODEL,
"Android",
"11",
"com.google.android.apps.youtube.creator/24.45.100 (Linux; U; Android 11) gzip",
"30",
"24.45.100",
true,
"Android Creator"
);

private static boolean forceAVC() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ public static String blockInitPlaybackRequest(String originalUrlString) {
String path = originalUri.getPath();

if (path != null && path.contains("initplayback")) {
Logger.printDebug(() -> "Blocking 'initplayback' by returning unreachable url");
Logger.printDebug(() -> "Blocking 'initplayback' by clearing query");

return UNREACHABLE_HOST_URI_STRING;
return originalUri.buildUpon().clearQuery().build().toString();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LisoUseInAIKyrios This is not a good change, because now YouTube servers are pinged. They are already being pinged twice at least, and adding a third time to it is not good.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the network is changed from cellular to wifi while playing then playback can fail until the app is force closed or the network changes back to cellular.

Clearing the url parameters fixes the issue.

A less serious but annoying issue is Shorts in the regular player regularly use 240p or 360p for the first ten seconds, and this change seems to improve the quality a lot where most videos start at 480p or 720p before changing to full resolution.

I could not figure out any other way to fix these issues.

}
} catch (Exception ex) {
Logger.printException(() -> "blockInitPlaybackRequest failure", ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ private void updateUI() {
// Android VR supports AV1 but all other clients do not.
if (clientType != ClientType.ANDROID_VR && clientType != ClientType.ANDROID_VR_NO_AUTH) {
summary += '\n' + str("revanced_spoof_video_streams_about_no_av1");

// Android Creator does not support HDR.
if (clientType == ClientType.ANDROID_CREATOR) {
summary += '\n' + str("revanced_spoof_video_streams_about_no_hdr");
}
}

setTitle(title);
Expand Down
2 changes: 0 additions & 2 deletions patches/src/main/resources/addresources/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,13 @@
<string-array name="revanced_spoof_video_streams_client_type_entries">
<item>Android VR</item>
<item>@string/revanced_spoof_video_streams_client_type_android_vr_no_auth</item>
<item>Android Creator</item>
<item>Android TV</item>
<item>iOS TV</item>
</string-array>
<string-array name="revanced_spoof_video_streams_client_type_entry_values">
<!-- Extension enum names. -->
<item>ANDROID_VR</item>
<item>ANDROID_VR_NO_AUTH</item>
<item>ANDROID_CREATOR</item>
<item>ANDROID_UNPLUGGED</item>
<item>IOS_UNPLUGGED</item>
</string-array>
Expand Down
1 change: 0 additions & 1 deletion patches/src/main/resources/addresources/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1396,7 +1396,6 @@ AVC has a maximum resolution of 1080p, Opus audio codec is not available, and vi
• Stable volume is not available
• Force original audio is not available"</string>
<string name="revanced_spoof_video_streams_about_no_av1">• No AV1 video codec</string>
<string name="revanced_spoof_video_streams_about_no_hdr">• No HDR video</string>
<string name="revanced_spoof_streaming_data_stats_for_nerds_title">Show in Stats for nerds</string>
<string name="revanced_spoof_streaming_data_stats_for_nerds_summary_on">Client type is shown in Stats for nerds</string>
<string name="revanced_spoof_streaming_data_stats_for_nerds_summary_off">Client is hidden in Stats for nerds</string>
Expand Down
Loading