-
Notifications
You must be signed in to change notification settings - Fork 38
/
index.d.ts
152 lines (118 loc) · 3.11 KB
/
index.d.ts
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
export type Screen = {
id: number;
name: string;
};
export type AudioDevice = {
id: string;
name: string;
};
export type VideoCodec = 'h264' | 'hevc' | 'proRes422' | 'proRes4444';
export type RecordingOptions = {
/**
Number of frames per seconds.
*/
readonly fps?: number;
/**
Record only an area of the screen.
*/
readonly cropArea?: {
x: number;
y: number;
width: number;
height: number;
};
/**
Show the cursor in the screen recording.
*/
readonly showCursor?: boolean;
/**
Highlight cursor clicks in the screen recording.
Enabling this will also enable the `showCursor` option.
*/
readonly highlightClicks?: boolean;
/**
Screen to record.
Defaults to primary screen.
*/
readonly screenId?: number;
/**
Audio device to include in the screen recording.
Should be one of the `id`'s from `audioDevices()`.
*/
readonly audioDeviceId?: string;
/**
Video codec to use.
A computer with Intel 6th generation processor or newer is strongly recommended for the `hevc` codec, as otherwise it will use software encoding, which only produces 3 FPS fullscreen recording.
The `proRes422` and `proRes4444` codecs are uncompressed data. They will create huge files.
*/
readonly videoCodec?: VideoCodec;
};
export type Recorder = {
/**
Returns a `Promise` that fullfills when the recording starts or rejects if the recording didn't start after 5 seconds.
*/
startRecording: (options?: RecordingOptions) => Promise<void>;
/**
`Promise` that fullfills with the path to the screen recording file when it's ready. This will never reject.
Only available while a recording is happening, `undefined` otherwise.
Usually, this resolves around 1 second before the recording starts, but that's not guaranteed.
*/
isFileReady: Promise<string> | undefined;
/**
Pauses the recording. To resume, call `recorder.resume()`.
Returns a `Promise` that fullfills when the recording has been paused.
*/
pause: () => Promise<void>;
/**
Resumes the recording if it's been paused.
Returns a `Promise` that fullfills when the recording has been resumed.
*/
resume: () => Promise<void>;
/**
Returns a `Promise` that resolves with a boolean indicating whether or not the recording is currently paused.
*/
isPaused: () => Promise<boolean>;
/**
Returns a `Promise` for the path to the screen recording file.
*/
stopRecording: () => Promise<string>;
};
/**
Get a list of available video codecs.
The key is the `videoCodec` option name and the value is the codec name.
It only returns `hevc` if your computer supports HEVC hardware encoding.
@example
```
Map {
'h264' => 'H264',
'hevc' => 'HEVC',
'proRes422' => 'Apple ProRes 422',
'proRes4444' => 'Apple ProRes 4444'
}
```
*/
export function videoCodecs(): Map<VideoCodec, string>;
/**
Get a list of screens.
The first screen is the primary screen.
@example
```
[{
id: 69732482,
name: 'Color LCD'
}]
```
*/
export function screens(): Promise<Screen[]>;
/**
Get a list of audio devices.
@example
```
[{
id: 'AppleHDAEngineInput:1B,0,1,0:1',
name: 'Built-in Microphone'
}]
```
*/
export function audioDevices(): Promise<AudioDevice[]>;
export const recorder: Recorder;