dimitris-c / AudioStreaming

An AudioPlayer/Streaming library for iOS written in Swift using AVAudioEngine.
MIT License
266 stars 56 forks source link

player buffer #31

Closed ananevam closed 3 years ago

ananevam commented 3 years ago

When internet connection is unstable, the sound of the stream isn’t available. Looks like this player hasn’t a buffer. For example, the avplayer plays stream for 10 seconds if the internet connection has been lost

dimitris-c commented 3 years ago

Thanks for raising this, I will have a look when I have some time.

In the meantime you could also have a go at it and open a PR if you have a fix for this

dimitris-c commented 3 years ago

You can try and set the framesRequiredAfterRebuffering to a higher value, the default is 1 seconds - this would probably help with the buffering.

ananevam commented 3 years ago
   not working. i try play stream

    let configuration: AudioPlayerConfiguration = AudioPlayerConfiguration(flushQueueOnSeek: true,
                                                                           bufferSizeInSeconds: 8,
                                                                           secondsRequiredToStartPlaying: 10,
                                                                           gracePeriodAfterSeekInSeconds: 10,
                                                                           secondsRequiredToStartPlayingAfterBufferUnderun: 10,
                                                                           enableLogs: true)

    player = AudioPlayer(configuration: configuration)
dimitris-c commented 3 years ago

In my testing, using Network Link Conditioner (both on a device and on simulator) to control between different networking conditions I found out that changing the secondsRequiredToStartPlayingAfterBufferUnderun to 10 behaved almost the same as AVPlayer

As I said before, the beauty of open source is that anyone can tinker with the code and make changes...