Multimedia

Multimedia

Looping AVIs
Determining CD track with TMediaPlayer


Looping AVIs

Question


I have an AVI which I want to loop continuously on my form. I though of a

FOR, or WHILE or REPEAT structure, but nothing worked because of the length

of the AVI.

Nevertheless, I found a solution using the TTimer and giving it as interval

the duration of the AVI. Is there any more convenient way to do this?

Answer


A:

Use the mediaplayer's OnNotify event so it will let you know when it's finished:





procedure TForm1.BitBtn1Click(Sender: TObject);

begin

With MediaPlayer1 do

  Begin

    Open;

    Notify := True;

    Play;

  End;

end;





procedure TForm1.MediaPlayer1Notify(Sender: TObject);

begin

  With MediaPlayer1 do

    If NotifyValue = nvSuccessful

      Then

        Begin

          Notify := True;

          Play;

        End;

end;


Determining CD track with TMediaPlayer

Question


How to determine CD track with TMediaPlayer?

Answer


{

  Create a timer and put this code in the OnTimer event:

}



var Trk, Min, Sec: Word;

begin

   with MediaPlayer1 do

   begin

      Trk:= MCI_TMSF_TRACK(Position);

      Min:=MCI_TMSF_MINUTE(Position);

      Sec:=MCI_TMSF_SECOND(Position);

      Label1.Caption:=Format('%.2d',[Trk]);

      Label2.Caption:=Format('%.2d:%.2d',[Min,Sec]);

   end;

end;



{

Add MMSystem to the uses clause in Unit1

This will show current track and time.

}




Close    To Top
  • Prev Article-Programming:
  • Next Article-Programming:
  • Now: Tutorial for Web and Software Design > Programming > delphi > Programming Content
    Photoshop Tutorial
     

    Special Effect

      3D Effect
      Photoshop Articles
    Programming Tutorial
     

    C/C++ Tutorial

      Visual Basic
      C# Tutorial
    Database Tutorial
     

    MySQL Tutorial

      MS SQL Tutorial
      Oracle Tutorial
    Geek Tutorial
     

    Blogging Tutorial

      RSS Tutorial
      Podcasting Tutorial
    Graphic Design Tutorial
      Coreldraw Tutorial
      Illustrator Tutorial
      3D Tutorials
    Webmaster Articles
     

    Domain Service

      Web Hosting
      Site Promotion
    Java Tutorial/ Articles
     

    Java Servlets

      JavaEE Tutorial
     

    JavaBeans Tutorial

    XML Tutorial/ Articles
     

    XML Style

      AJAX Tutorial
      XML Mobile
    Flash Tutorial/ Articles
     

    Flash Video

      Action Script
      Flash Articles
    OS Tutorial/ Articles
      Linux Tutorial
      Symbian Tutorial
      MacOS Tutorial
    Personal Tech
      Hardware Tutorial
      Software Tutorial
      Online Auction