RAD Studio
ContentsIndex
PreviousUpNext
Adding Audio and/or Video Clips to an Application

With the media player component, you can add audio and/or video clips to your application. It opens a media device and plays, stops, pauses, records, etc., the audio and/or video clips used by the media device. The media device may be hardware or software.

Note: Audio support is not available in cross-platform applications.

To add an audio and/or video clip to an application:

  1. Double-click the media player icon on the System category of the Tool palette. This automatically put a media player control on the form window in which you want the media feature.
  2. Using the Object Inspector, select the Nameproperty and enter a new name for your media player control. You will use this when you call the media player control. (Follow the standard rules for naming Delphi identifiers.) Always work directly with the Object Inspector when setting design time properties and creating event handlers.
  3. Select the DeviceType property and choose the appropriate device type to open using the AutoOpen property or the Open method. (If DeviceType is dtAutoSelect the device type is selected based on the file extension of the media file specified by the FileName property.) For more information on device types and their functions, see the table below.
  4. If the device stores its media in a file, specify the name of the media file using the FileName property. Select the FileName property, click the ellipsis (...) button, and choose a media file from any available local or network directories and click Open in the Open dialog. Otherwise, insert the hardware the media is stored in (disk, cassette, and so on) for the selected media device, at runtime.
  5. Set the AutoOpen property to True. This way the media player automatically opens the specified device when the form containing the media player control is created at runtime. If AutoOpen is False, the device must be opened with a call to the Open method.
  6. Set the AutoEnable property to True to automatically enable or disable the media player buttons as required at runtime; or, double-click the EnabledButtons property to set each button to True or False depending on which ones you want to enable or disable. The multimedia device is played, paused, stopped, and so on when the user clicks the corresponding button on the media player component. The device can also be controlled by the methods that correspond to the buttons (Play, Pause, Stop, Next, Previous, and so on).
  7. Position the media player control bar on the form by either clicking and dragging it to the appropriate place on the form or by selecting the Align property and choosing the appropriate align position from the drop down list. If you want the media player to be invisible at runtime, set the Visible property to False and control the device by calling the appropriate methods ( Play, Pause, Stop, Next, Previous, Step, Back, StartRecording, Eject).
  8. Make any other changes to the TMediaPlayer control settings. For example, if the media requires a display window, set the Display property to the control that displays the media. If the device uses multiple tracks, set the Tracks property to the desired track.
 

Multimedia device types and their functions

Device Type 
Software/Hardware used 
Plays 
Uses Tracks 
Uses a Display Window 
dtAVIVideo  
AVI Video Player for Windows  
AVI Video files  
No  
Yes  
dtCDAudio  
CD Audio Player for Windows or a CD Audio Player  
CD Audio Disks  
Yes  
No  
dtDAT  
Digital Audio Tape Player  
Digital Audio Tapes  
Yes  
No  
dtDigitalVideo  
Digital Video Player for Windows  
AVI, MPG, MOV files  
No  
Yes  
dtMMMovie  
MM Movie Player  
MM film  
No  
Yes  
dtOverlay  
Overlay device  
Analog Video  
No  
Yes  
dtScanner  
Image Scanner  
N/A for Play (scans images on Record)  
No  
No  
dtSequencer  
MIDI Sequencer for Windows  
MIDI files  
Yes  
No  
dtVCR  
Video Cassette Recorder  
Video Cassettes  
No  
Yes  
dtWaveAudio  
Wave Audio Player for Windows  
WAV files  
No  
No  

For more information on using the media player control, see the topic called Example of Adding Audio and/or Video Clips.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!