Programming C++Builder Examples on how to add silent videos and audios to your program?
Notice: Undefined variable: relatedArticlesCount in /home/wwwroot/codeback.net/plugins/content/tags.php on line 149

How to add silent video clips to your program?

Suppose you want to display an animated logo as the first screen that appears when your application starts. After the logo finishes playing the screen disappears.
To run this example, create a new project and save the Unit1.cpp file as Frmlogo.cpp and save the Project1.bpr file as Logo.bpr. Then:

  1. Double-click the animate icon from the Win32 page of the Component palette.
  2. Using the Object Inspector, set its Name property to Logo1.
  3. Select its FileName property, click the ellipsis (...) button, choose the dillo.avi file from your ..\Examples\MFC\General\Cmnctrls directory. Then click Open in the Open AVI dialog.
    This loads the dillo.avi file into memory.
  4. Position the animation control box on the form by clicking and dragging it to the top right hand side of the form. 
  5. Set its Repetitions property to 5.
  6. Click the form to bring focus to it and set its Name property to LogoForm1 and its Caption property to Logo Window. Now decrease the height of the form to right-center the animation control on it.
  7. Double-click the form's OnActivate event and write the following code to run the AVI clip when the form is in focus at runtime:
    Logo1->Active = true;
  8. Double-click the Label icon on the Standard page of the Component palette. Select its Caption property and enter Welcome to Armadillo Enterprises 4.0. Now select its Font property, click the ellipsis (...) button and choose Font Style: Bold, Size: 18, Color: Navy from the Font dialog and click OK. Click and drag the label control to center it on the form.
  9. Click the animation control to bring focus back to it. Double-click its OnStop event and write the following code to close the form when the AVI file stops:
    LogoForm1->Close();
  10. Select Run|Run to execute the animated logo window.

 

How to add audio and/or video clips (VCL only) to your program?

This example runs an AVI video clip of a multimedia advertisement for C++Builder. To run this example, create a new project and save the Unit1.cpp file to FrmAd.cpp and save the Project1.bpr file to MmediaAd.bpr. Then:

  1. Double-click the media player icon on the System page of the Component 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,  choose the file from your ..\Examples\Coolstuf directory. 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 page of the Component 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 C++_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:
    VideoPlayer1->Play();
  10. Choose Run|Run to execute the AVI video.

Add comment


Security code
Refresh

Programming - C++Builder