What is the correct way to pause MediaPlayer in Jetpack Compose? Suppose my UI has a list of sound items, and when clicking an item the sound is playing. I'm trying to figure out the best approach to pause the sound when the user goes background.
Asked
Active
Viewed 425 times
1 Answers
0
Your MediaPlayer should be usable through a ViewModel. In the onPause()
callback in your Activity/Fragment, you should stop your MediaPlayer through your ViewModel

Sigma
- 532
- 3
- 8