Skip to content

fix #19481: stop audio on previewer navigation#20258

Open
Ayush-Patel-56 wants to merge 1 commit intoankidroid:mainfrom
Ayush-Patel-56:fix-previewer-audio-stop
Open

fix #19481: stop audio on previewer navigation#20258
Ayush-Patel-56 wants to merge 1 commit intoankidroid:mainfrom
Ayush-Patel-56:fix-previewer-audio-stop

Conversation

@Ayush-Patel-56
Copy link
Contributor

@Ayush-Patel-56 Ayush-Patel-56 commented Jan 29, 2026

Purpose / Description

Audio currently continues playing in the Previewer even when navigating to other cards or switching views. This change ensures playback stops immediately when the user navigates away or toggles the card side.

Fixes

Approach

  • Calling cardMediaPlayer.stop() in onNextButtonClick, onPreviousButtonClick, and toggleBackSideOnly.
  • Updated PreviewerViewModelTest to verify stop() is called during these actions.

How Has This Been Tested?

Expanded PreviewerViewModelTest to cover these navigation scenarios and verified they pass.

Video Proof:
https://github.com/user-attachments/assets/44304669-c881-4533-b13f-1e08682210fb

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

@Ayush-Patel-56 Ayush-Patel-56 force-pushed the fix-previewer-audio-stop branch 3 times, most recently from 1cf4fc7 to 47a1d49 Compare February 1, 2026 17:08
@Ayush-Patel-56 Ayush-Patel-56 force-pushed the fix-previewer-audio-stop branch from 47a1d49 to acaa29e Compare February 12, 2026 15:23
backSideOnly.emit(!backSideOnly.value)
if (!backSideOnly.value && showingAnswer.value) {
stopAudio()
showQuestion()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would seem sensible to me to call this before any calls to super.showQuestion or super.showAnswer, likely be overriding the method.

@BrayanDSO could I confirm this wouldn't cause an issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!, I've refactored the audio stop logic into showQuestion/showAnswer overrides as suggested. Also added regression test.

@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label Mar 4, 2026
@david-allison david-allison requested a review from BrayanDSO March 4, 2026 19:42
@Ayush-Patel-56 Ayush-Patel-56 force-pushed the fix-previewer-audio-stop branch from acaa29e to 5338d5c Compare March 11, 2026 12:50
@david-allison david-allison added Needs reviewer reply Waiting for a reply from another reviewer and removed Needs Author Reply Waiting for a reply from the original author labels Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review Needs reviewer reply Waiting for a reply from another reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Audio on the front side of a card continues to play on the back side, in the browser preview

4 participants