Skip to content Skip to sidebar Skip to footer

Android Media Player Exception Timed Out After 10 Seconds

have set of mp3 in raw file read them and set them in to an array get the array size generate a random number and pass that to media player as the element so player runs mp3 cl

Solution 1:

When repeatedly creating MediaPlayer instances as you are, you need to call release() on the previous player before creating the next one. Quoting the MediaPlayer docs:

It is also recommended that once a MediaPlayer object is no longer being used, call release() immediately so that resources used by the internal player engine associated with the MediaPlayer object can be released immediately. Resource may include singleton resources such as hardware acceleration components and failure to call release() may cause subsequent instances of MediaPlayer objects to fallback to software implementations or fail altogether.

Though you're using a single variable for reference to each new player, the old instances are still "hanging around" for a time, and eventually causing the stated Exception due to not being explicitly released.


Post a Comment for "Android Media Player Exception Timed Out After 10 Seconds"