React-native-track-player: audio buffers half of the duration

Created on 16 Jan 2018  路  6Comments  路  Source: react-native-kit/react-native-track-player

how can i make the buffering longer, a 6 minutes song will buffer 3 mins then buffers slowly which makes Seeking song slower

Question

Most helpful comment

I am facing the same problem. Audio only starts playing when it has a big amount of the song buffered. I am trying to make play as soon as it get the first bit of the song. Help!

All 6 comments

You can set the buffering options in setupPlayer.

minBuffer: The minimum time in seconds that need to be buffered all the time.
maxBuffer: The maximum time in seconds that need to be buffered to stop loading more of the track.
playBuffer: The minimum time in seconds that need to be buffered to to start playing.

If it's below than minBuffer, it will start to buffer, after it reaches playBuffer, it will automatically resume the song, and it will stop buffering when it reaches the maxBuffer.

Basically, maxBuffer shouldn't be too big or it will use a lot of memory, minBuffer shouldn't be too low or it will allow the user to start playing when there is not enough data to keep a constant playback, and playBuffer should be between minBuffer and maxBuffer.

I tried this but doesnt affect anything on iOS

I can confirm @RekarBotany these settings have no effect on iOS. Haven't checked Android.

  TrackPlayer.setupPlayer({
    minBuffer: 300,
    playBuffer: 20 ,
    maxBuffer: 300,
    maxCacheFiles: 100,
  }).then(() => {....

A quick repo search shows that there is no reference to min/max/play buffer in the ios files.

I am facing the same problem. Audio only starts playing when it has a big amount of the song buffered. I am trying to make play as soon as it get the first bit of the song. Help!

@ntk860 have you found any solution to this? because I am trying to play around 160MB mp3 file

@Guichaguri Any updates on this? This is the only reason I switched from react-native-sound to this library. If it loads the entire file before playing it, it's not actually streaming.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

moduval picture moduval  路  4Comments

KalebPortillo picture KalebPortillo  路  4Comments

simenJohnsen picture simenJohnsen  路  3Comments

fabiocosta88 picture fabiocosta88  路  3Comments

EhteshamAnwar picture EhteshamAnwar  路  3Comments