Play mp3 file on android - Delphi
Hello guy come back again in my code my adventure blog, yup this is my adventure archieve coding, and now it's simple code how to play mp3 file on delphi for android aplication . here the code :
you need to do the following:
you need to do the following:
- Put the mp3 file into the same directory as the project
- Go to Project-> Deployment and selected 'All Configurations - iOS Device Platform/iOS Simulator Platform/Android Platform'
- Click on the 'Add Files' icon
- Browse to your mp3 file
- Set the Remote Path for your mp3 file
dont forget to add media on additional pallet
created two on-click events for playing the audio clip and stopping playback.
uses
System.iOUtils;
procedure TAudioPlayBackForm.btnPlayClick(Sender: TObject);
begin
MediaPlayer1.FileName := TPath.GetDocumentsPath + PathDelim + 'soundsample.mp3';
MediaPlayer1.Play;
end;
procedure TAudioPlayBackForm.btnStopClick(Sender: TObject);
begin
MediaPlayer1.Stop;
end;
end.
Join the conversation