Anki-Android icon indicating copy to clipboard operation
Anki-Android copied to clipboard

fix #19481: stop audio on previewer navigation

Open Ayush-Patel-56 opened this issue 10 months ago • 2 comments

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

  • Fixes #19481

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.

  • [x] You have a descriptive commit message with a short title (first line, max 50 chars).
  • [x] You have commented your code, particularly in hard-to-understand areas
  • [x] 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 avatar Jan 29 '26 17:01 Ayush-Patel-56

@Ayush-Patel-56 Please rebase this onto main and force push, rather than including a merge commit

david-allison avatar Jun 03 '26 22:06 david-allison

@david-allison rebasing done.

Ayush-Patel-56 avatar Jun 08 '26 07:06 Ayush-Patel-56

@david-allison would appreciate a review when you get a time, Thanks!

Ayush-Patel-56 avatar Jul 09 '26 10:07 Ayush-Patel-56

I'm going to be time limited this week, could you ping on Discord for another reviewer

david-allison avatar Jul 09 '26 10:07 david-allison