FMX.PlayAudioFile Sample
This sample demonstrates how to include an audio file for playback in your iOS or Android application.
Description
The PlayAudioFile sample demonstrates how to include an audio file for playback on iOS and Android devices. The sample uses the nonvisual TMediaPlayer component for media file playback.
Object Pascal\Mobile Snippets\PlayAudioFileCPP\Mobile Snippets\PlayAudioFile
Classes
TAudioPlayBackForm is the main form that represents the main window of the sample. It contains the following components:
- A TMediaPlayer object.
- A ToolBar object with:
- Two TSpeedButton objects.
- A TLabel object.
Implementation
- The sample uses GetDocumentsPath to obtain the path to the directory where user documents are stored.
- The sample uses TMediaPlayer component for easy access to media files.
- The sample uses TSpeedButton to implement two push-buttons for playing and stopping the reproduction of the audio file.
When you run the application, the sample shows a ToolBar with two TSpeedButton objects with the stylelookup set to stoptoolbuttonbordered and playtoolbuttonbordered. When you click the play button, the sample uses GetDocumentsPath to obtain the media file, and TMediaPlayer.Play to reproduce it. When you click on the stop button, the sample uses TMediaPlayer.Stop to stop the reproduction of the media file.
Uses
See Also
Samples
- RTL Media Player sample
- FireMonkey Media Player HD sample
- FireMonkey Music Player sample
- FireMonkey Audio Rec-Play sample