Page 1 of 1

How create android app mp3 player

Posted: Sat May 25, 2024 8:34 am
by acreis
Good Morning


Is it possible, using SpiderBasic to create an Android app, to be deployed to an automobile device (android car radio) that reads removable storage in USB ports and plays music in MP3 format .

Thanks!

Re: How create android app mp3 player

Posted: Sat May 25, 2024 10:17 am
by Caronte3D
With PlaySound() you can play any audio file, if the browser support it, maybe on Android app is the same.

I only tested it on Windows (Chrome):

Code: Select all

  InitSound()
  
  Procedure Loading(Type, Filename$, ObjectId)
    Debug Filename$ + " loaded (id = " + ObjectId + ")"
  EndProcedure
    
  Procedure LoadingError(Type, Filename$)
    Debug Filename$ + ": loading error"
  EndProcedure
  
  Procedure MyPlay()
    PlaySound(1) ; play the sound
    Debug "Playing..."
  EndProcedure
  
  OpenWindow(0, 0, 0, 200, 200, "Player", #PB_Window_SystemMenu | #PB_Window_SystemMenu)
  ButtonGadget(2,75,75,50,50,"PLAY")
  
  BindEvent(#PB_Event_Loading, @Loading())
  BindEvent(#PB_Event_LoadingError, @LoadingError())
  BindEvent(#PB_Event_Gadget, @MyPlay(),0,2)
  
  
  LoadSound(1, "Free_Test_Data_100KB_MP3.mp3")