@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/index.js CHANGED
@@ -1,16 +1,107 @@
1
- const processor = require('./build/Release/media_processor');
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
- /** @returns {boolean} */
5
- processMediaStream: processor.processMediaStream,
6
- /** @returns {boolean} */
7
- startCapture: processor.startCapture,
8
- /** @returns {boolean} */
9
- stopCapture: processor.stopCapture,
10
- /** @returns {boolean} */
11
- selectSource: processor.selectSource,
12
- /** @returns {Array} */
13
- listWindowSources: processor.listWindowSources,
14
- /** @returns {Array} */
15
- listDisplaySources: processor.listDisplaySources
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": "1.0.1",
4
- "description": "Native screen capture addon for Node.js with HLS muxing support",
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": true,
6
+ "gypfile": false,
7
7
  "scripts": {
8
- "build": "node-gyp configure build",
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
- "video-encoding",
18
- "hls"
23
+ "macos",
24
+ "mpegts"
19
25
  ],
20
26
  "author": "Kunal Dubey",
21
- "license": "MIT",
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
- "os": [
31
- "darwin"
32
- ],
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
33
39
  "files": [
34
40
  "index.js",
35
- "build/Release/*.node",
41
+ "index.d.ts",
42
+ "prebuilds/**/*.node",
43
+ "prebuilds/SHA256SUMS",
36
44
  "README.md",
37
- "LICENSE"
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": ">=14.0.0"
55
+ "node": ">=18.0.0"
47
56
  }
48
57
  }
@@ -0,0 +1,2 @@
1
+ 58b47e3851865c139191fcbe940b2cad6247511b99094874971ba238e63c4aa3 darwin-arm64/native_capture.node
2
+ c5f205c3297f81269d74f2d6a6bd97bbd7f96a7c47c130b19c2f5395ccec2fb7 darwin-x64/native_capture.node
Binary file