user630447
user630447

Reputation: 71

Buffer audio livestream with ExoPlayer

I am using ExoPlayer on Android to play a radio audio livestream. With the standard implementation the livestream stops playing immediately when network connection gets lost.

ExoPlayer State: STARTED -> connection gets lost -> immediately BUFFERING -> after 2-3 sec. IDLE

Is it possible to buffer the radio livestream so if there is no internet connection that the stream continues playing for a few sekonds until the network connection is back. The music app Tunein has this feature. Is this possible with ExoPlayer or how is it possible?

Upvotes: 1

Views: 2238

Answers (2)

Harry .Naeem
Harry .Naeem

Reputation: 1331

Yes it is possible now, use ExoPlayer 2.7.0 which has this functionality. Refer to this issue: Seeking in radio streams

in this last few comments in this post it is mentioned. Hope it helps.

Upvotes: 1

Dima Kozhevin
Dima Kozhevin

Reputation: 3732

For 2.x , Buffer size can be modified using LoadControl:

    DefaultLoadControl loadControl = new DefaultLoadControl(allocator, 30000,
 45000, 1500, DEFAULT_BUFFER_FOR_PLAYBACK_AFTER_REBUFFER_MS);

Official docs

Update: But ExoPlayer has one issue: Audio stream moved to buffering state immediately on disconnection of internet which is scheduled to be fixed by end of year (or shortly thereafter) as developer said

Upvotes: 2

Related Questions