Since alpha07 MediaPlayer doesn’t play sounds anym...
# compose
d
Since alpha07 MediaPlayer doesn’t play sounds anymore This worked before (in alpha06)
Copy code
private val soundPlayer by lazy { MediaPlayer.create(context, R.raw.transporter) }
Copy code
soundPlayer.start()
R.raw.transporter is a mp3-File Any hints?
a
file a bug 🙂 they are pretty responsive there
h
I'm not seeing enough compose context. Can you provide where you are initializing this MediaPlayer and where you are calling
play
d
‘context’ is the AppCompatActivity from the ‘MainActivity’ MediaPlayer is initialized in a ‘ViewModel’ in this ‘ViewModel’ there is this function
Copy code
fun playSound(){
    if(!soundPlayer.isPlaying){
        soundPlayer.start()
    }
}
And this is called from the UI, triggered by an onClick of a Button