Open firatyenidunya opened 7 years ago
It did also happen with me, what I did was, manage my own playlist array and keep track of next previous song. When one finishes, I start playing the next from my tracked playlist. Didn't get time to figure our why Jukebox is slow.
How did you do that? Can you help me?
Yes, sure. In my SongsPlayerViewController, I defined a property like:
private var playlist:Array<Song>!
Wrote a method in the same class as:
func playSongs(list:Array<Song>,indexToPlay:Int)
Whenever I need to play multiple songs, I just call this method. This method, in its definition, assigns the instance property playlist
with list
parameter of the method.
The definition of this method does also initialises Jukebox instance with only song item (selects the one based on indexToPlay
from the list
array) and calls Jukebox's play
method.
When the progress of the current song reaches 1, you can call the same playSongs
method with next song index and same playlist
array.
if(currentSongIndex<playlist.count-1){
currentSongIndex += 1
_=self.playList(list: playlist, indexToPlay: currentSongIndex,playingNewPlaylist:false)
}
Let me know if you feel difficulty somewhere. I am using Jukebox's delegate method: jukeboxPlaybackProgressDidChange(_ jukebox : Jukebox)
to track progress. jukeboxDidLoadItem(
is not handy for playing the next song, I had to use progress method.
I'll try. Thanks a lot!
I am getting mp3 files from server. And there is al lot of mp3 files that are appended to jukebox player and it takes a lot of time. for example I am getting 25 music files I am adding them to jukebox player via for loop. It takes at least 20 seconds. Any suggestions? my code,