[Lazarus] TMPlayerControl

Andrew Haines andrewd207 at aol.com
Sun Jan 11 04:44:09 CET 2015


On 01/06/2015 08:35 AM, Michael Thompson wrote:
> On 6 January 2015 at 17:48, Philippe <philippe at quarta.com.br 
> <mailto:philippe at quarta.com.br>> wrote:
>
> > "fs" does not appear in http://wiki.freepascal.org/TMPlayerControl
>
> Correct.  -fs is an input parameter to mplayer.  These aren't 
> explicitly covered in the wiki as mplayer documentation covers them 
> elsewhere.
>
> > And my "question" is still about TMPlayerControl, not with MPlayer ...
>
> Well, TMPlayerControl is only a thin wrapper over mplayer, so there's 
> significant overlap.
>
> However, to be clear TMPlayerControl does not support fullscreen.  
> I've now confirmed your results, and simply adding -fs to StartParam 
> is not sufficient.
>
> If you're interested, it looks like the issue is down to the -wid 
> parameter (which sets the display window handle).  If I comment out 
> the two -wid lines in MPlayerCtrl.pas (line 665, 666), and insert -fs 
> instead, then fullscreen works.
>
> No easy workaround available I'm afraid.  Looks like a code change in 
> MPlayerCtrl is required implementing a .FullScreen property.   
> However, I still can't see how we'd toggle fullscreen, I can only see 
> how to either start in FullScreen or in a Window.   And that caveat 
> from the mplayer documentation would still hold - not all drivers are 
> supported.
>
> Patches welcome :-)
>


I played with this for a few minutes and came up with this:
MPlayerControl1.OnPlaying has to be assigned for 
MPlayerControl1.Position to work.

procedure TForm1.FullScreenCheckBoxChange(Sender: TObject);
var
   ScreenBounds: types.TRect;
   PlayerPosition: Single;
begin
   PlayerPosition := MPlayerControl1.Position;
   MPlayerControl1.Stop;

   if FullScreenCheckBox.Checked then
   begin
     FSForm := TForm.Create(Self); //FSForm is a variable in TForm1
     FSForm.BorderStyle:=bsNone;
     FSForm.Color:=clBlack;
     ScreenBounds := Screen.MonitorFromWindow(Handle).BoundsRect;
     with ScreenBounds do
       FSForm.SetBounds(Left, Top, Right - Left, Bottom - Top);
     FSForm.Visible:=True;

     MPlayerControl1.Parent := FSForm;
   end
   else
   begin
     MPlayerControl1.Parent := Self;
     FSForm.Free;
   end;

   MPlayerControl1.Play;
   MPlayerControl1.Position := PlayerPosition;
end;

Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20150110/2ab6b5c3/attachment-0003.html>


More information about the Lazarus mailing list