Board index » delphi » TMediaPlayer and AVI window border

TMediaPlayer and AVI window border

The following Delphi 1 code will allow the user to choose and play an AVI
file...

procedure TForm1.Button1Click(Sender: TObject);
begin
  MediaPlayer1.DeviceType := dtAutoSelect;
 OpenDialog1.Execute;
 MediaPlayer1.FileName := OpenDialog1.FileName;
 MediaPlayer1.Open;
 MediaPlayer1.Play;
end;

procedure TForm1.MediaPlayer1Notify(Sender: TObject);
begin
 MediaPlayer1.Close;
end;

In this process, the AVI will be displayed in a separate window and not part
of the Delphi form.  My question(s) are:

1) Is it possible to have an AVI displayed within a Delphi form?

and

2) Is it possible to remove the title bar and/or the border to the window in
which the AVI is displayed?  Also, can one force the location on the screen
where the AVI is displayed?

As you can guess, I want more control over the playing of the AVI than just
having the AVI pop up on the screen anywhere it wants.

Thanks.

Philip

 

Re:TMediaPlayer and AVI window border


Dear Philip,

Let me answer your second question first.  To remove the title bar (i.e. the
avi buttons), set all the VisibleButtons to False either in the TMediaPlayer
properties windows or in your source code.

    MediaPlayer1.VisibleButtons := [ ];

Next, you can add a compatible control like Panel, Button ... etc to your
Form.  Set the Display property of MediaPlayer to map the compatible control
like the following :

  MediaPlayer1.Display := Panel1;     //Set display device to a TPanel

Finally, your AVI will perform within your form and the title bar or the
buttons bar will be disappeared.  Hope this can help you.

Andrew.

Quote
Philip K. wrote in message <70dfmg$5v...@forums.borland.com>...
>The following Delphi 1 code will allow the user to choose and play an AVI
>file...

>procedure TForm1.Button1Click(Sender: TObject);
>begin
>  MediaPlayer1.DeviceType := dtAutoSelect;
> OpenDialog1.Execute;
> MediaPlayer1.FileName := OpenDialog1.FileName;
> MediaPlayer1.Open;
> MediaPlayer1.Play;
>end;

>procedure TForm1.MediaPlayer1Notify(Sender: TObject);
>begin
> MediaPlayer1.Close;
>end;

>In this process, the AVI will be displayed in a separate window and not
part
>of the Delphi form.  My question(s) are:

>1) Is it possible to have an AVI displayed within a Delphi form?

>and

>2) Is it possible to remove the title bar and/or the border to the window
in
>which the AVI is displayed?  Also, can one force the location on the screen
>where the AVI is displayed?

>As you can guess, I want more control over the playing of the AVI than just
>having the AVI pop up on the screen anywhere it wants.

>Thanks.

>Philip

Re:TMediaPlayer and AVI window border


Quote
>Let me answer your second question first.  To remove the title bar (i.e.
the
>avi buttons), set all the VisibleButtons to False either in the
TMediaPlayer
>properties windows or in your source code.

Andrew,

Thanks for the reply, however...

I don't see what the VisibleButtons has to do with the window's title bar
(the blue bar with the system menu icons).  Setting the VisibleButtons to []
has no effect on the window's title bar.

Quote
>Next, you can add a compatible control like Panel, Button ... etc to your
>Form.  Set the Display property of MediaPlayer to map the compatible
control
>like the following :

>  MediaPlayer1.Display := Panel1;     //Set display device to a TPanel

That's a helpful tip, which I did not know.  Thanks.  The only other
question that I have is...how do I position the AVI file perfectly centered
within the TPanel?   Or, how can I determine the size of the AVI so that I
can resize and reposition the TPanel?

Philip

Other Threads