react-native-track-player icon indicating copy to clipboard operation
react-native-track-player copied to clipboard

[iOS] Buffering not starting

Open jakobereksen opened this issue 7 years ago • 4 comments

With the iOS Player pre-1.1.0 Buffering would Start automatically. With the Versions >= 1.1.0 Buffering does not start at all under iOS but works as expected under Android.

I am using these player options:

minBuffer: 100, maxBuffer: 10000, playBuffer: 101, maxCacheSize: 100000

jakobereksen avatar Feb 11 '19 16:02 jakobereksen

what do you mean by "buffering not starting" ? When you add the song to the queue, buffering should start right after you call play().

vbnospace avatar Feb 11 '19 20:02 vbnospace

i will try to explain it better. The behaviour I wanted to achieve and had success doing so on iOS pre 1.1.0 was to buffer the whole track before playing it. To do so I started the track and paused it directly after, waited until it was fully buffered and resumed playing.

With 1.1.0 this did not work for me anymore. Buffering progress stayed at 0, it did not matter whether the track was playing or not. Weirdly enough, while stopping to work for iOS, 1.1.0 made android work for me.

Does this make sense?

jakobereksen avatar Feb 11 '19 21:02 jakobereksen

I'm having trouble getting an answer to this, but is buffering even supported on iOS??

We can't set custom buffering options (options.minBuffer, options.maxBuffer etc) for iOS so it raises questions. Also in the platform support matrix it says caching isn't supported.

Maybe the documentation could be a bit more clear around this? I feel like the shortcomings in iOS are not all that well explained.

@Guichaguri ?

hrag avatar Mar 11 '19 03:03 hrag

I think the playing issue is related to #616

unable to play any streams until I set the undocumented waitForBuffer parameter to true in TrackPlayer.setupPlayer:

TrackPlayer.setupPlayer({
    minBuffer: 30, // buffer 30 seconds
    waitForBuffer: true
  });

To get basic buffer support on iOS add the following to RNTrackPlayer.swift after setupInterruptionHandling();

        // minBuffer iOS support
        let minBuffer: TimeInterval = config["minBuffer"] as? TimeInterval ?? 15
        player.bufferDuration = minBuffer

iOS AudioPlayer Documentation re: preferredForwardBufferDuration

Hope this helps.

samuelstevens9 avatar Aug 07 '19 21:08 samuelstevens9