Recent

Author Topic: how to get current position with tmplayercontrol?  (Read 6775 times)

mgayo

  • New Member
  • *
  • Posts: 17
how to get current position with tmplayercontrol?
« on: February 20, 2021, 02:01:43 am »
I'm trying to use the tmplayercontrol component to create a player in Lazarus but can't get the current playback position.
In theory the onplaying event passes the apoisition parameter but this value is always 0.
How can I get that value?
Thanks

Pe3s

  • Hero Member
  • *****
  • Posts: 533
Re: how to get current position with tmplayercontrol?
« Reply #1 on: January 01, 2022, 10:09:34 am »
I also wonder how to do it, there is no answer anywhere. So I changed the component to PasLibVlc, because the MPlayer component seems to be useless. Basic functions also do not work in the developer demo program

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: how to get current position with tmplayercontrol?
« Reply #2 on: January 02, 2022, 02:12:47 am »
hello,
try to use the zbyna's version of tmplayercontrol.
works for me on windows 10 lazarus 2.0.12 64 bits (see attachment full featured example).
Friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Pe3s

  • Hero Member
  • *****
  • Posts: 533
Re: how to get current position with tmplayercontrol?
« Reply #3 on: January 02, 2022, 10:04:24 am »
@Jurrasic Pork Thank you, I will check

Pe3s

  • Hero Member
  • *****
  • Posts: 533
Re: how to get current position with tmplayercontrol?
« Reply #4 on: January 04, 2022, 11:48:57 am »
I have two questions.
1. How can I change TMplayer window color to black?
2. How can I refer to the internal timer of Mplayer FTimer?

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: how to get current position with tmplayercontrol?
« Reply #5 on: January 05, 2022, 07:10:18 am »
Hello,
I have two questions.
1. How can I change TMplayer window color to black?
2. How can I refer to the internal timer of Mplayer FTimer?
You must change the code of the component TMPlayerControl.
Example to change the color of the control :
In the file mplayerctrl.pas, modify the TCustomMPlayerControl.EraseBackground procedure :
Code: Pascal  [Select][+][-]
  1. procedure TCustomMPlayerControl.EraseBackground(DC: HDC);
  2. begin
  3.   if (FCanvas <> nil) then
  4.     with FCanvas do
  5.     begin
  6.       if DC <> 0 then
  7.         Handle := DC;
  8.       // Brush.Color := clLtGray;
  9.         Brush.Color := clBlack;
  10.       Rectangle(0, 0, Self.Width, Self.Height);
  11.       if DC <> 0 then
  12.         Handle := 0;
  13.     end;
  14. end;
Example to access to the internal timer :
In the file mplayerctrl.pas, create a new property InternalTimer in the TCustomMPlayerControl class :
Code: Pascal  [Select][+][-]
  1. property InternalTimer: TTimer read FTimer;  
and now you can access to the internal Timer. Example to change the interval value of the Internal Timer :
Code: Pascal  [Select][+][-]
  1. MPlayerControl1.InternalTimer.Interval := 300;  

Friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Pe3s

  • Hero Member
  • *****
  • Posts: 533
Re: how to get current position with tmplayercontrol?
« Reply #6 on: January 05, 2022, 06:16:39 pm »
@Jurassic Pork Thank you  :)

Pe3s

  • Hero Member
  • *****
  • Posts: 533
Re: how to get current position with tmplayercontrol?
« Reply #7 on: January 09, 2022, 11:34:15 am »
How can you get rid of lag when rewinding the video

Pe3s

  • Hero Member
  • *****
  • Posts: 533
Re: how to get current position with tmplayercontrol?
« Reply #8 on: January 13, 2022, 09:34:59 pm »
@Jurassic Pork Can you disable FTimer to use the TTimer component?

 

TinyPortal © 2005-2018