Results 1 to 2 of 2

Thread: MediaPlayer auto-repeat mp3

  1. #1

    MediaPlayer auto-repeat mp3

    Auto-repeat music using Delphi’s TMediaPlayer

    Do you have a nice mp3 music track playing in your game designed with Pascal? Do you need the mp3 track to auto-repeat once it’s finished? The following code will do just that, just make sure AutoOpen, AutoRewind & AutoEnable is set to True in the object inspector of the Media Player:


    [pascal]
    var
    Form1: TForm1;
    Loop : boolean;

    implementation

    {$R *.dfm}

    procedure TForm1.MediaPlayer1Notify(Sender: TObject);
    begin
    if (MediaPlayer1.NotifyValue = nvSuccessful) and (Loop=true) then
    begin
    MediaPlayer1.Play;
    MediaPlayer1.Notify := true;
    end;
    end;

    procedure TForm1.PlayClick(Sender: TObject);
    begin
    Loop := true;
    MediaPlayer1.Play;
    MediaPlayer1.Notify := true;
    end;

    procedure TForm1.StopClick(Sender: TObject);
    begin
    Loop := false;
    MediaPlayer1.Stop;
    MediaPlayer1.Notify := true;
    end;
    end.
    [/pascal]

    Wake up from the dream and live your life to the full

  2. #2

    Re: MediaPlayer auto-repeat mp3

    Thanks!!
    This'll come in handy

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •