The MusicPlayer application uses controls such as TProgressBar, and TTrackBar, and platform-specific technologies such as MPMusicPlayerController for iOS, to show how to create a music player.
Your device needs to have at least one song so that you can see the application functionality. The sample allows the audio files listing and standard media controls like play, pause, and volume.
Note: The FireMonkey library contains a TMediaPlayer component that you can use instead of writing your own media player. The FMX.MediaPlayerHD Sample shows how to use TMediaPlayer.
Table of Contents
You can find the MusicPlayer sample project at:
- Start | Programs | Embarcadero RAD Studio Sydney | Samples and navigate to:
Object PascalMulti-Device SamplesMediaMusicPlayer
- Subversion Repository:
- You can find Delphi and C++ code samples in GitHub Repositories. Search by name into the samples repositories according to your RAD Studio version.
Learn more about AIMP and some of the most inviting features of this audio player and organizer according to its developer.
How to Use the Sample
- Navigate to the one of the locations given above, and open:
- Delphi: FMMusicPlayer.dproj
- C++: FMMusicPlayer.cbproj
- Press F9 or choose Run > Run.
- Click an item from the list on your mobile device.
- Click the Play button.
5. Click the Pause button to pause the song, or the Stop button to stop playing the song.
6. Click the Previous button, or the Next button to go through the list items.
- Check an item from the Repeat Modes list: All, One, None, or Default.
- Check the TSwitch control to enable Shuffle Mode.
- Use the VolumeTrackBar to adjust the volume for the music player.
|MediaPlayerU||Contains the base form.|
|MediaPlayer||The project itself.|
- The GetSongsFromLibrary procedure is used to populate PlayListBox with the songs from the library device. It shows the title and the artist of each song.
- The application components are placed on the TabItem1 and TabItem2 pages. You can change between the two pages by setting the ActiveTab property of the TabControl1. Each TabItem of the application has an attached action.
- The SongProgressBar value is calculated in the OnTimer event of TTimer based on the MPMediaItemPropertyPlaybackDuration and currentPlaybackTime methods results.
Fore more details and more links to other sample, please visit the link below: