FMX.StreamingMedia Sample

From RAD Studio Code Examples
Jump to: navigation, search

This sample demonstrates how to stream audio and video files.

Location

You can find the StreamingMedia project at:

Description

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.

Files

File in Delphi File in C++ Contains

StreamingMedia.dproj

StreamingMedia_Cpp.cbproj

The project itself.

Unit1.fmx

Unit1.fmx

The main form where the components are located.

Unit1.pas

Unit1.h, Unit1.cpp

Used to define and implement the sample.

StreamingMedia.dpr

StreamingMedia_Cpp.cpp

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

Implementation

  • 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.

Uses

See Also

Samples