I need to play live audio stream, actually it is radio. The problem is that I also need to manage 20 minute buffer for stream. As far as I understand it's not easy to implement with adnroid.

First I checked MediaPlayer, but it doesn't provide any methods for buffer managment. In fact you even can't set buffer size directly.

Secondly I tried to manage buffer using local files: progressively download the stream to a temporary files and switch them. But when you want to switch to following file (change datasource in MediaPlayer), audio is not played continuously. You can hear short interruptions.

The last idea is to use stream proxy. Usually it is used for playing streams in Adnroid versions below 8. In stream proxy you create ServerSocket, read from audio stream and write to player. So actually I can manage buffering there. I can cache stream and write to MediaPlayer whatever I want. But. It doesn't work with Android 8.