ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 VideoPlayer with progressbar
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

woolfik

Poland
13 Posts

Posted - Feb 16 2015 :  15:13:28  Show Profile  Reply
Hello,

I try to make videoplayer with ImageEnView component based on this example:
ImageEn -> Demos -> Display -> VideoPlayer -> VideoPlayer.dpr

My problem is that I can play/pause/stop video everything works fine but I like to have progressbar that show me how long is media file, how many percent is already played and when I click in any place of progressbar media file will be move forward or back to point that was clicked. Can some one tell me how can I do that?

I like to know how to get information about file (how long is it, how many percent was already played, wich event should I use to change position (calculated on percent) of scrollbar)?

w2m

USA
1990 Posts

Posted - Feb 16 2015 :  18:01:14  Show Profile  Reply
This will show the progress in the progress bar:
procedure Tfmain.Open1Click(Sender: TObject);
begin
  with ImageEnView1.IO.DShowParams do
  begin
    if State = gsRunning then
    begin
      Stop;
      Disconnect;
    end;
    if OpenDialog1.Execute then
    begin
      FileInput := OpenDialog1.FileName;
      EnableSampleGrabber := true;
      RenderAudio := true;
      Connect;
      Position := 0;
      Pause; // This shows first frame
      ImageEnView1.IO.DShowParams.TimeFormat := tfFrame;
      ProgressBar1.Max := ImageEnView1.IO.DShowParams.Duration;
      ProgressBar1.Position := 0;
      Percent1.Caption := IntToStr(0) + '%';
    end;
  end;
end;
procedure Tfmain.ImageEnView1DShowNewFrame(Sender: TObject);
var
  iMax: Int64;
  iFrame: Int64;
  iPosition: Int64;
  iPercent: integer;
begin
  with ImageEnView1 do
  begin
    IO.DShowParams.GetSample(IEBitmap);
    iMax := ImageEnView1.IO.DShowParams.Duration;
    iFrame := IO.DShowParams.Position;
    ProgressBar1.Position := iFrame;
    ProgressBar1.Position := iFrame-1;
    ProgressBar1.Position := iFrame;
    ProgressBar1.Update;
    Percent1.Caption := FormatFloat('###', (iFrame / iMax) * 100)  + '%';
    Percent1.Update;
    Update;
  end;
end;

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

woolfik

Poland
13 Posts

Posted - Feb 18 2015 :  15:25:33  Show Profile  Reply
Thats what I'm looking for. I'm very greatefull. Thx.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: