FM2 Music Player example

Posted by on in Blogs
FM2 introduces TMediaPlayer, a non visual control similar to the Vcl TMediaPlayer but this one works on both Windows and Mac. It can play audio and video files which are displayed using TMediaPlayerControl.
To get the list of the supported files you can use TMediaCodecManager in FMX.Media which contains functions such as GetFileTypes : string or GetFilterString : string. The last is created to help opening media using open dialogues and setting the Filter property so you can open only supported files. I have built a demo application that will show you how to use TMediaPlayer for audio files. The demo allows you to load multiple media files into a TListBox and play them as a playlist. You have shuffle and repeat all options, volume control, drag and drop into the TListBox and custom open dialogues that use the application style. You will find more in the code, such as the use of actions and transparent forms.
You can download it from code central if you have an account, the download link is :
http://cc.embarcadero.com/Item/29058
Hope you enjoy it and I will come back with more samples.


Comments

Check out more tips and tricks in this development video: