FMX.StreamingMedia Sample

From RAD Studio Code Examples
Jump to: navigation, search

This sample demonstrates how to stream audio and video files.


You can find the StreamingMedia project at:

  • Start | Programs | Embarcadero RAD Studio Alexandria | Samples and then navigate to either of the following folders:
    • Object Pascal\Multi-Device Samples\Media\StreamingMedia
    • CPP\Multi-Device Samples\Media\StreamingMedia
  • 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.


The StreamingMedia sample application shows how to stream audio and video content. The sample uses the TMediaPlayer component for media file playback.

How to Use the Sample

  1. Navigate to one of the locations given above and open:
    • Delphi: StreamingMedia.dproj.
    • C++: StreamingMedia_Cpp.cbproj.
  2. Select the target platform.
  3. Press F9 or choose Run > Run.
  4. Interact with the sample.
    • Video tab:
      • Select one item from the list.
      • Click the play button to reproduce the video file.
      • Click the stop button to stop the reproduction of the video file.
    • Music tab:
      • Introduce a web site.
      • Click Scan to start searching for audio content.
      • Select one item from the list.
      • Click the play button to reproduce the audio file.
    Note: If the media file is not supported by the OS, a error message could appear.


File in Delphi File in C++ Contains



The project itself.



The main form where the components are located.


Unit1.h, Unit1.cpp

Used to define and implement the sample.



Source of the project file that manages the running of the application.


  • The application defines the following methods:
    • ScanText gets as an argument the data obtained from IdHTTP.TIdHTTP.Get. The method calls AddItem to populate the TListBox with the audio files from the URL.
    • GetTagValue provides the URL to the videos from the raw data obtained in IdHTTP.TIdHTTP.Get. The URL is the item that uses ScanText to populate the list of available audio files.
    • IsItemCorrect is used in ScanText to check ig the item is an mp3 audio file.
    • AddItem adds the items to the TListBox.
  • The application defines the following significant controls:
    • Button2, the Scan button, executes Button2Click when clicked.
    • Button1, the Start button, executes Button1Click when clicked.
    • Button3, the Stop/Pause button, executes Button3Click when clicked.
    • Edit1 sets the URL to get the mp3 files from the Internet.


See Also