Hello,
this script puts an image and a player for each music track available in a chosen album.
Up front I don't know exactly how many tracks there are.
I had a same structure with the expandable clv tested, but for that I knew how much tracks there where so that was easier.
So this one scrolls until the last track.
I'd hoped for an unique players, but clearly I seem not getting the idea how to do it.
Also now each player reacts on the other playing together but only one track and the Next button plays the next song which should not happen. If a player is started then another should stop.
Also from the expandable clv I know that in that case the Next button does not go to the next track.
But for it's just a CLV.
This is the script calling the next script but here you see the repeat loop.
I don't think I can do like: player(i).Prepare(playerJ.CreateListSource(sources1)) ?
Does anyone can give a push in the right direct how I should do this?
If it's not possible then another thing I can try is to just have 1 player and use the next button to display the Image and play the next track. In that case there is no scrolling needed. and not all images have to be downloaded in one go (not using lazy loading here).
Thanks for any help!
this script puts an image and a player for each music track available in a chosen album.
Up front I don't know exactly how many tracks there are.
I had a same structure with the expandable clv tested, but for that I knew how much tracks there where so that was easier.
So this one scrolls until the last track.
I'd hoped for an unique players, but clearly I seem not getting the idea how to do it.
Also now each player reacts on the other playing together but only one track and the Next button plays the next song which should not happen. If a player is started then another should stop.
Also from the expandable clv I know that in that case the Next button does not go to the next track.
But for it's just a CLV.
This is the script calling the next script but here you see the repeat loop.
B4X:
Sub FillCLV
Log("start FillCLV")
clv1.Clear
TrkImage.Initialize("")
Dim sources1 As List
sources1.Initialize
''''''playerJ.Prepare(playerJ.CreateListSource(sources1))
Dim trackpic As String
If albumtrackpics.IsInitialized Then
Log("albumtrackpics= " & albumtrackpics.Get(0))
For i = 0 To albumtrackpics.Size -1
trackpic = albumtrackpics.Get(i)
Log("trackpic= " & trackpic)
'''''playerJ.Initialize("playerJ")
playerJ.Prepare(playerJ.CreateListSource(sources1))
Dim p1 As B4XView = CreateItem((0xFF000000), TrkImage, playerJ)
clv1.Add(p1,"")
Dim tr As Int
tr = i + 1 'there is no 0.mp3 so add 1
DownloadImage(trackpic, TrkImageView) 'correct name is in albumtrackpics.Get(i)
sources1.Add(playerJ.CreateUriSource("https://trackshere.com/albumtracks/" & albumnamempthree & "/" & tr & ".mp3"))
Next
End If
End Sub
Does anyone can give a push in the right direct how I should do this?
If it's not possible then another thing I can try is to just have 1 player and use the next button to display the Image and play the next track. In that case there is no scrolling needed. and not all images have to be downloaded in one go (not using lazy loading here).
Thanks for any help!