Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android MediaPlayer Error (1,-22)

Error (1,-22) occurs after long playing (about hour or more) the same track in a loop. I can't figure out the reason of that error. Everything is okay if track is playing for short time. But if I keep track playing for long time in my Service, sometimes the error happens.

I know that 1 is MEDIA_ERROR_UNKNOWN, but cant find anything about -22.

Any suggestions? API 24

like image 492
Konstantin Konopko Avatar asked Oct 18 '22 16:10

Konstantin Konopko


1 Answers

It seems to issue appears because I didn't call MediaPlayer.release() when onCompletion callback. As a result resources of MP did not released and finally MP crashed with the error.

like image 178
Konstantin Konopko Avatar answered Oct 21 '22 07:10

Konstantin Konopko