@overwolf/ow-electron-packages-types 0.1.0-beta.2 → 0.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/recorder/recorder.md +48 -49
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@ The ow-electron recorder uses OBS behind the scenes and exposes OBS functions to
|
|
|
13
13
|
|
|
14
14
|
### Capture Audio / Video
|
|
15
15
|
|
|
16
|
-
- Capture video from a specific display device or
|
|
16
|
+
- Capture video from a specific display device or capture from a running game.
|
|
17
17
|
- Capture any audio input or output device, such as speakers, a microphone, or the game sound alone.
|
|
18
18
|
- Split capture into separate video files on-demand or using a timer.
|
|
19
19
|
- Multiple audio and video encoders supported.
|
|
@@ -51,9 +51,9 @@ Make sure that the following node_modules are installed:
|
|
|
51
51
|
npm install @overwolf/ow-electron @overwolf/ow-electron-builder @overwolf/ow-electron-packages-types
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
> Currently recording api is beta
|
|
54
|
+
> Currently, the recording api is in beta. To install the beta version use:
|
|
55
55
|
> `npm install @overwolf/ow-electron-packages-types@beta`
|
|
56
|
-
> Alternatively amend package.json and use `npm install` to update dependencies:
|
|
56
|
+
> Alternatively amend the beta package to your package.json and use `npm install` to update dependencies:
|
|
57
57
|
|
|
58
58
|
```json
|
|
59
59
|
...
|
|
@@ -81,18 +81,16 @@ To activate the recording package, place the "recorder" string under \`overwolf
|
|
|
81
81
|
|
|
82
82
|
#### Import
|
|
83
83
|
|
|
84
|
-
Import the app from 'electron' & overwolf from \`@overwolf/ow-electron\`. Register to the ready state, and once the ready event is fired, verify that the package name is \recorder\.
|
|
85
|
-
|
|
86
84
|
```javascript
|
|
87
85
|
import { app as electronApp } from 'electron';
|
|
88
86
|
import { overwolf } from '@overwolf/ow-electron';
|
|
89
87
|
```
|
|
90
88
|
|
|
91
|
-
|
|
89
|
+
Import the app from 'electron' & overwolf from \`@overwolf/ow-electron\`.
|
|
92
90
|
|
|
93
|
-
Register
|
|
91
|
+
#### Register
|
|
94
92
|
|
|
95
|
-
```
|
|
93
|
+
```javascript
|
|
96
94
|
const owElectronApp = electronApp as overwolf.OverwolfApp;
|
|
97
95
|
owElectronPackages.on('ready', (e, packageName) => {
|
|
98
96
|
if (packageName === 'recorder') {
|
|
@@ -101,7 +99,7 @@ owElectronPackages.on('ready', (e, packageName) => {
|
|
|
101
99
|
});
|
|
102
100
|
```
|
|
103
101
|
|
|
104
|
-
|
|
102
|
+
Register to the ready state, and once the ready event is fired, verify that the package name is \recorder\.
|
|
105
103
|
|
|
106
104
|
```javascript
|
|
107
105
|
recorderApi.on('recording-started', (RecordEventArgs) => {
|
|
@@ -109,12 +107,9 @@ recorderApi.on('recording-started', (RecordEventArgs) => {
|
|
|
109
107
|
});
|
|
110
108
|
```
|
|
111
109
|
|
|
112
|
-
|
|
110
|
+
Use event listeners to get notified by events. For more examples see: [Recording events](api-specification.md#events):
|
|
113
111
|
|
|
114
|
-
|
|
115
|
-
- Display devices
|
|
116
|
-
- Audio Devices
|
|
117
|
-
- Supported codecs etc
|
|
112
|
+
#### Query information
|
|
118
113
|
|
|
119
114
|
```javascript
|
|
120
115
|
// obtain OBS Information
|
|
@@ -142,14 +137,12 @@ console.log(obsInfo.video.encoders);
|
|
|
142
137
|
console.log(obsInfo.audio.encoders);
|
|
143
138
|
```
|
|
144
139
|
|
|
145
|
-
|
|
140
|
+
- Use the query information method to obtain information about the running machine:
|
|
141
|
+
- Display devices
|
|
142
|
+
- Audio Devices
|
|
143
|
+
- Supported codecs etc
|
|
146
144
|
|
|
147
|
-
|
|
148
|
-
2. add capture source
|
|
149
|
-
3. Use the capture settings options object to create the settings builder.
|
|
150
|
-
4. Build the capture settings using the `build()` method
|
|
151
|
-
5. Set the recording options
|
|
152
|
-
6. Start recording
|
|
145
|
+
#### Start Recording - Simple
|
|
153
146
|
|
|
154
147
|
```javascript
|
|
155
148
|
async function startRecording(gameInfo: GameInfo = null) {
|
|
@@ -161,22 +154,22 @@ async function startRecording(gameInfo: GameInfo = null) {
|
|
|
161
154
|
});
|
|
162
155
|
|
|
163
156
|
/* changing default video settings
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
157
|
+
settingsBuilder.videoSettings.fps = 60;
|
|
158
|
+
settingsBuilder.videoSettings.baseWidth = 1920;
|
|
159
|
+
settingsBuilder.videoSettings.baseHeight = 1080;
|
|
167
160
|
*/
|
|
168
161
|
|
|
169
162
|
// 2. do we want to capture game or display?
|
|
170
163
|
if (gameInfo) {
|
|
171
164
|
// game capture
|
|
172
|
-
|
|
165
|
+
settingsBuilder.addGameSource({
|
|
173
166
|
gameProcess: gameInfo.processInfo.pid, // or just 'Game.exe' name
|
|
174
167
|
captureOverlays: true, // capture overlay windows
|
|
175
168
|
});
|
|
176
169
|
} else {
|
|
177
170
|
// desktop capture
|
|
178
171
|
// |monitorId| from '''queryInformation()'''
|
|
179
|
-
|
|
172
|
+
settingsBuilder.addScreenSource({ monitorId });
|
|
180
173
|
}
|
|
181
174
|
|
|
182
175
|
// 3. Build the capture settings using the `build()` **method**
|
|
@@ -195,7 +188,7 @@ async function startRecording(gameInfo: GameInfo = null) {
|
|
|
195
188
|
};
|
|
196
189
|
|
|
197
190
|
// 5. Start recording
|
|
198
|
-
await recorderApi
|
|
191
|
+
await recorderApi.startRecording(
|
|
199
192
|
recordingOptions,
|
|
200
193
|
captureSettings,
|
|
201
194
|
(stopResult) => {
|
|
@@ -211,21 +204,25 @@ async function startRecording(gameInfo: GameInfo = null) {
|
|
|
211
204
|
}
|
|
212
205
|
```
|
|
213
206
|
|
|
214
|
-
|
|
207
|
+
1. Create the capture settings options object.
|
|
208
|
+
2. add capture source
|
|
209
|
+
3. Use the capture settings options object to create the settings builder.
|
|
210
|
+
4. Build the capture settings using the `build()` method
|
|
211
|
+
5. Set the recording options
|
|
212
|
+
6. Start recording
|
|
215
213
|
|
|
216
|
-
|
|
217
|
-
2. Once we know the recording is active, We can call the `stopRecording()` method, include the optional callback to obtain details about the stopped capture.
|
|
214
|
+
#### Stop Recording
|
|
218
215
|
|
|
219
216
|
```javascript
|
|
220
217
|
async function stopRecording() {
|
|
221
218
|
try {
|
|
222
|
-
const active = await recorderApi
|
|
219
|
+
const active = await recorderApi.isActive();
|
|
223
220
|
if (!active) {
|
|
224
221
|
return;
|
|
225
222
|
}
|
|
226
223
|
|
|
227
224
|
// stop recording
|
|
228
|
-
await
|
|
225
|
+
await recorderApi.stopRecording((recordStopEventArgs) => {
|
|
229
226
|
console.log(recordStopEventArgs.duration);
|
|
230
227
|
});
|
|
231
228
|
} catch (err) {
|
|
@@ -234,6 +231,9 @@ async function stopRecording() {
|
|
|
234
231
|
}
|
|
235
232
|
```
|
|
236
233
|
|
|
234
|
+
1. Before attempting to stop the capture directly, we can use the `isActive()` method to check if the capture is active.
|
|
235
|
+
2. Once we know the recording is active, We can call the `stopRecording()` method, include the optional callback to obtain details about the stopped capture.
|
|
236
|
+
|
|
237
237
|
#### Change Capture Sources
|
|
238
238
|
|
|
239
239
|
- Once we have the settingsBuilder object we can use it to select specific capture sources:
|
|
@@ -283,7 +283,7 @@ settingsBuilder.addAudioDefaultCapture('output');
|
|
|
283
283
|
// settingsBuilder.addAudioDefaultCapture('input')
|
|
284
284
|
|
|
285
285
|
// Alternatively set other device ( Obtain devices from queryInformation() method)
|
|
286
|
-
//
|
|
286
|
+
// settingsBuilder.addAudioCapture({id: the_device_id, name: "my device"})
|
|
287
287
|
|
|
288
288
|
// Build the capture settings using the `build()` **method**
|
|
289
289
|
const captureSettings = settingsBuilder.build();
|
|
@@ -293,12 +293,6 @@ const captureSettings = settingsBuilder.build();
|
|
|
293
293
|
|
|
294
294
|
##### Start Replay
|
|
295
295
|
|
|
296
|
-
1. Create the capture settings options object.
|
|
297
|
-
2. Use the capture settings options object to create the settings builder.
|
|
298
|
-
3. Build the capture settings using the build() method
|
|
299
|
-
4. Set the replays options
|
|
300
|
-
5. Start Replays
|
|
301
|
-
|
|
302
296
|
```javascript
|
|
303
297
|
async function startReplays() {}
|
|
304
298
|
try {
|
|
@@ -307,9 +301,8 @@ async function startReplays() {}
|
|
|
307
301
|
includeDefaultAudioSources: true,
|
|
308
302
|
}
|
|
309
303
|
// Build the capture settings using the build() method
|
|
310
|
-
const settings =
|
|
311
|
-
captureSettingsOptions
|
|
312
|
-
);
|
|
304
|
+
const settings =
|
|
305
|
+
await recorderApi.createSettingsBuilder(captureSettingsOptions);
|
|
313
306
|
|
|
314
307
|
// set key frame every 1 second for more accurate stop timestamp;
|
|
315
308
|
// note: this require more resource from the recording engine
|
|
@@ -337,12 +330,13 @@ async function startReplays() {}
|
|
|
337
330
|
}
|
|
338
331
|
```
|
|
339
332
|
|
|
340
|
-
|
|
333
|
+
1. Create the capture settings options object.
|
|
334
|
+
2. Use the capture settings options object to create the settings builder.
|
|
335
|
+
3. Build the capture settings using the build() method
|
|
336
|
+
4. Set the replays options
|
|
337
|
+
5. Start Replays
|
|
341
338
|
|
|
342
|
-
|
|
343
|
-
2. Use the replay capture options to start the capture replay.
|
|
344
|
-
3. The captureReplay method returns the activeReplay, we can use it to control the capturing replay.
|
|
345
|
-
4. Once the captureReplay callback is returned we set the activeReplay as undefined to indicate that the replay capture is done.
|
|
339
|
+
##### Start Capturing Replays
|
|
346
340
|
|
|
347
341
|
```javascript
|
|
348
342
|
async function startCaptureReplay() {
|
|
@@ -373,9 +367,12 @@ async function startCaptureReplay() {
|
|
|
373
367
|
}
|
|
374
368
|
```
|
|
375
369
|
|
|
376
|
-
|
|
370
|
+
1. Create the replay Capture Options object.
|
|
371
|
+
2. Use the replay capture options to start the capture replay.
|
|
372
|
+
3. The captureReplay method returns the activeReplay, we can use it to control the capturing replay.
|
|
373
|
+
4. Once the captureReplay callback is returned we set the activeReplay as undefined to indicate that the replay capture is done.
|
|
377
374
|
|
|
378
|
-
|
|
375
|
+
##### Extend Capture Replay
|
|
379
376
|
|
|
380
377
|
```javascript
|
|
381
378
|
// Check activeReplay is not undefined, which means the capture replay is currently recording.
|
|
@@ -390,6 +387,8 @@ console.log(activeReplay.timeout);
|
|
|
390
387
|
activeReplay.stopAfter(10000);
|
|
391
388
|
```
|
|
392
389
|
|
|
390
|
+
- While the capture replay is running we can extend it's timeout by using the activeReplay object
|
|
391
|
+
|
|
393
392
|
##### Stopping Capture Replay
|
|
394
393
|
|
|
395
394
|
```javascript
|
package/package.json
CHANGED