AudioPlayerManager icon indicating copy to clipboard operation
AudioPlayerManager copied to clipboard

Thoughts on iOS 10 .playImmediately

Open padlocked17 opened this issue 7 years ago • 7 comments

I was looking for a decently solid library to start streaming MP3s from and your wrapper around AVPlayer has been awesome and saved a lot of time so far.

I've noticed with iOS 10 devices, when streaming through AVPlayer, it tends to buffer and create a noticeable lag from the time "play" is commanded and when it actually starts playing audio.

Any thoughts on adding a check for iOS 10 in the open func play(updateNowPlayingInfo: Bool = false) and then adding a playImmediately(atRate: 1.0) in there?

padlocked17 avatar Apr 26 '17 17:04 padlocked17

Hi @padlocked17, I didn't knew this one yet. I'll check it at the weekend and may give it a try.

tschob avatar Apr 27 '17 08:04 tschob

@padlocked17 Is the delay noticable only on the first start of a song and / or after it was paused? Can you send me an URL with which I can reproduce this behavior?

tschob avatar Apr 30 '17 14:04 tschob

It only occurs on the audio files first loading. I use Apple's Network Link Conditioner to test slower internet speeds and on slower connections, it takes a while to buffer the amount Apple thinks is the appropriate amount before beginning to play the audio.

padlocked17 avatar May 12 '17 04:05 padlocked17

I believe this is because the AVPlayer will download the whole MP3 file before starting the playback.

Alternatively you can use AVAsset.loadValuesAsynchronously to trigger a progressive download and then inside the callback do player.replaceCurrentItem(with: …) once the item becomes playable.

bobek-balinek avatar May 12 '17 14:05 bobek-balinek

Hi, has this been implemented? I am not able to play audio immediately.

ghost avatar Aug 19 '17 19:08 ghost

Hello, someone could solve the delay problem when playing the song?.

MaurixFx avatar Feb 06 '18 14:02 MaurixFx

Do you have news ?

ljs19923 avatar Jun 05 '18 12:06 ljs19923