fix #19481: stop audio on previewer navigation
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 Please rebase this onto main and force push, rather than including a merge commit
@david-allison rebasing done.
@david-allison would appreciate a review when you get a time, Thanks!
I'm going to be time limited this week, could you ping on Discord for another reviewer