The ABMAudioPlayer component can be used to play mp3 files. It can also use a playlist.
You can initalize the player in two modes: narrow or full. In narrow mode, a playlist is not supported and you can only load one song. Also note that on mobile devices, the autoPlay parameter has no effect!
LoadSingleSong()
With this method you can load one single song. In this example, we also use the narrow version of the player.
Dim player1 As ABMAudioPlayer player1.Initialize(page, "player1", True, True, False, "") page.Cell(2,1).AddComponent(player1) Dim song As ABMAudioPlayerSong song.Initialize("../Audio/01 (Open) 00 00.mp3") song.ImageUrl = "../Audio/CoverMini.jpg" song.Author = "O∆" song.Title = "(Open) 00 00" player1.LoadSingleSong(song)
LoadPlaylist()
With this method you can load a complete playlist (like an album). For this example we need to use the full version.
Dim player2 As ABMAudioPlayer player2.Initialize(page, "player2", False, True, False, "") page.Cell(5,1).AddComponent(player2) 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")) player2.LoadPlaylist(playlist)
Sub loadSong(Title As String) As ABMAudioPlayerSong Dim song As ABMAudioPlayerSong song.Initialize("../Audio/" & Title & ".mp3") song.ImageUrl = "../Audio/CoverMini.jpg" song.Author = "O∆" song.Title = Title Return song End Sub
Lyrics
You can load Lyrics with the song if you want (full modus). It is a smple list of strings, but they have to be in a certain format. (Take special note to the time prefix: [00:00.00]. Full specs of the lyrics format can be found here: LRC format
Dim song As ABMAudioPlayerSong = loadSong("02 OATMEAL") song.Lyrics.AddAll(LoadLyrics) playlist.add(song)
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