0

I'm developing an AudioBook player for Android. For the playing part, I've used MediaPlayer class which works perfectly for some minutes but then always suddenly fails and no voice could be heard.

Even if I stop and issue a new request (read new chapter) it doesn't work. However the passing of time seems natural (for example playing a 10 seconds clip takes 10 seconds to finish) but there is absolutely no voice!

Does someone have any clues what might cause this problem?

Here's the relevant parts of my MediaPlayer usage.
And here's the logcat around the place it mutes.

EDIT:
By analyzing the logcat, I found out that this part is showing after the muting has happened:

E/AudioFlinger(  146): no more track names available
E/AudioTrack(  146): AudioFlinger could not create track, status: -12
E/AudioSink(  146): Unable to create audio track
E/AwesomePlayer(  146): deleting Audio Player - start failed
E/MediaPlayer( 5558): error (-19, 0)
***V/MainActivity( 5558): onNewPage()
E/MediaPlayer( 5558): Error (-19,0)
E/Sensors (  285): sensors_poll_context_t::pollEvents, line 202: receive event #### i=2, nb=0
E/Sensors (  285): sensors_poll_context_t::pollEvents, line 202: receive event #### i=2, nb=0
E/Sensors (  285): sensors_poll_context_t::pollEvents, line 202: receive event #### i=2, nb=0
E/Sensors (  285): sensors_poll_context_t::pollEvents, line 202: receive event #### i=2, nb=0
***V/MediaPlayerWrapper( 5558): stop()
***D/MediaPlayerWrapper( 5558): Stopping player...
E/MediaPlayer( 5558): stop called in state 0
E/MediaPlayer( 5558): error (-38, 0)

The lines with three * at beginning are my messages, others are frameworks'.

Mousa
  • 2,190
  • 3
  • 21
  • 34

1 Answers1

0

The problem was simply because of not releasing the media player object; as these answers (a,b,c) suggested already.

mMediaPlayer.release();
Community
  • 1
  • 1
Mousa
  • 2,190
  • 3
  • 21
  • 34