Adding Silent Video Clips to an Application

From RAD Studio
Jump to: navigation, search

Go Up to Working with Multimedia

With the animation control, you can add silent video clips to your application.

Note: If you are using Windows 7, you need to add ShellAnimations to your uses clause (Delphi) or #include ShellAnimations (C++) so that the CommonAVIs (such as Vcl.ComCtrls.TAnimateParams.CommonAVI) work correctly. This addition links AVI resources similar to the ones in Windows XP.

To add silent video clips

  1. Double-click the TAnimate icon on the Win32 category of the Tool palette. This automatically puts an animation control on the form window in which you want to display the video clip.
  2. Using the Object Inspector, select the Name property and enter a new name for your animation control. You will use this name when you call the animation 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. Do one of the following:
    • Select the CommonAVI property and choose one of the AVIs available from the drop-down list; or
    • Select the resource of an AVI using the ResName or ResId properties. Use ResHandle to indicate the module that contains the resource identified by ResName or ResID; or
    • Select the FileName property and click the ellipsis (...) button, choose an AVI file from any available local or network directories and click Open in the Open AVI or Open GIF dialog (Windows applications).This loads the AVI or GIF file into memory. If you want to display the first frame of the AVI or GIF clip on-screen until it is played using the Active property or the Play method, then set the Open property to True.
  4. Set the Repetitions property to the number of times you want to the AVI or GIF clip to play. If this value is 0, then the sequence is repeated until the Stop method is called.
  5. Make any other changes to the Vcl.ComCtrls.TAnimate control settings. For example, if you want to change the first frame displayed when animation control opens, then set the StartFrame property to the desired frame value.
  6. Set the Active property to True using the drop-down list or write an event handler to run the AVI or GIF clip when a specific event takes place at run time. For example, to activate the AVI or GIF clip when a button object is clicked, write the button's OnClick event specifying that. You may also call the Play method to specify when to play the AVI (VCL only).

Note: If you make any changes to the form or any of the components on the form after setting Active to True, the Active property becomes False and you have to reset it to True. Do this either just before runtime or at run time.

For more information on using the animation control, see the topic called Example of Adding Silent Video Clips.

See Also