Add a listbox, a 2 buttons, a scrollbar, a progressbar, a openfiledialog and a mediaplayer to your forum and you're good to go.
procedure TForm1.Button1Click(Sender: TObject);
begin
if opendialog1.Execute = true then
begin
mediaplayer1.FileName := opendialog1.FileName;
mediaplayer1.Open;
statictext1.Caption := mediaplayer1.filename;
timer1.enabled := true;
listbox1.Items.add(mediaplayer1.FileName);
scrollbar1.Max := mediaplayer1.TrackLength[1];
scrollbar1.Enabled := true;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
progressbar1.Max := mediaplayer1.TrackLength[1];
progressbar1.Position := mediaplayer1.Position;
scrollbar1.Max := progressbar1.Max;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
mediaplayer1.Play;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
mediaplayer1.Pause;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
mediaplayer1.Stop;
end;
procedure TForm1.ScrollBar1Change(Sender: TObject);
begin
mediaplayer1.Position := scrollbar1.Position;
mediaplayer1.Play;
end;
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
timer2.Enabled := true;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
var
a: integer;
begin
if progressbar1.Position = progressbar1.Max then begin
if listbox1.ItemIndex <> listbox1.count - 1 then begin
listbox1.Itemindex := listbox1.ItemIndex + 1;
statictext1.Caption := listbox1.Items.Strings[listbox1.itemindex];
mediaplayer1.filename := statictext1.Caption;
mediaplayer1.Open;
mediaplayer1.Play;
end
else if listbox1.ItemIndex = listbox1.Count - 1 then begin
statictext1.Caption := listbox1.Items.Strings[0];
listbox1.ItemIndex := 0;
mediaplayer1.FileName := statictext1.Caption;
mediaplayer1.Open;
mediaplayer1.Play;
end;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
statictext1.Caption := listbox1.Items.Strings[listbox1.itemindex];
mediaplayer1.FileName := statictext1.Caption;
mediaplayer1.Open;
scrollbar1.Max := mediaplayer1.TrackLength[1];
scrollbar1.Enabled := true;
end;
end.