teodorpatras / Jukebox

Player for streaming local and remote audio files. Written in Swift.
MIT License
551 stars 122 forks source link

Online stream buffering state #29

Open buddax2 opened 8 years ago

buddax2 commented 8 years ago

Is it possible to get notified when online stream started to play? As I understand the buffering state is missing. So I get the .playing state right after I call player?.play() but it took a few seconds to start playing audio.

mattwritescode commented 8 years ago

I've run across this issue as well. In fact, it seems that jukeboxDidLoadItem() gets called twice for a single play sometimes. This complicates the possibility of counting the number of times a song as played (which might be a nice enhancement all on it's own).

RajChanchal commented 7 years ago

Any news of getting to know if song is buffering?

mattwritescode commented 7 years ago

@RajChanchal from what I could find the best way to tell whether it is buffering or actually playing is to monitor the jukeboxPlaybackProgressDidChange method in the JukeboxDelegate. If the song is buffering then the jukebox.currentItem.currentTime parameter in that method will have the value 0. Once the song starts playing audibly that value increases.

RajChanchal commented 7 years ago

@mattwritescode You are right about the value being 0. I had already put a check on it. So, it is not a problem when starting a song and showing user some loader that it is loading. Problem is, when due to slow internet it buffers in between. User should be shown some loader when it's buffering. But to show that, I must be knowing when its buffer goes empty. I think, I made you clear what I meant. Thanks by the way for the great lib.

ahmeddshahidd commented 6 years ago

@RajChanchal I am facing the exactly same issue. Did you find any solution?