SwiftAudio icon indicating copy to clipboard operation
SwiftAudio copied to clipboard

Jump to Item is not working

Open JhonnyTawk opened this issue 4 years ago • 2 comments

I am using this code:

`for i in 0 ..< songInfoArray.count {

let item = songInfoArray[i]

let audio = DefaultAudioItem(audioUrl: item.url artist: item.singerName, title: item.title, albumTitle: item.thumbnail, sourceType: .stream)

 sources.append(audio)

        }`

try? player.add(items: sources, playWhenReady: false)

`if songInfoArray.count > 1 {

 try? player.jumpToItem(atIndex: songInfoArray.count - 1)

}`

**try? player.jumpToItem(atIndex: songInfoArray.count - 1)** is not working

the player always play the songs from the start

JhonnyTawk avatar Aug 20 '19 10:08 JhonnyTawk

Sorry, it is hard for me to understand your issue. It is much easier to understand your code if you are clear on what you expect to happen, what you do, and what actually happens. Also please provide what version you are on when reporting an issue.

jorgenhenrichsen avatar Aug 22 '19 21:08 jorgenhenrichsen

The issue is I am populating the source array of the fly so If I have 3 items and I added 5 and then I wanted to jump to the last item it's not working. If I set the array with all the items at first that way it works.

I am using the last version on Github.

JhonnyTawk avatar Aug 24 '19 07:08 JhonnyTawk