What are the types of multimedia applications and the means for their development. Develop custom multimedia applications using the capabilities of the Intel Perceptual Computing SDK

In this chapter, we will look at an example of building an application with type 1 multimedia. Create a new project (File | New Project). Place TMediaPlayer on the form; place the components TFileListBox, TDirectoryListBox, TDriveComboBox, TFilterComboBox to select the file. In the FileList property for DirectoryListBox1 and FilterComboBox1, set FileListBox1.

In the DirList property for DriveComboBox1, put DirectoryListBox1. In the Filter property for FilterComboBox1, specify the required file extensions:

AVI File(*.avi)|*.avi

WAVE File(*.wav)|*.wav

MIDI file(*.MID)|*.mid

Let the selected file be played by double-clicking the mouse in FileListBox1. In the OnDblClick event handler for FileListBox1, specify

Procedure TForm1.FileListBox1DblClick(Sender:TObject);

with MediaPlayer1 do

FileName:=FileListBox1.FileName;

The appearance of the form is shown in Fig. 4.

Fig.4. Initial view of the project

Save the project, run it, select the desired file and double-click on it. MediaPlayer should play this file in a separate window.

As mentioned above, the video can be played inside a form, for example, in a panel. Let's slightly modify the project and add a TPanel there (Fig. 5). In the Display property for MediaPlayer1, specify Panel1. You need to remove the caption from the panel (Caption) and the property BevelOuter = bvNone. To switch from a window to a panel during playback, place a TCheckBox on the form and write in the OnClick event handler for it:

procedure TForm1.CheckBox1Click(Sender: TObject);

Start_From: Longint;

with MediaPlayer1 do begin

if FileName="" then Exit;

Start_From:=Position;

if CheckBox1.Checked then

Position:=Start_From;

Launch the project and play the video. Click on the CheckBox.

Rice. 5. Added panel for video playback and

window/panel switch

During program execution, you may need to display the current state of the MediaPlayer object and the video itself (time elapsed since the start of playback, length of the video). For this, the TMediaPlayer object has the corresponding properties and events: Length, Position, OnNotify, etc. Let's add a progress indicator (TGauge) to the project, which will display in percentage how much time has passed (see Fig. 6). You can use a timer to update the indicator readings. Place a TTimer object on the form, set its Interval = 100 (100 milliseconds). In the OnTimer event handler you need to write:


procedure TForm1.Timer1Timer(Sender: TObject);

with MediaPlayer1 do

if FileName<>"" then

Gauge1.Progress:=Round(100*Position/Length);

Fig.6: Complete application for playing AVI, WAV and MDI files

Launch the project, select the file (AVI) and double-click on it. When playing a video, the progress indicator should display the percentage corresponding to the elapsed time (Fig. 6).

3. RESEARCH OBJECTS, EQUIPMENT, MATERIALS AND VISUAL Aids

3.1. IBM compatible computer.

3.2. Installed Windows operating system.

3.3. Installed Borland Delphi application.

3.4. Borland Delphi application help system.

4. WORK TASK

4.1. Studying the theoretical principles of programming in the Borland Delphi environment.

4.2. Completing the teacher’s individual programming assignment within the limits of the issues discussed in this laboratory work.

5. PROCEDURE FOR PERFORMANCE OF THE WORK

5.1. Familiarize yourself with the theoretical principles of this laboratory work.

5.2. Complete individual programming assignments from the teacher.

Exercise 1

Using multimedia components, create a program that allows you to select and view video images

Task 2

Supplement the program with the ability to determine the time and size of the file being played

5.3. Prepare a work report.

5.4. Defend laboratory work by answering questions from the teacher.

6.1. Description of the purpose of the work.

6.2. Basic theoretical principles of the work

6.4. Description of the methodology for completing an individual task.

7. LIST OF SOURCES USED

7.1. Delphi 7: [the most complete guide] / A. D. Khomonenko [et al.]; edited by A. D. Khomonenko. - St. Petersburg. : BHV - St. Petersburg, 2007 .- 1216 p. : ill. (7 copies)

7.2. Programming in Delphi 7 / P. G. Darakhvelidze, E. P. Markov. - St. Petersburg: BHV-Petersburg, 2004 .- 784c. : ill. (1 copy)

7.3. Osipov D. Delphi. Professional programming. - St. Petersburg: Symbol-Plus, 2006. -1056 p., ill.

Two types of multimedia programs

Sometimes you have to provide a simple path for users to play as wide a range of files as possible and then let them select and play the appropriate file. In this case, the form usually contains TMediaPlayer, which provides playback control.

Sometimes a programmer may want to hide the existence of a TMediaPlayer component from the user. That is, play sound or video without the user caring about its source. In particular, sound can be part of a presentation. For example, displaying a graph on the screen may be accompanied by an explanation recorded in a WAV file. During the presentation, the user does not even know about the existence of TMediaPlayer. It works in the background. To do this, the component is made invisible (Visible:= False;) and controlled programmatically.

In this chapter, we will look at an example of building an application with type 1 multimedia. Create a new project (File | New Project). Place TMediaPlayer on the form; place (WIN 3.1 page) components TFileListBox, TDirectoryListBox, TDriveComboBox, TFilterComboBox for file selection. In the FileList property for DirectoryListBox1 and FilterComboBox1, set FileListBox1. Set the DirList property for DriveComboBox1 to DirectoryListBox1. In the Filter property for FilterComboBox1, specify the required file extensions:

AVI File (*.avi) | *.avi

WAVE File (*.wav) | *.wav

MIDI file (*.MID) | *.mid

Let's say we want to double-click on the FileListBox1 component to play the selected file. Then in the OnDblClick event handler for FileListBox1 you should write:

Procedure TForm1.FileListBox1DblClick(Sender:TObject);

with MediaPlayer1 do

The appearance of the form is shown in Fig. 4.

Fig.4. Initial view of the project

Save the project, run it, select the desired file and double-click on it. MediaPlayer should play this file in a separate window.

As mentioned above, the video can be played inside a form, for example, in a panel. Let's slightly modify the project and add a TPanel there (see Fig. 5). Set the Display property for MediaPlayer1 to Panel1. You need to remove the caption from the panel (Caption) and assign the property BevelOuter:= bvNone;

To switch from a window to a panel during playback, place a TCheckBox on the form and write in the OnClick event handler for it:

Start_From: Longint;



with MediaPlayer1 do

if FileName ="" then Exit;

Start_From:= Position;

if CheckBox1.Checked then Display:= Panel1

else Display:= NIL;

Position:= Start_From;

Launch the project and play the video. Click on the CheckBox component.

Fig.5. Added video playback panel

and window/panel switch

During program execution, you may need to display the current state of the MediaPlayer object and the video itself (time elapsed since the start of playback, length of the video). For this, the TMediaPlayer object has the corresponding properties and events: Length, Position, OnNotify, etc.

Let's add a progress indicator (TGauge) to the project, which will display in percentage how much time has passed (see Fig. 6). You can use a timer to update the indicator readings. Place a TTimer object on the form and set it to

Interval:= 100; (100 milliseconds).

In the OnTimer event handler you need to write:

with MediaPlayer1 do

if FileName<>"" then

Launch the project, select the file (AVI) and double-click on it. When playing a video, the progress indicator should display the percentage corresponding to the elapsed time (see Fig. 6).

The DEMOVideo listing is below.

SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,

Forms, Dialogs, ExtCtrls, Gauges, FileCtrl, StdCtrls, MPlayer;

TForm1 = class(TForm)

MediaPlayer1: TMediaPlayer;

CheckBox1: TCheckBox;

FileListBox1: TFileListBox;

DirectoryListBox1: TDirectoryListBox;

DriveComboBox1: TDriveComboBox;

FilterComboBox1: TFilterComboBox;

Button1: TButton;

procedure FileListBox1DblClick(Sender: TObject);

procedure Timer1Timer(Sender: TObject);

procedure CheckBox1Click(Sender: TObject);

procedure Button1Click(Sender: TObject);

(Private declarations)

(Public declarations)

procedure TForm1.FileListBox1DblClick(Sender: TObject);

with MediaPlayer1 do

FileName:= FileListBox1.FileName;

procedure TForm1.Timer1Timer(Sender: TObject);

with MediaPlayer1 do

if FileName<>"" then

Gauge1.Progress:= Round(100*Position/Length);

procedure TForm1.CheckBox1Click(Sender: TObject);

Start_From: Longint;

with MediaPlayer1 do

if FileName ="" then Exit;

Start_From:= Position;

if CheckBox1.Checked then

Display:= Panel1

Position:= Start_From;

procedure TForm1.Button1Click(Sender: TObject);

if FileListBox1.FileName ="" then Exit;

with MediaPlayer1 do

FileName:= FileListBox1.FileName;

Fig.6. Complete AVI, WAV playback application

Understanding the prospects of the automotive electronics market, modern manufacturers of multimedia systems strive to use all the latest technologies in the creation of new models. Until recently, the presence of a navigation system in a radio was perceived as something outlandish and exclusive. For the current market, such functionality is basic, and competition is gradually shifting to the area of ​​wireless communications. In addition, the new generation car multimedia system has improved audio and video playback capabilities. And this is not to mention the ability to connect to a wide range of devices and media that can act as sources of content.

General information about multimedia systems for cars

Despite the development of functional content and technical content, the form factor and design parameters of such devices remain the same. In this regard, creators strive to make equipment as simple, compact and reliable as possible. Usually this is a small block that is embedded in a special niche located on the front panel. Of course, it cannot be denied that a multimedia system for a car has an impact on the aesthetic merits of the interior, so the design of the device is of particular importance. The presence of a touchscreen display has also become a mandatory component in modern devices. It is through it that the functions of the device are controlled - from changing tracks to assigning a route in the navigator. The requirements for automotive electronics are particularly stringent in terms of ergonomics, so the design and control method must be selected with a detailed study of the smallest details.

Acoustic capabilities

In recent years, audio systems have begun to transform into multifunctional equipment. But the initial task of such systems, as before, is to reproduce sound. And in this direction, manufacturers are developing their products no less actively. In the best modern versions, a multimedia speaker system is a whole complex that is equipped with all the capabilities of an audio player, and is also capable of working with a wide range of third-party equipment. Such models, as a rule, have a sound processor, so they can also be connected to a subwoofer. There are also many options with integrated speakers, but in any case, such devices will allow you to customize the sound picture to suit every taste using a wide range of parameters.

As for the connection capabilities, first of all they assume standard ones. If you need to watch video, it would be a good idea to pay attention to the HDMI connector, which is considered the best channel for playing sound and movies.

Navigator function

Although this option has long become almost mandatory for car radios, such systems are still considered hybrid. On the market, such devices can be easily found by the 2DIN marking, which indicates support for the navigator function. With this equipment, the driver gets the opportunity to digitally plot a route with a map displayed on the display screen. Today, even multimedia from the budget segment provides a rather attractive set of tools for working with maps. They can be rotated, enlarged and reduced, marked and, of course, regularly updated and expanded to the route database. The most sophisticated car owners should recommend more functional hybrids equipped with GPS antennas and video recorders. This configuration will eliminate the need to purchase a separate video recording device. But that's not all. To avoid troubles with the road inspection, you can purchase a device that also contains a radar detector. A few hundred meters before approaching the speed limit location, this device will notify the driver about this area.

Communication skills

Along with traditional connectivity options, multimedia devices are also equipped with a variety of technological interfaces. Among them, it is worth noting USB, through which you can connect audio and video equipment, as well as connect the system with mobile devices and a computer. In addition, a modern car multimedia system can provide wireless connections with mobile gadgets and wearable electronics. One of the most popular options in this regard is the connection of a Bluetooth module for communication with a phone. With this connection, the driver can make calls and send SMS using the multimedia system without taking the mobile device out of his pocket. In addition, “blue tooth” allows you to customize audio playback from the same smartphone. Most models of the new generation also have access to the Internet.

Digital TV

A television on the center panel of the car may seem out of place, but this feature will not be superfluous. Manufacturers usually equip such devices with special antennas with magnetic holders and a wide range of options. Actually, in terms of control, digital car TV can be compared to full-fledged receivers and tuners. Same settings with support for surround sound, auto search, equalizer, etc. In addition, the multimedia system, depending on the modification, can actively work with local transmission networks. For this purpose, the LCN system is used, which improves the efficiency of signal reception and broadcast quality.

What else to consider when choosing?

Before purchasing a head unit for a car, you should determine a list of tasks that the system will need to perform. In particular, you should decide on the content sources and devices that will need to be connected to the equipment. You should also evaluate the need for a GPS sensor, radio, Bluetooth module and digital TV. These are, of course, useful options, but with such equipment, a multimedia system costs several times more than one designed solely for sound reproduction. True, in the case of hybrid devices, on the contrary, functionality helps save money. The fact is that multifunctional complexes eliminate the need to purchase a separate DVR and navigation system.

Installation of a multimedia system

Installation of devices of this type is usually carried out according to a standard scheme. Manufacturers complete the equipment with special frames for panels and fastening devices that allow you to easily integrate the equipment into niches prepared for these purposes. However, if you plan to install a monitor with several speakers, then the installation configuration may be non-standard. If a standard multimedia system is installed in the central panel, then equipment with large displays is usually integrated into the ceiling niche. But this configuration is more often found when equipping minivans and SUVs.

Conclusion

Multimedia systems designed for cars look like entertainment complexes, and in some modifications, home theaters. Of course, there is no need to talk about such comparisons in terms of power characteristics and dimensions, but some functional “tricks” from traditional systems have long migrated to the field of automotive electronics. Suffice it to say that a modern multimedia system allows any driver to use communication tools such as Bluetooth, USB and HDMI. And this is not to mention the built-in navigation system, digital television and the ability to access the Internet. Another thing is that the car owner may not need such a rich filling. Especially considering the cost of such devices, which can reach 50-60 thousand rubles.

Tools for creating multimedia applications

Review What is multimedia Multimedia in Delphi TMediaPlayer component Two types of programs that use multimedia

1. Review

Delphi makes it easy and simple to include multimedia objects such as sounds, videos and music into the program. This section discusses how to do this using Delphi's built-in TMediaPlayer component. The management of this component in the program and obtaining information about the current state are discussed in detail.

2. What is multimedia

There is no exact definition of what it is. But at this moment and in this place, it is probably better to give the most general definition possible and say that “multimedia” is a term that applies to almost all forms of animation, sound, video that are used on the computer.

Giving such a general definition, it must be said that in this section we are dealing with a subset of multimedia, which includes:

1. Display video in Microsoft's Video for Windows (AVI) format.

2. Play sounds and music from MIDI and WAVE files.

This task can be accomplished using the Microsoft Multimedia Extensions dynamic library for Windows (MMSYSTEM. DLL), the methods of which are encapsulated in the TMediaPlay component located on the System page of the Delphi Component Palette.

Playing media files may require some hardware and software. So, to play sounds you need a sound card.

3. Multimedia in Delphi

Delphi has a TMediaPlayer component that gives you access to all the basic media programming features. This component is very easy to use. In fact, it's so simple that many novice programmers will find it easier to create their first program that plays video or music rather than displaying the classic "Hello World" message.

Ease of use can be perceived in two ways:

This section does not describe the details of internal calls to multimedia functions when the component is running. All you need to know is that the component is called TMediaPlayer, and that it gives access to a set of routines created by Microsoft called the Media Control Interface (MCI). These routines give the programmer easy access to a wide range of multimedia devices. Actually working with TMediaPlayer is intuitive and obvious.

4. TMediaPlayer component

First, let's create a new project, then place the TMediaPlayer component (System Palette page) on the form, as shown in Figure 1.

Fig.1: TMediaPlayer component on the form.

The TMediaPlayer component is designed like a device control panel with buttons. Just like on a tape recorder, there are buttons for “play”, “rewind”, “record”, etc.

Having placed the component on the form, you will see that the Object Inspector contains the "FileName" property (see Fig. 2). Click twice

DIV_ADBLOCK63">

Fig.3: Playing AVI on the panel.

5. Two types of multimedia programs

Sometimes you need to provide users with an easy way to play as wide a range of files as possible. This means that you will need to give the user access to the hard drive or CD-ROM, and then allow him to select and play the appropriate file. In this case, the form usually contains TMediaPlayer, which provides playback control.

Sometimes a programmer may want to hide the existence of a TMediaPlayer component from the user. That is, play sound or video without the user caring about its source. In particular, sound can be part of a presentation. For example, displaying a graph on the screen may be accompanied by an explanation recorded in a WAV file. During the presentation, the user does not even know about the existence of TMediaPlayer. It works in the background. To do this, the component is made invisible (Visible = False) and controlled programmatically.

6. Example program with multimedia

In this section we will look at an example of building an application with multimedia of the first type. Create a new project (File | New Project). Place TMediaPlayer on the form; place a TOpenDialog class OpenDialog1 component to select a file. In the Filter property for it, specify the required file extensions:

AVI File(*.avi)|*.avi

WAVE File(*.wav)|*.wav

MIDI file(*.MID)|*.mid

Place a Button1 button of the TButton class on the form. Let the OpenDialog1 dialog be called when this button is pressed and the selected file will be played.
Create an OnClick event handler for Button1:

Procedure TForm1.Button1Click(Sender:TObject);

with OpenDialog1 do

if Execute then begin

MediaPlayer1. FileName:=FileName;

MediaPlayer1.Open;

MediaPlayer1.Play;

The appearance of the form is shown in Fig. 4

Fig. 4: Initial view of the project

Save the project, run it, select the desired file and double-click on it. MediaPlayer should play this file in a separate window.

As mentioned above, the video can be played inside a form, for example, in a panel. Let's slightly modify the project and add a TPanel there (see Fig. 5). In the Display property for MediaPlayer1, specify Panel1. It is necessary to remove the inscription from the panel (Caption)

and property BevelOuter = bvNone. To switch from a window to a panel during playback, place a TCheckBox on the form and write in the OnClick event handler for it:

procedure TForm1.CheckBox1Click(Sender: TObject);

Start_From: Longint;

with MediaPlayer1 do begin

if FileName="" then Exit;

Start_From:=Position;

Panel1.Refresh;

if CheckBox1.Checked then

Position:=Start_From;

Launch the project and play the video. Click on the CheckBox.

During program execution, you may need to display the current state of the MediaPlayer object and the video itself (time elapsed since the start of playback, length of the video). For this, the TMediaPlayer object has the corresponding properties and events: Length, Position, OnNotify, etc. Let's add a progress indicator (TGauge) to the project, which will display in percentage how much time has passed (see Fig. 6). You can use a timer to update the indicator readings. Place a TTimer object on the form, set its Interval = milliseconds). In the OnTimer event handler you need to write:

procedure TForm1.Timer1Timer(Sender: TObject);

with MediaPlayer1 do

if FileName<>"" then

Gauge1.Progress:=Round(100*Position/Length);

Launch the project, select the file (AVI) and double-click on it. When playing a video, the progress indicator should display the percentage corresponding to the elapsed time (see Fig. 6).

What is multimedia

Multimedia in Delphi

TMediaPlayer component

Two types of programs that use multimedia

Example program with multimedia

Review

  1. Delphi makes it easy and simple to include multimedia objects such as sounds, videos and music into the program. This tutorial discusses how to do this using Delphi's built-in TMediaPlayer component. The management of this component in the program and obtaining information about the current state are discussed in detail.
  2. What is multimedia
  3. There is no exact definition of what it is. But at this moment and in this place, it is probably better to give the most general definition possible and say that “multimedia” is a term that applies to almost all forms of animation, sound, video that are used on the computer.

To give such a general definition, it must be said that in this lesson we are dealing with a subset of multimedia, which includes:

1. Display video in Microsoft's Video for Windows (AVI) format.

2. Play sounds and music from MIDI and WAVE files.

This task can be accomplished using the Microsoft Multimedia Extensions dynamic library for Windows (MMSYSTEM.DLL), the methods of which are encapsulated in the TMediaPlay component located on the System page of the Delphi Component Palette.

Playing media files may require some hardware and software. So to play sounds you need a sound card. To play AVI on Windows 3.1 (or WFW), you must install Microsoft Video software.

  1. Multimedia in Delphi
  2. Delphi has a TMediaPlayer component that gives you access to all the basic media programming features. This component is very easy to use. In fact, it's so simple that many novice programmers will find it easier to create their first program that plays video or music rather than displaying the classic "Hello World" message.

Ease of use can be perceived in two ways:

 On the one hand, this makes it possible for anyone to create multimedia applications.

 On the other hand, you may find that not all features are implemented in the component. If you want to use low-level functions, you will have to dig quite deep using the Delphi language.

This lesson does not describe the details of internal calls to multimedia functions when the component is running. All you need to know is that the component is called TMediaPlayer, and that it gives access to a set of routines created by Microsoft called the Media Control Interface (MCI). These routines give the programmer easy access to a wide range of multimedia devices. Actually working with TMediaPlayer is intuitive and obvious.

  1. TMediaPlayer component

First, let's create a new project, then place the TMediaPlayer component (System Palette page) on the form, as shown in Figure 1.

Fig.1: TMediaPlayer component on the form.

The TMediaPlayer component is designed like a device control panel with buttons. Just like on a tape recorder, there are buttons for “play”, “rewind”, “record”, etc.

Having placed the component on the form, you will see that the Object Inspector contains the "FileName" property (see Fig. 2). Click twice

Fig.2: TMediaPlayer properties in the Object Inspector

on this property and select a file name with the extension AVI, WAV or

M.I.D. In Fig. 2, the AVI file DELPHI.AVI is selected. Next you need to set the AutoOpen property to True.

After completing these steps, the program is ready to run. After launching the program, click the green “play” button (far left) and you will see a video (if you selected AVI) or hear the sound (if you selected WAV or MID). If this does not happen or an error message appears, then two options are possible:

  1. You entered an incorrect file name.
  2. You have not configured multimedia correctly in Windows. This means that either you do not have the appropriate hardware, or the necessary drivers are not installed. Installation and configuration of drivers is done in the Control Panel; hardware requirements are given in any book on multimedia (you need a sound card, for example, compatible with Sound Blaster).

So, you have the opportunity to play AVI, MIDI and WAVE files simply by specifying the file name.

Another important property of the TMediaPlayer component is Display. Initially, it is not filled and the video is played in a separate window. However, you can use, for example, a panel as a screen to display the video. You need to place the TPanel component on the form and remove the text from the Caption property. Next, for TMediaPlayer, in the Display property, select Panel1 from the list. After this, you need to launch the program and click the “play” button (see Fig. 3)

Fig.3: Playing AVI on the panel.

      1. Two types of multimedia programs
      2.  Sometimes you need to provide users with an easy way to play as wide a range of files as possible. This means that you will need to give the user access to the hard drive or CD-ROM, and then allow him to select and play the appropriate file. In this case, the form usually contains TMediaPlayer, which provides playback control.

 Sometimes a programmer may want to hide the existence of a TMediaPlayer component from the user. That is, play sound or video without the user caring about its source. In particular, sound can be part of a presentation. For example, displaying a graph on the screen may be accompanied by an explanation recorded in a WAV file. During the presentation, the user does not even know about the existence of TMediaPlayer. It works in the background. To do this, the component is made invisible (Visible = False) and controlled programmatically.

      Example program with multimedia

In this chapter, we will look at an example of building an application with type 1 multimedia. Create a new project (File | New Project). Place TMediaPlayer on the form; place the components TFileListBox, TDirectoryListBox, TDriveComboBox, TFilterComboBox to select the file. In the FileList property for DirectoryListBox1 and FilterComboBox1, set FileListBox1. In the DirList property for DriveComboBox1, put DirectoryListBox1. In the Filter property for FilterComboBox1, specify the required file extensions:

AVI File(*.avi)|*.avi

WAVE File(*.wav)|*.wav

MIDI file(*.MID)|*.mid

Let the selected file be played by double-clicking the mouse in FileListBox1. In the OnDblClick event handler for FileListBox1, specify

Procedure TForm1.FileListBox1DblClick(Sender:TObject);

with MediaPlayer1 do

FileName:=FileListBox1.FileName;

The appearance of the form is shown in Fig. 4

Fig. 4: Initial view of the project

Save the project, run it, select the desired file and double-click on it. MediaPlayer should play this file in a separate window.

As mentioned above, the video can be played inside a form, for example, in a panel. Let's slightly modify the project and add a TPanel there (see Fig. 5). In the Display property for MediaPlayer1, specify Panel1. It is necessary to remove the inscription from the panel (Caption)

and property BevelOuter = bvNone. To switch from a window to a panel during playback, place a TCheckBox on the form and write in the OnClick event handler for it:

procedure TForm1.CheckBox1Click(Sender: TObject);

Start_From: Longint;

with MediaPlayer1 do begin

if FileName="" then Exit;

Start_From:=Position;

if CheckBox1.Checked then

Position:=Start_From;

Launch the project and play the video. Click on the CheckBox.


  Fig.5: Added a panel for video playback and a window/panel switch.

During program execution, you may need to display the current state of the MediaPlayer object and the video itself (time elapsed since the start of playback, length of the video). For this, the TMediaPlayer object has the corresponding properties and events: Length, Position, OnNotify, etc. Let's add a progress indicator (TGauge) to the project, which will display in percentage how much time has passed (see Fig. 6). You can use a timer to update the indicator readings. Place a TTimer object on the form, set its Interval = 100 (100 milliseconds). In the OnTimer event handler you need to write:

procedure TForm1.Timer1Timer(Sender: TObject);

with MediaPlayer1 do

if FileName<>"" then

Gauge1.Progress:=Round(100*Position/Length);

Launch the project, select the file (AVI) and double-click on it. When playing a video, the progress indicator should display the percentage corresponding to the elapsed time (see Fig. 6).


  Fig.6: Complete application for playing AVI, WAV and MDI files.