Skip to content
This repository has been archived by the owner on Oct 26, 2024. It is now read-only.

Commit

Permalink
Handle if a thumbnail fails to load when using both fast still and De…
Browse files Browse the repository at this point in the history
…Arrow
  • Loading branch information
LisoUseInAIKyrios committed Dec 5, 2023
1 parent a935fe3 commit 57f2bf9
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public static String overrideImageURL(String originalUrl) {
LogHelper.printDebug(() -> "Original url: " + decodedUrl.sanitizedUrl);

final StringBuilder thumbnailUrlBuilder = new StringBuilder();
if (thumbnailMode.isDeArrow()) {
if (thumbnailMode.usingDeArrow()) {
// Get fallback URL.
final String fallbackUrl = thumbnailMode == AlternativeThumbnailMode.DEARROW_OR_VIDEO_STILLS
? buildYoutubeVideoStillURL(decodedUrl)
Expand Down Expand Up @@ -166,8 +166,8 @@ public static String overrideImageURL(String originalUrl) {
public static void handleCronetSuccess(@NonNull UrlResponseInfo responseInfo) {
try {
// 404 and alt thumbnails is using video stills
if (responseInfo.getHttpStatusCode() == 404 &&
AlternativeThumbnailMode.getCurrent() == AlternativeThumbnailMode.VIDEO_STILLS) {
if (responseInfo.getHttpStatusCode() == 404
&& AlternativeThumbnailMode.getCurrent().usingVideoStills()) {
// Fast alt thumbnails is enabled and the thumbnail is not available.
// The video is:
// - live stream
Expand Down Expand Up @@ -507,7 +507,11 @@ private enum AlternativeThumbnailMode {
this.id = id;
}

public boolean isDeArrow() {
public boolean usingVideoStills() {
return this == VIDEO_STILLS || this == DEARROW_OR_VIDEO_STILLS;
}

public boolean usingDeArrow() {
return this == DEARROW_OR_CREATOR_PROVIDED || this == DEARROW_OR_VIDEO_STILLS;
}

Expand Down

0 comments on commit 57f2bf9

Please sign in to comment.