Skip to content
Advertisement

Media player returns error and no sound plays

I have been testing my basic media player created for an app start up sound. The media is pulled from a URL contained within my firebase database. The media player works on an earlier emulators but not on any real device.

The error code is MediaPlayer start called in state 0 (Error -38, 0). I’ve read that it’s because the onprepare is not ready before playing the media, so I added a onPreparelistener and it still gives the same error. What can I try next?

JavaScript

Advertisement

Answer

onPrepareListener is not the same of preparing, you need simply call:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement