fix(youtube/remember-video-quality): do not show 'auto' in video resolution picker if a default quality is set (#400)

This commit is contained in:
LisoUseInAIKyrios 2023-05-13 21:44:08 +04:00 committed by GitHub
parent feed762707
commit e30d1201c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -110,15 +110,25 @@ public class RememberVideoQualityPatch {
}
i++;
}
// If the desired quality index is equal to the original index,
// then the video is already set to the desired default quality.
//
// The method could return here, but the UI video quality flyout will still
// show 'Auto' (ie: Auto (480p))
// It appears that "Auto" picks the resolution on video load,
// and it does not appear to change the resolution during playback.
//
// To prevent confusion, set the video index anyways (even if it matches the existing index)
// As that will force the UI picker to not display "Auto" which may confuse the user.
if (qualityIndexToUse == originalQualityIndex) {
LogHelper.printDebug(() -> "Video is already preferred quality: " + preferredQuality);
return originalQualityIndex;
} else {
final int qualityToUseLog = qualityToUse;
LogHelper.printDebug(() -> "Quality changed from: "
+ videoQualities.get(originalQualityIndex) + " to: " + qualityToUseLog);
}
final int qualityToUseLog = qualityToUse;
LogHelper.printDebug(() -> "Quality changed from: "
+ videoQualities.get(originalQualityIndex) + " to: " + qualityToUseLog);
Method m = qInterface.getClass().getMethod(qIndexMethod, Integer.TYPE);
m.invoke(qInterface, qualityToUse);
return qualityIndexToUse;