Android Question ExoPlayer change Next/Previous

Bossolo

Member
Hi there,
i have a SimpleExoPlayer that play a playlist of song with relative SimpleExoPlayerView, i have a multimedia controller to change the volume and go next or previous; the volume is ok, but i can't change the song. So i catch the multimedia button, but i can't find the command for do it, i just found play/pause
I already read the documentation and other threads without success
 

Bossolo

Member
How are you setting the media source? Are you using CreateListSource?

Yes, this is the section. At first i create a list with all the link of the song, then i add all to a playlist as source

ExoPlayerInit:
MPMusica.Initialize("MPMusica")
IsMPMusicaInit = True
For Each Canzone As Song In mapPlaylist.Values
    If Canzone.NomeFile.Length>0 Then
        MaxSong=MaxSong+1
        lstSong.Add(MPMusica.CreateUriSource(PathHttp & "/musiche/" & FormattaTitolo(Canzone.NomeFile)))
    End If
Next
If MaxSong>0 Then
    asdbc_main.Hide(False)
    MPMusica.Prepare(MPMusica.CreateListSource(lstSong))
    MusicPlayer.Player = MPMusica
    MPMusica.Play
End If
 
Upvote 0

Bossolo

Member
B4X:
    player1.As(JavaObject).GetFieldJO("player").RunMethod("next", Null) 'or previous

How can i initialize the JavaObject? i try with the following line but i obtain the error "java.lang.ClassNotFoundException: com$google$android$exoplayer2"
B4X:
Dim player1 As JavaObject
player1.InitializeStatic("com.google.android.exoplayer2")
 
Upvote 0
Top