tschob / AudioPlayerManager

⚠️ No longer maintained ⚠️ Small Swift Wrapper and Queue-Manager around AVPlayer which let you play MediaPlayer items and stream songs from URLs.
MIT License
81 stars 25 forks source link

Thoughts on iOS 10 .playImmediately #19

Open padlocked17 opened 7 years ago

padlocked17 commented 7 years ago

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?

tschob commented 7 years ago

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

tschob commented 7 years ago

@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?

padlocked17 commented 7 years ago

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.

bobek-balinek commented 7 years ago

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.

ghost commented 7 years ago

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

MaurixFx commented 6 years ago

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

ljs19923 commented 6 years ago

Do you have news ?