B4J Tutorial [ABMaterial] New component ABMAudioPlayer in 1.08

ABMAudioPlayer is a new component for ABMaterial v1.08 that allows to play mp3 files in WebApps. This component can play individual mp3 files, or playlists (see video). It can also show lyrics (in the lrc file format). I cannot record audio in my videos, but it shows how it works. :)

This is the APlayer library, materialized with bigger buttons, themeable, being responsive etc...


Very little code is needed in B4J:

B4X:
Dim player As ABMAudioPlayer
    player.Initialize(page, "player", False, True, True, "")
    page.Cell(7,1).AddComponent(player)
  
    Dim playlist As List
    playlist.Initialize
    playlist.Add(loadSong("01 (Open) 00 00"))
    playlist.Add(loadSong("02 OATMEAL"))
    playlist.Add(loadSong("03 NATURAL"))
    playlist.Add(loadSong("04 Steal"))
    playlist.Add(loadSong("05 Nobody Hangs Out Anymore"))
    playlist.Add(loadSong("06 GUTS"))
    playlist.Add(loadSong("07 Coordinates 00 36"))
    playlist.Add(loadSong("08 Love Song"))
    playlist.Add(loadSong("09 09 87 (Where is your Home)"))
    playlist.Add(loadSong("10 SURVIVE"))
      
    player.LoadPlaylist(playlist)

B4X:
' helper methods
Sub loadSong(Title As String) As ABMAudioPlayerSong
    Dim song As ABMAudioPlayerSong
    song.Initialize("../Audio/" & Title & ".mp3")
    song.ImageUrl = "../Audio/O∆ Cover Mini.jpg"
    song.Author = "O∆"
    song.Title = Title
    Return song
End Sub

Sub LoadLyrics() As List
    Dim l As List
    l.Initialize
  
    l.Add("[ar:Beatles]")
    l.Add("[ti:Hello goodbye]")
    l.Add("[la:uk]")
    l.Add("[00:00.00]You say yes, I say no.")
    l.Add("[00:04.00]You say stop And I say go go go, oh no.")
    l.Add("[00:17.00]You say goodbye And I say hello")
    l.Add("[00:22.00]Hello hello")
    l.Add("[00:25.00]I don't know why you say goodbye, Isay hello")
    l.Add("[00:30.00]Hello hello")
    l.Add("[00:32.00]I don't know why you say goodbye, I say hello.")
    l.Add("[00:38.00]I say high, you say low.")
    l.Add("[00:42.00]You say why And I say I don't know, oh no.")
    l.Add("[00:55.00]You say goodbye And I say hello")
    l.Add("[00:59.00]HELLO GOODBYE HELLO GOODBYE hello hello")
    l.Add("[01:02.00]HELLO GOODBYE I don't know why you say goodbye, I say hello")
    l.Add("[01:06.00]HELLO GOODBYE HELLO GOODBYE hello hello")
    l.Add("[01:09.00]HELLO GOODBYE I don't know why you say goodbye")
    l.Add("[01:12.00]HELLO GOODBYE I say goodbye.")
    l.Add("[01:20.00]Why why why why why why Do you say goodbye goodbye, oh no?")
    l.Add("[01:32.00]You say goodbye And I say hello")
    l.Add("[01:38.00]Hello hello")
    l.Add("[01:40.00]I don't know why you say goodbye, I say hello")
    l.Add("[01:45.00]Hello hello")
    l.Add("[01:47.00]I don't know why you say goodbye, I say hello.")
    l.Add("[01:53.00]You say yes I SAY YES I say no BUT I MAY MEAN NO.")
    l.Add("[01:58.00]You say stop I CAN STAY And I say go go go TILL IT'S TIME TO GO OH, oh no.")
    l.Add("[02:10.00]You say goodbye And I say hello")
    l.Add("[02:15.00]Hello hello")
    l.Add("[02:17.00]I don't know why you say goodbye, I say hello")
    l.Add("[02:22.00]Hello hello")
    l.Add("[02:24.00]I don't know why you say goodbye, I say hello")
    l.Add("[02:29.00]Hello hello")
    l.Add("[02:32.00]I don't know why you say goodbye, I say hello hello.")
    l.Add("[02:45.00]Hela heba helloa CHA CHA.................")
  
    Return l
End Sub
 
Top