How to press a button to play a melody with a given path? Android

  • And what, is there a delphi on android? This is not sarcasm, I'm really interested, suddenly the mark of the delphi on the case) - Duck Learns to Take Cover
  • 2
    @Morely tipping UTka is, for several years now, and on iOS there is. - Kromster
  • Clarify the question, what is the melody (where it is, in what format), where and how should the Delphi and Android versions play? - Kromster

1 answer 1

I found the article: how to create a media player

In short, use the TMediaPlayer component TMediaPlayer

 MediaPlayer1.FileName := 'file.mp3'; MediaPlayer1.Play; 

Also an example can be found here.

  • I tried your code, however, it doesn’t work on win and android either, there are no errors, I just press a button and nothing happens. - Makine
  • one
    @Makine and the path to the file specify the correct? Most likely this is the problem. Here's another instruction: FMX.Media.TMediaPlayer or write your own mp3-player for Android # 1 - zed