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