diff --git a/components/mplayer/examples/Simple Use/project1.ico b/components/mplayer/examples/Simple Use/project1.ico new file mode 100644 index 000000000..0341321b5 Binary files /dev/null and b/components/mplayer/examples/Simple Use/project1.ico differ diff --git a/components/mplayer/examples/Simple Use/project1.lpi b/components/mplayer/examples/Simple Use/project1.lpi new file mode 100644 index 000000000..9516893d0 --- /dev/null +++ b/components/mplayer/examples/Simple Use/project1.lpi @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/mplayer/examples/Simple Use/project1.lpr b/components/mplayer/examples/Simple Use/project1.lpr new file mode 100644 index 000000000..6bb3c2d9b --- /dev/null +++ b/components/mplayer/examples/Simple Use/project1.lpr @@ -0,0 +1,21 @@ +program project1; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms, Unit1; + +{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF} + +{$R *.res} + +begin + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. + diff --git a/components/mplayer/examples/Simple Use/project1.res b/components/mplayer/examples/Simple Use/project1.res new file mode 100644 index 000000000..7c6cf3e4b Binary files /dev/null and b/components/mplayer/examples/Simple Use/project1.res differ diff --git a/components/mplayer/examples/Simple Use/unit1.lfm b/components/mplayer/examples/Simple Use/unit1.lfm new file mode 100644 index 000000000..a803a4105 --- /dev/null +++ b/components/mplayer/examples/Simple Use/unit1.lfm @@ -0,0 +1,85 @@ +object Form1: TForm1 + Left = 290 + Height = 390 + Top = 189 + Width = 583 + ActiveControl = Panel1 + Caption = 'Form1' + ClientHeight = 390 + ClientWidth = 583 + OnCreate = FormCreate + LCLVersion = '1.2.4.0' + object MPlayerControl1: TMPlayerControl + Left = 6 + Height = 334 + Top = 27 + Width = 571 + Align = alClient + BorderSpacing.Around = 6 + Loop = 0 + Volume = 0 + end + object Panel1: TPanel + Left = 0 + Height = 21 + Top = 0 + Width = 583 + Align = alTop + AutoSize = True + ClientHeight = 21 + ClientWidth = 583 + TabOrder = 1 + object PlaySpeedButton: TSpeedButton + Left = 1 + Height = 19 + Top = 1 + Width = 26 + Align = alLeft + AutoSize = True + Caption = 'Play' + OnClick = PlaySpeedButtonClick + end + object PauseSpeedButton: TSpeedButton + Left = 27 + Height = 19 + Top = 1 + Width = 35 + Align = alLeft + AutoSize = True + Caption = 'Pause' + OnClick = PauseSpeedButtonClick + end + object StopSpeedButton: TSpeedButton + Left = 62 + Height = 19 + Top = 1 + Width = 28 + Align = alLeft + AutoSize = True + Caption = 'Stop' + OnClick = StopSpeedButtonClick + end + object OpenSpeedButton: TSpeedButton + Left = 90 + Height = 19 + Top = 1 + Width = 52 + Align = alLeft + AutoSize = True + Caption = 'Open file' + OnClick = OpenSpeedButtonClick + end + end + object StatusBar1: TStatusBar + Left = 0 + Height = 23 + Top = 367 + Width = 583 + Panels = <> + end + object OpenDialog1: TOpenDialog + Options = [ofFileMustExist, ofEnableSizing, ofViewDetail] + left = 235 + top = 127 + end +end diff --git a/components/mplayer/examples/Simple Use/unit1.pas b/components/mplayer/examples/Simple Use/unit1.pas new file mode 100644 index 000000000..81bce6059 --- /dev/null +++ b/components/mplayer/examples/Simple Use/unit1.pas @@ -0,0 +1,89 @@ +unit Unit1; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, + Buttons, ComCtrls, ExtCtrls, MPlayerCtrl; + +type + + { TForm1 } + + TForm1 = class(TForm) + MPlayerControl1: TMPlayerControl; + OpenDialog1: TOpenDialog; + Panel1: TPanel; + PlaySpeedButton: TSpeedButton; + PauseSpeedButton: TSpeedButton; + OpenSpeedButton: TSpeedButton; + StatusBar1: TStatusBar; + StopSpeedButton: TSpeedButton; + procedure FormCreate(Sender: TObject); + procedure OpenSpeedButtonClick(Sender: TObject); + procedure PauseSpeedButtonClick(Sender: TObject); + procedure PlaySpeedButtonClick(Sender: TObject); + procedure StopSpeedButtonClick(Sender: TObject); + private + public + end; + +var + Form1: TForm1; + +implementation + +{$R *.lfm} + +{ TForm1 } + +procedure TForm1.PlaySpeedButtonClick(Sender: TObject); +begin + if not FileExistsUTF8(MPlayerControl1.Filename) then begin + MessageDlg('File not found', + 'Please choose a file before playing',mtError,[mbCancel],0); + exit; + end; + MPlayerControl1.Play; +end; + +procedure TForm1.StopSpeedButtonClick(Sender: TObject); +begin + MPlayerControl1.Stop; +end; + +procedure TForm1.PauseSpeedButtonClick(Sender: TObject); +begin + MPlayerControl1.Paused:=not MPlayerControl1.Paused; +end; + +procedure TForm1.OpenSpeedButtonClick(Sender: TObject); +begin + if not OpenDialog1.Execute then exit; + MPlayerControl1.Stop; + MPlayerControl1.Filename:=OpenDialog1.FileName; + StatusBar1.SimpleText:=CleanAndExpandFilename(MPlayerControl1.Filename); + MPlayerControl1.Play; +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + if Paramcount>0 then begin + MPlayerControl1.Filename:=CleanAndExpandFilename(ParamStrUTF8(1)); + StatusBar1.SimpleText:=MPlayerControl1.Filename; + end; + {$IFDEF Linux} + MPlayerControl1.MPlayerPath:=''; + MPlayerControl1.StartParam:='-vo x11 -zoom -fs'; + {$else $IFDEF Windows} + // Download MPlayer generic for Windows and save under Programm Folder Directory + // http://sourceforge.net/projects/mplayer-win32/ + MPlayerControl1.MPlayerPath:=extractfilepath(application.exename)+'MPlayer\mplayer.exe' ; + //MPlayerControl1.StartParam:='-zoom -fs'; + {$endif} +end; + +end. +