Android Question EXOPLAYER skip player to next 'SOURCE'

Rusty

Well-Known Member
Licensed User
Longtime User
In the demo we added several "source" items to be played resulting in a source LIST of items.
As the player plays through the sources, I'd like to be able to click a view (button, combobox, etc.) and have the associated item within the list begin playing from the beginning of that item.
Any ideas/suggestions are appreciated.
Rusty
I've tried to use the ExoPlayerEx example and it abends every time I issue:
B4X:
Sub Activity_Create(FirstTime As Boolean)
 Activity.LoadLayout("1")

    Player.Initialize("Player")
    sources.Initialize
    For i = 1 To 31            'load the audio files
        Dim FileNumber As String = ZeroFill(i, True, 3)
        Dim Filename As String = "File_001_" & FileNumber & ".mp3"
        sources.Add(Player.CreateFileSource(File.DirAssets, Filename))
    Next
    Player.Prepare(Player.CreateListSource(sources))
        Player.Play
        PlayerEx.Intialize(Player)
…
End Sub

INDEX here indicates the row within the CustomListview1 that represents this audio file
Sub CustomListView1_ItemClick (Index As Int, Value As Object)
    Player.Initialize("Player")
    PlayerEx.CurrentWindowIndex =  (Index + 1) Mod PlayerEx.WindowCount       'it blows up here with a null reference
    Player.Play
End Sub
 

Rusty

Well-Known Member
Licensed User
Longtime User
...sorry, that was a residual from a previous attempt to initialize the player; clear the sources; reload the sources; prepare and play...
The second initialization wasn't supposed to be there...
The mentioned attempt works, but it seems very inefficient, so I was trying to use the PlayerEx to move/position.
The question still stands sans the initialization
But now it blows up in the ExoPlayerExtra:
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…