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

fix(YouTube - Remove background playback restrictions): Enable for Short as well #701

Closed
wants to merge 11 commits into from
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,21 @@ public static boolean isBackgroundPlaybackAllowed() {
// 7. Close the Short
// 8. Resume playing the regular video
// 9. Minimize the app (PIP should appear)
if (VideoInformation.lastVideoIdIsShort()) {
return Settings.ALLOW_SHORTS_BACKGROUND_PLAYBACK.get();
if (!VideoInformation.lastVideoIdIsShort()) {
return true; // Definitely is not a Short.
}

return true;
// TODO: Add better hook.
// Might be a Shorts, or might be a prior regular video on screen again after a Shorts was closed.
// This incorrectly prevents PIP if player is in WATCH_WHILE_MINIMIZED after closing a Shorts,
// But there's no way around this unless an additional hook is added to definitively detect
// the Shorts player is on screen. This use case is unusual anyways so it's not a huge concern.
if (!PlayerType.getCurrent().isNoneHiddenOrMinimized()) {
zainarbani marked this conversation as resolved.
Show resolved Hide resolved
return true;
}

// Only Shorts video should reach here.
return Settings.ALLOW_SHORTS_BACKGROUND_PLAYBACK.get();
}

/**
Expand Down
Loading