Delphi multimedia design-tmediaplayer component (7)

Source: Internet
Author: User
AVI Video

Use the tmediaplayer to play the AVI Video, select the AVI file, and call the play method (or click the play button). If you use the default mediaplayer settings, an independent window is displayed to play the AVI Video. For example:

You can also set the display attribute of tmediaplayer to any window component. Video Playback will appear in the client area of this component.

For example, if you have a pnl1 panel on the form and want to display the AVI video on this pnl1 panel, you should press the followingCodeSet the display attribute:

 
Mp1.display: = pnl1;

When Avi is played, it is displayed in the panel. If the video is larger than the Panel rectangle, the video will be cropped to the Panel size. For example:

You can set the displayrect attribute to zoom in or out the video. The Code is as follows:

 
Mp1.displayrect: = pnl1.clientrect;

The following figure shows the effect after playback:

There are many AVI video formats, not all of which can be played. To display specific video encoding formats, you must install the corresponding decoder. For security purposes, the standard Microsoft AVI video format is used. Almost all users have installed the encoder.

Note

The tanimate component (under the Win32 tag) is used to play a small video you see when operating windows, such as an animation you see when copying a file or moving a file in Windows resource management, such:

For example, search for the animation in the dialog box when searching for a file. Avi played by the tanimate component must be uncompressed or only RLE Compressed. Other compression formats are not allowed. Audio cannot be included in Avi.

The above code passes the test in Delphi 7. Download the sample code: aviplayer.rar

Example AVI Video:Http://kuai.xunlei.com/d/RFJZWJPHLOIG

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.