[Lazarus] Embedded VLC using PasLibVlc - how to fast forward?

Bo Berglund bo.berglund at gmail.com
Mon Mar 23 19:17:07 CET 2020


On Mon, 23 Mar 2020 08:38:37 +0100, Rolf Wetjen via lazarus
<lazarus at lists.lazarus-ide.org> wrote:

>Hi Bo,
>
>this could be a solution for windows (fullscreen):
>
>     SetWindowLongPtr(Handle,GWL_STYLE,iWindowStyle and not 
>WS_OVERLAPPEDWINDOW);
>     Left:=0;
>     Top:=0;
>     Width:=Screen.Width;
>     Height:=Screen.Height;
>
>Regards
>
>Rolf

Well, this seems to make the program window maximized and this is not
what I want.
I want the video port only to be maximized....

Meanwhile I found an example inside the PasLibVlc source package where
there is a function that seems to do what I wanted so I tried to put
it into my code.
However, it does not show any video on the resulting form, it is all
black...
And it does not return to the application's previous form either when
I hit a keyboard key. The application's main window in this case is
all black, only the title bar is not black....

Here is the code of the button event that is supposed to maximize my
window (copied from the example and adjusted for proper player name):


procedure TfrmMain.SpeedButton1Click(Sender: TObject);
var
//Defined in unit FullScreenFormUnit from the example:
  aFullScreenForm : TFullScreenForm; 
  oldL, oldT, oldW, oldH : Integer;
  oldA : TAlign;
begin
  MessageDlg('Press any key, to leave full screen mode',
mtInformation, [mbOK], 0);

  oldL := vlcPlayer.Left;
  oldT := vlcPlayer.Top;
  oldW := vlcPlayer.Width;
  oldH := vlcPlayer.Height;
  oldA := vlcPlayer.Align;

  if (oldA <> alNone) then vlcPlayer.Align := alNone;

  aFullScreenForm := TFullScreenForm.Create(SELF);
  aFullScreenForm.SetBounds(Monitor.Left, Monitor.Top, Monitor.Width,
Monitor.Height);

  // PasLibVlcPlayer1.ParentWindow := aFullScreenForm.Handle;
  {$IFDEF FPC}
    LCLIntf.SetParent(vlcPlayer.Handle, aFullScreenForm.Handle);
  {$ELSE}
    {$IFDEF MSWINDOWS}
      Windows.SetParent(vlcPlayer.Handle, aFullScreenForm.Handle);
    {$ENDIF}
  {$ENDIF}
  vlcPlayer.SetBounds(0, 0, Monitor.Width, Monitor.Height);

  aFullScreenForm.ShowModal;

  vlcPlayer.SetBounds(oldL, oldT, oldW, oldH);
  {$IFDEF FPC}
    LCLIntf.SetParent(vlcPlayer.Handle, SELF.Handle);
  {$ELSE}
    {$IFDEF MSWINDOWS}
      Windows.SetParent(vlcPlayer.Handle, SELF.Handle);
    {$ENDIF}
  {$ENDIF}

  aFullScreenForm.Free;

  if (oldA <> alNone) then vlcPlayer.Align := oldA;
end;



-- 
Bo Berglund
Developer in Sweden



More information about the lazarus mailing list