RAD Studio |  |

Example of Adding Audio and/or Video Clips (VCL Only)
See Also
Collapse All

This example runs an AVI video clip of a multimedia advertisement.

To run this example, create a new project and save the Unit1.pas file to FrmAd.pas and save the Project1.dpr file to DelphiAd.dpr. Then:

1. Double-click the media player icon on the System category of the Tool palette.
2. Using the Object Inspector, set the Name property of the media player to VideoPlayer1.
3. Select its DeviceType property and choose dtAVIVideo from the drop-down list.
4. Select its FileName property, click the ellipsis (...) button, locate and choose an AVI file. Click Open in the Open dialog.
5. Set its AutoOpen property to True and its Visible property to False.
6. Double-click the Animate icon from the Win32 category of the Tool palette. Set its AutoSize property to False, its Height property to 175 and Width property to 200. Click and drag the animation control to the top left corner of the form.
7. Click the media player to bring back focus to it. Select its Display property and choose Animate1 from the drop down list.
8. Click the form to bring focus to it and select its Name property and enter Delphi_Ad. Now resize the form to the size of the animation control.
9. Double-click the form's OnActivate event and write the following code to run the AVI video when the form is in focus:

Copy Code

    VideoPlayer1.Play;

Copy Code

    VideoPlayer1->Play();

Choose RunRun to execute the AVI video.

See Also

Adding Audio and/or Video Clips to an Application

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