fix(YouTube - Video quality): Show FHD+ icon for 1080p 60fps enhanced bitrate

This commit is contained in:
LisoUseInAIKyrios
2025-08-10 21:17:32 -04:00
parent 83f239065a
commit e579c56921
3 changed files with 7 additions and 11 deletions

View File

@@ -41,11 +41,10 @@ public final class VideoInformation {
public static final int AUTOMATIC_VIDEO_QUALITY_VALUE = -2; public static final int AUTOMATIC_VIDEO_QUALITY_VALUE = -2;
/** /**
* All quality names are the same for all languages. * Video quality names are the same text for all languages.
* VideoQuality also has a resolution enum that can be used if needed. * Premium can be "1080p Premium" or "1080p60 Premium"
*/ */
public static final String VIDEO_QUALITY_1080P_PREMIUM_NAME = "1080p Premium"; public static final String VIDEO_QUALITY_PREMIUM_NAME = "Premium";
private static final float DEFAULT_YOUTUBE_PLAYBACK_SPEED = 1.0f; private static final float DEFAULT_YOUTUBE_PLAYBACK_SPEED = 1.0f;
/** /**
@@ -407,14 +406,13 @@ public final class VideoInformation {
} }
/** /**
* @return If the playback is at the end of the video.
* <p>
* If video is playing in the background with no video visible, * If video is playing in the background with no video visible,
* this always returns false (even if the video is actually at the end). * this always returns false (even if the video is actually at the end).
* <p> * <p>
* This is equivalent to checking for {@link VideoState#ENDED}, * This is equivalent to checking for {@link VideoState#ENDED},
* but can give a more up-to-date result for code calling from some hooks. * but can give a more up-to-date result for code calling from some hooks.
* *
* @return If the playback is at the end of the video.
* @see VideoState * @see VideoState
*/ */
@SuppressWarnings("BooleanMethodIsAlwaysInverted") @SuppressWarnings("BooleanMethodIsAlwaysInverted")

View File

@@ -40,7 +40,6 @@ abstract class Filter {
/** /**
* Adds callbacks to {@link #isFiltered(String, String, byte[], StringFilterGroup, FilterContentType, int)} * Adds callbacks to {@link #isFiltered(String, String, byte[], StringFilterGroup, FilterContentType, int)}
* if any of the groups are found. * if any of the groups are found.
* <p>
*/ */
protected final void addIdentifierCallbacks(StringFilterGroup... groups) { protected final void addIdentifierCallbacks(StringFilterGroup... groups) {
identifierCallbacks.addAll(Arrays.asList(groups)); identifierCallbacks.addAll(Arrays.asList(groups));
@@ -58,7 +57,6 @@ abstract class Filter {
* Called after an enabled filter has been matched. * Called after an enabled filter has been matched.
* Default implementation is to always filter the matched component and log the action. * Default implementation is to always filter the matched component and log the action.
* Subclasses can perform additional or different checks if needed. * Subclasses can perform additional or different checks if needed.
*
* <p> * <p>
* Method is called off the main thread. * Method is called off the main thread.
* *

View File

@@ -3,7 +3,7 @@ package app.revanced.extension.youtube.videoplayer;
import static app.revanced.extension.shared.StringRef.str; import static app.revanced.extension.shared.StringRef.str;
import static app.revanced.extension.shared.Utils.dipToPixels; import static app.revanced.extension.shared.Utils.dipToPixels;
import static app.revanced.extension.youtube.patches.VideoInformation.AUTOMATIC_VIDEO_QUALITY_VALUE; import static app.revanced.extension.youtube.patches.VideoInformation.AUTOMATIC_VIDEO_QUALITY_VALUE;
import static app.revanced.extension.youtube.patches.VideoInformation.VIDEO_QUALITY_1080P_PREMIUM_NAME; import static app.revanced.extension.youtube.patches.VideoInformation.VIDEO_QUALITY_PREMIUM_NAME;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
@@ -157,9 +157,9 @@ public class VideoQualityDialogButton {
case 2160 -> "4K"; case 2160 -> "4K";
default -> "?"; // Should never happen. default -> "?"; // Should never happen.
}; };
text.append(qualityText); text.append(qualityText);
if (resolution == 1080 && VIDEO_QUALITY_1080P_PREMIUM_NAME.equals(quality.patch_getQualityName())) {
if (quality != null && quality.patch_getQualityName().contains(VIDEO_QUALITY_PREMIUM_NAME)) {
// Underline the entire "FHD" text for 1080p Premium. // Underline the entire "FHD" text for 1080p Premium.
text.setSpan(new UnderlineSpan(), 0, qualityText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); text.setSpan(new UnderlineSpan(), 0, qualityText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
} }