Also, is the playing and pausing with same form.Onclick done correctly?

Ok so, it keeps giving the same error at the procedure TMediaPlayer.Play;
"Expected '=' but ';' found." same with .Pause, any idea how to fix this?

type
  TForm1 = class(TForm)
    Image1: TImage;
    MP1: TMediaPlayer;
    XPManifest1: TXPManifest;
    OD1: TOpenDialog;
    Timer1: TTimer;
    Image2: TImage;
    PB1: TProgressBar;
    procedure FormCreate(Sender: TObject);
    procedure Image1Click(Sender: TObject);
    procedure Image2Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure FormClick(Sender: TObject);
    procedure TMediaPlayer.Play;
    procedure TMediaPlayer.Pause;

  private
    procedure StartPlay(Sender : TObject);
    procedure PausePlay(Sender : TObject);
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.StartPlay(Sender: TObject);
begin
MP1.Play;
end;

procedure TForm1.PausePlay(Sender: TObject);
begin
MP1.Pause;
end;

procedure TForm1.FormClick(Sender: TObject);
begin
Form1.OnClick := StartPlay;
PB1.Min := 0;
PB1.Max := MP1.Length;
Timer1.Enabled := true;
if StartPlay = true then
Form1.OnClick := PausePlay;
PB1.Min := 0;
PB1.Max := MP1.Length;
Timer1.Enabled := false;

Thanks for the help, but there is one thing left that won't work

procedure TForm1.cmbAfspeelManierenChange(Sender: TObject);
begin
if cmbAfspeelManieren.text = 'Klikken en spelen' Then
begin
Form1.Click := MP1.Play;
PB1.Min := 0;
PB1.Max := MP1.Length;
Timer1.Enabled := true;
Form1.Click := MP1.Pause;
end;
end;

Can anyone tell me what's wrong with this? Also, do I have to put the pause somewhere else?

Hello,
I have to make an MP3 player that can work on 3 different ways.

  • You click, it plays, you click again, it pauses
  • You hold down the mouse, it plays, you release the mouse, it pauses
  • A timer, you can set up a timer to pause it up to 60 seconds, with a scrollbar or something appearing to select a amount of seconds to play until it pauses.
    I figured I can do the playing options in a groupbox but I have no idea how to do any of this.
    Also, I'm not supposed to use a button to play and pause, I have to do this all by clicking the form itself. But I have no idea how to do all of this.
    Also, when the form starts it has to open a map in which you can select MP3's, but I can't get this to work either. If someone can help me, you have my eternal gratitude.