Android Question ExoPlayer play n Track

IdasI4A

Active Member
Licensed User
Longtime User
I used ExoPlayer to make a playlist for a number of video files as follows:
B4X:
    Dim sources As List
    sources.Initialize
    for i=1 to 10
        sources.Add(player1.CreateFileSource(File.DirAssets, i & ".mp4"))
    next
    player1.Prepare(player1.CreateListSource(sources))

how can i make it start with the file 4.mp4? i.e. when i do player1.play it will play the file 4.mp4.

Thanks
 

zed

Well-Known Member
Licensed User
Maybe this.
B4X:
Dim sources As List
sources.Initialize
for i=1 to 10
      source.add( i & ".mp4")
next
player1.Prepare(player1.CreateFileSource(File.DirAssets, source.get(4))
 
Upvote 0

IdasI4A

Active Member
Licensed User
Longtime User
Thank you. But what I want is that when I press next track (in the ExoPlayer control) I see the next video and when I press previous video I see the previous video.
control Exoplayer.jpg
 
Upvote 0

teddybear

Well-Known Member
Licensed User
Thank you. But what I want is that when I press next track (in the ExoPlayer control) I see the next video and when I press previous video I see the previous video.
View attachment 164127
Try this code

B4X:
player1.As(JavaObject).GetField("player").As(JavaObject).RunMethod("seekToDefaultPosition", Array(4))
 
Upvote 1
Solution
Top