Skip to content

fix(player): show clear-queue confirmation when tapping a new video#55

Open
Rumi-sketches wants to merge 1 commit into
InfinityLoop1308:devfrom
Rumi-sketches:fix/clear-queue-confirmation-not-shown
Open

fix(player): show clear-queue confirmation when tapping a new video#55
Rumi-sketches wants to merge 1 commit into
InfinityLoop1308:devfrom
Rumi-sketches:fix/clear-queue-confirmation-not-shown

Conversation

@Rumi-sketches

@Rumi-sketches Rumi-sketches commented Jun 16, 2026

Copy link
Copy Markdown

Summary

The "ask for confirmation before clearing a queue" setting only worked when switching the same video between player types (popup/background/main player), It never fired when tapping a different video.
The setting's actual main use case, whether from the feed, search results, or the related-items list under an expanded player.

Problem

selectAndLoadVideo(), the entry point used whenever a different video is opened from any list, had no confirmation check of its own. The existing check (replaceQueueIfUserConfirms) only ran later, inside the autoplay path triggered after the new stream's info finished loading. By that point, hideMainPlayerOnLoadingNewStream() had already torn down the active player/queue (playerHolder.stopService()), so the check always saw activeQueue == null and silently skipped the confirmation — regardless of the setting.

Changes

  • Added loadVideoIfUserConfirms(), evaluated synchronously at the very top of selectAndLoadVideo(), before anything is torn down. It compares the live player's current queue item against the URL about to be loaded (since playQueue/url still reflect the old target at this point).
  • Both confirmation checks (replaceQueueIfUserConfirms and the new loadVideoIfUserConfirms) now also require the active queue to have more than one item — replacing a lone, queue-less video just plays the new one immediately, no popup.

Validation

Manually tested on-device (OnePlus Open):

  • Play video A (no queue) → tap video B → plays immediately, no popup (size check working).
  • Play video A → enqueue video B → tap video C from feed/search → confirmation popup now appears (previously did not).
  • Same scenario but tapping a related item under the expanded player instead → popup also appears (same code path).
  • Confirmed via verbose logging during development that, prior to the fix, the active queue was null by the time the original check ran.

The "ask for confirmation before clearing a queue" setting only worked
when switching the same video between player types (popup/background/
main player). It never fired when tapping a different video from the
feed, search results, or the related-items list under an expanded
player, which is the setting's main use case.

Root cause: selectAndLoadVideo() (the entry point used by all of the
above) had no confirmation check at all. By the time the existing
replaceQueueIfUserConfirms() check ran later in the flow (via
runWorker's autoplay path), hideMainPlayerOnLoadingNewStream() had
already torn down the active player/queue, so the check always saw no
active queue to protect.

Add loadVideoIfUserConfirms(), evaluated synchronously at the top of
selectAndLoadVideo() before anything is torn down. It compares the
live player's current queue item against the URL about to be loaded,
since at this point playQueue/url still reflect the *old* target.

Also only ask for confirmation when the active queue actually has more
than one item; replacing a lone, queue-less video should just play the
new one immediately.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant