unit SimpleMovieplayer;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Variants,
System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.ComCtrls,
Vcl.ExtCtrls,
Vcl.MPlayer,
Vcl.StdCtrls,
Vcl.Buttons;
type
TMediaPlayerForm =
class(TForm)
Panel1: TPanel;
Panel2: TPanel;
MediaPLayerStatusBar: TStatusBar;
MediaPlayer1: TMediaPlayer;
BitBtn1: TBitBtn;
PlayBitBtn: TBitBtn;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject;
var Action: TCloseAction);
procedure BitBtn1Click(Sender: TObject);
procedure PlayBitBtnClick(Sender: TObject);
private
procedure PlayFile(s:
string);
{ Private-Deklarationen }
public
{ Public-Deklarationen }
playList: TStringList;
end;
var
MediaPlayerForm: TMediaPlayerForm;
implementation
{$R *.dfm}
uses UnitSelectAVIFiles;
procedure TMediaPlayerForm.BitBtn1Click(Sender: TObject);
begin
SelectMediaFilesForm.playList := playList;
SelectMediaFilesForm.Showmodal;
if SelectMediaFilesForm.ModalResult = mrOK
then
begin
playList := SelectMediaFilesForm.playList;
end;
end;
procedure TMediaPlayerForm.PlayBitBtnClick(Sender: TObject);
var
i: integer;
begin
for i := 0
to playList.Count - 1
do
begin
MediaPLayerStatusBar.SimpleText := IntToStr(i) + '
now playing mediafile ->'
+ playList[i];
PlayFile(playList[i]);
end;
end;
procedure TMediaPlayerForm.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
playList.Free;
end;
procedure TMediaPlayerForm.FormCreate(Sender: TObject);
begin
playList := TStringList.Create;
end;
procedure TMediaPlayerForm.PlayFile(s:
string);
begin
if (FileExists(s))
then
begin
MediaPlayer1.Display := Panel1;
MediaPlayer1.FileName := s;
MediaPlayer1.Wait := true;
MediaPlayer1.Open;
MediaPlayer1.play;
end;
end;
end.