@0biwank/screen-capture 1.0.1 → 2.0.2
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/LICENSE +339 -21
- package/LICENSES/CPP-HTTPLIB-MIT.txt +21 -0
- package/LICENSES/FFMPEG-GPLv2.txt +340 -0
- package/LICENSES/PROJECT-MIT.txt +21 -0
- package/LICENSES/X264-COPYING.txt +341 -0
- package/README.md +53 -64
- package/SOURCE.md +35 -0
- package/THIRD_PARTY_NOTICES.md +28 -0
- package/index.d.ts +99 -0
- package/index.js +105 -14
- package/package.json +26 -17
- package/prebuilds/SHA256SUMS +2 -0
- package/prebuilds/darwin-arm64/native_capture.node +0 -0
- package/prebuilds/darwin-x64/native_capture.node +0 -0
- package/build/Release/media_processor.node +0 -0
package/index.js
CHANGED
|
@@ -1,16 +1,107 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
if (process.platform !== 'darwin') {
|
|
7
|
+
throw new Error(`@0biwank/screen-capture supports macOS only; received ${process.platform}`);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (!['arm64', 'x64'].includes(process.arch)) {
|
|
11
|
+
throw new Error(`@0biwank/screen-capture does not support macOS architecture ${process.arch}`);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const prebuiltPath = path.join(
|
|
15
|
+
__dirname,
|
|
16
|
+
'prebuilds',
|
|
17
|
+
`darwin-${process.arch}`,
|
|
18
|
+
'native_capture.node',
|
|
19
|
+
);
|
|
20
|
+
const developmentPath = path.join(__dirname, 'build', 'Release', 'native_capture.node');
|
|
21
|
+
const addonPath = fs.existsSync(prebuiltPath) ? prebuiltPath : developmentPath;
|
|
22
|
+
|
|
23
|
+
if (!fs.existsSync(addonPath)) {
|
|
24
|
+
throw new Error(
|
|
25
|
+
`Missing @0biwank/screen-capture native binary for darwin-${process.arch}. ` +
|
|
26
|
+
`Expected ${prebuiltPath}`,
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const addon = require(addonPath);
|
|
2
31
|
|
|
3
32
|
module.exports = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
33
|
+
/**
|
|
34
|
+
* Start capturing.
|
|
35
|
+
*
|
|
36
|
+
* @param {object} [options]
|
|
37
|
+
* @param {number} [options.displayId=0] CGDirectDisplayID; 0 = primary
|
|
38
|
+
* @param {number} [options.width=1920]
|
|
39
|
+
* @param {number} [options.height=1080]
|
|
40
|
+
* @param {number} [options.fps=30]
|
|
41
|
+
* @param {number} [options.videoBitrate=9000000] bps
|
|
42
|
+
* @param {number} [options.cropX=0]
|
|
43
|
+
* @param {number} [options.cropY=0]
|
|
44
|
+
* @param {number} [options.cropWidth=0]
|
|
45
|
+
* @param {number} [options.cropHeight=0]
|
|
46
|
+
* @param {boolean} [options.systemAudio=true]
|
|
47
|
+
* @param {boolean} [options.microphone=false]
|
|
48
|
+
* @param {string} [options.micDeviceUid=''] empty = default input device
|
|
49
|
+
* @param {number} [options.sampleRate=48000]
|
|
50
|
+
* @param {number} [options.audioBitrate=128000] bps
|
|
51
|
+
* @param {string} [options.outputDir]
|
|
52
|
+
* @param {string} [options.recordingId]
|
|
53
|
+
* @param {number} [options.segmentTime=4]
|
|
54
|
+
* @returns {boolean}
|
|
55
|
+
*/
|
|
56
|
+
startCapture: addon.startCapture.bind(addon),
|
|
57
|
+
|
|
58
|
+
setSegmentReadyCallback: addon.setSegmentReadyCallback.bind(addon),
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Stop capturing and flush remaining data.
|
|
62
|
+
* @returns {boolean}
|
|
63
|
+
*/
|
|
64
|
+
stopCapture: addon.stopCapture.bind(addon),
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Last native capture startup/runtime error.
|
|
68
|
+
* @returns {string}
|
|
69
|
+
*/
|
|
70
|
+
getLastError: addon.getLastError.bind(addon),
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* List available displays.
|
|
74
|
+
* @returns {Array<{id: number, name: string, isMain: boolean, width: number, height: number}>}
|
|
75
|
+
*/
|
|
76
|
+
listDisplaySources: addon.listDisplaySources.bind(addon),
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* List available windows.
|
|
80
|
+
* @returns {Array<{id: number, name: string}>}
|
|
81
|
+
*/
|
|
82
|
+
listWindowSources: addon.listWindowSources.bind(addon),
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* List native CoreAudio input devices.
|
|
86
|
+
* @returns {Array<{ uid: string, name: string, manufacturer: string }>}
|
|
87
|
+
*/
|
|
88
|
+
listAudioInputDevices: addon.listAudioInputDevices.bind(addon),
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* List native camera devices.
|
|
92
|
+
* @returns {Array<{ uid: string, name: string }>}
|
|
93
|
+
*/
|
|
94
|
+
listVideoInputDevices: addon.listVideoInputDevices.bind(addon),
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Resume capturing.
|
|
98
|
+
* @returns {boolean}
|
|
99
|
+
*/
|
|
100
|
+
resumeCapture: addon.resumeCapture.bind(addon),
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Pause capturing.
|
|
104
|
+
* @returns {boolean}
|
|
105
|
+
*/
|
|
106
|
+
pauseCapture: addon.pauseCapture.bind(addon),
|
|
107
|
+
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0biwank/screen-capture",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Native screen capture
|
|
3
|
+
"version": "2.0.2",
|
|
4
|
+
"description": "Native screen + audio capture for macOS with file-backed HLS output.",
|
|
5
5
|
"main": "index.js",
|
|
6
|
-
"gypfile":
|
|
6
|
+
"gypfile": false,
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "node
|
|
8
|
+
"build": "node scripts/build.mjs",
|
|
9
|
+
"build:vendor": "node scripts/build-ffmpeg-vendor.mjs",
|
|
10
|
+
"build:addon": "node-gyp configure build",
|
|
9
11
|
"rebuild": "node-gyp rebuild",
|
|
12
|
+
"stage:prebuild": "node scripts/stage-prebuild.mjs",
|
|
13
|
+
"verify:runtime": "node scripts/verify-runtime.cjs",
|
|
14
|
+
"verify:package": "node scripts/verify-package.mjs",
|
|
15
|
+
"verify:packlist": "node scripts/verify-packlist.mjs",
|
|
10
16
|
"test": "node test.js"
|
|
11
17
|
},
|
|
12
18
|
"keywords": [
|
|
@@ -14,35 +20,38 @@
|
|
|
14
20
|
"desktop-capture",
|
|
15
21
|
"native-addon",
|
|
16
22
|
"napi",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
23
|
+
"macos",
|
|
24
|
+
"mpegts"
|
|
19
25
|
],
|
|
20
26
|
"author": "Kunal Dubey",
|
|
21
|
-
"license": "
|
|
27
|
+
"license": "GPL-2.0-or-later",
|
|
22
28
|
"repository": {
|
|
23
29
|
"type": "git",
|
|
24
|
-
"url": "https://github.com/xakep8/screenCaptureNAPI"
|
|
30
|
+
"url": "git+https://github.com/xakep8/screenCaptureNAPI.git"
|
|
25
31
|
},
|
|
26
32
|
"homepage": "https://github.com/xakep8/screenCaptureNAPI#readme",
|
|
27
33
|
"bugs": {
|
|
28
34
|
"url": "https://github.com/xakep8/screenCaptureNAPI/issues"
|
|
29
35
|
},
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
33
39
|
"files": [
|
|
34
40
|
"index.js",
|
|
35
|
-
"
|
|
41
|
+
"index.d.ts",
|
|
42
|
+
"prebuilds/**/*.node",
|
|
43
|
+
"prebuilds/SHA256SUMS",
|
|
36
44
|
"README.md",
|
|
37
|
-
"
|
|
45
|
+
"SOURCE.md",
|
|
46
|
+
"THIRD_PARTY_NOTICES.md",
|
|
47
|
+
"LICENSE",
|
|
48
|
+
"LICENSES/**/*"
|
|
38
49
|
],
|
|
39
|
-
"dependencies": {
|
|
40
|
-
"node-addon-api": "^8.5.0"
|
|
41
|
-
},
|
|
42
50
|
"devDependencies": {
|
|
51
|
+
"node-addon-api": "^8.5.0",
|
|
43
52
|
"node-gyp": "^11.4.2"
|
|
44
53
|
},
|
|
45
54
|
"engines": {
|
|
46
|
-
"node": ">=
|
|
55
|
+
"node": ">=18.0.0"
|
|
47
56
|
}
|
|
48
57
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|