-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmedia.pas
60 lines (43 loc) · 1.15 KB
/
media.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{
/***************************************************************************
media.pas
---------
***************************************************************************/
*****************************************************************************
This file is part of the Lazarus packages by Andreas Jakobsche
See the file COPYING.modifiedLGPL.txt, included in this distribution,
for details about the license.
*****************************************************************************
}
unit Media;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
procedure Play(FileName: string); overload;
implementation
uses FileUtil
{$ifdef Windows}, Windows
{$else}, Process
{$endif};
{$ifdef windows}
procedure Play(FileName: string);
begin
ShellExecute(0, nil, @FileName[1], nil, nil, 0)
end;
{$else}
procedure Play(FileName: string);
var
Proc: TProcess;
begin
Proc := TProcess.Create(nil);
try
Proc.Executable := FindDefaultExecutablePath('play');
Proc.Parameters.Add(FileName);
Proc.Execute;
finally
Proc.Free
end;
end;
{$endif}
end.