teodorpatras / Jukebox

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

Playing multiple songs #78

Open shuuja opened 7 years ago

shuuja commented 7 years ago

Jukebox playing multiple songs. Play one song and let it play on background, play another song from the list and both songs start playing

RajChanchal commented 7 years ago

I have resolved this error, you can install the pod from my commit: write following line in podfile: pod 'Jukebox' , :git => 'https://github.com/RajChanchal/Jukebox.git', :branch => 'master'

Tommecpe commented 5 years ago

@RajChanchal thank-you for you work,

Can you explain what did you change on your branch to solve the issue, I'm trying to merge your changes with mine :)

RajChanchal commented 5 years ago

@Tommecpe kindly check following two commits for the changes I did:

https://github.com/RajChanchal/Jukebox/commit/bcbab28176f0a933ebb4f0a0653412c0b66020ff https://github.com/RajChanchal/Jukebox/commit/3a73f4dfbe2229e4dd297a8e26dc7b68ce66d33e

Tommecpe commented 5 years ago

Wahoo thank-you for the response in no time !! Unfortunately I've already integrated your commit few months ago (I didn't remember it at the first time 🙄) And I still have some time more than one stream played in parallel :/ I'll dig on it a bit more to try to find a solution.

RajChanchal commented 5 years ago

I didn't notice any of such after the commits, but if you can reoccur the situation, do share with me as well here on the thread, I may have missed handling the states somewhere too. Thanks

Tommecpe commented 5 years ago

Ok,

It might be around

NotificationCenter.default.addObserver(self, selector: #selector(Jukebox.handleStall), name: NSNotification.Name.AVPlayerItemPlaybackStalled, object: nil)

@objc func handleStall() {
      self.stop()
      self.play()
}
RajChanchal commented 5 years ago

Hello @Tommecpe , that's already handled here: https://github.com/RajChanchal/Jukebox/commit/b04243b45be02aa02003ca2f286549a7d867d879

If you check my commits, they are follow up after the above commits. I think, it would be better if you fork my work and check if that works fine for your case.