unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Borland.Vcl.StdCtrls, Borland.Vcl.ExtCtrls, System.ComponentModel,
  Borland.Vcl.MPlayer;

type
  TForm1 = class(TForm)
    MediaPlayer1: TMediaPlayer;
    Panel1: TPanel;
    Button1: TButton;
    OpenDialog1: TOpenDialog;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.nfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenDialog1.Execute then 
   begin
   MediaPlayer1.Close;
   MediaPlayer1.FileName:=OpenDialog1.FileName;
   MediaPlayer1.Open;
   MediaPlayer1.DisplayRect:=Panel1.ClientRect;
   end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
MediaPlayer1.DisplayRect:=Panel1.ClientRect;
end;

end.
