@capturebridge/sdk 0.38.1 → 0.39.0
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/README.md +2 -2
- package/Version.js +1 -1
- package/Webcam.js +45 -0
- package/package.json +1 -1
- package/types.d.ts +5 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
# Capture Bridge JavaScript Client SDK
|
|
2
2
|
|
|
3
|
-
- [SDK Documentation for v0.
|
|
4
|
-
- [SDK CHANGELOG](https://docs.capturebridge.net/client/sdk/javascript/0.
|
|
3
|
+
- [SDK Documentation for v0.39.0](https://docs.capturebridge.net/client/sdk/javascript/0.39.0/index.html)
|
|
4
|
+
- [SDK CHANGELOG](https://docs.capturebridge.net/client/sdk/javascript/0.39.0/CHANGELOG.html)
|
package/Version.js
CHANGED
package/Webcam.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import CaptureBridge from './CaptureBridge.js'
|
|
2
|
+
import Camera from './Camera.js'
|
|
3
|
+
import { BASE_URL } from './Common.js'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Webcam
|
|
7
|
+
* @classdesc Convenience class for instantiating a Webcam Object.
|
|
8
|
+
* Inherits all methods on the {@link Camera} class.
|
|
9
|
+
* @extends Camera
|
|
10
|
+
* @see {@link Camera}
|
|
11
|
+
*/
|
|
12
|
+
class Webcam extends Camera {
|
|
13
|
+
/**
|
|
14
|
+
* Instantiate a Webcam
|
|
15
|
+
* @constructor
|
|
16
|
+
* @param {string} pluginId - The Id of the desired plugin to use for this
|
|
17
|
+
* webcam instance. The plugin must support the `start_feed`, `stop_feed`,
|
|
18
|
+
* `devices`, and `capture` methods.
|
|
19
|
+
* @param {string} [baseURL] - Protocol, domain, and port for the service.
|
|
20
|
+
* @example
|
|
21
|
+
* const webcam = new Webcam('capture_webcam_windows')
|
|
22
|
+
*/
|
|
23
|
+
constructor (pluginId, baseUrl = BASE_URL) {
|
|
24
|
+
super(pluginId, baseUrl)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default Webcam
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Instantiate this Capture Bridge instance's Webcam plugin
|
|
32
|
+
* @constructor
|
|
33
|
+
* @param {string} [baseURL] - Protocol, domain, and port for the service.
|
|
34
|
+
* @example
|
|
35
|
+
* const webcam = await WebcamFactory()
|
|
36
|
+
*/
|
|
37
|
+
export const WebcamFactory = async (baseUrl = BASE_URL) => {
|
|
38
|
+
const cb = new CaptureBridge(baseUrl)
|
|
39
|
+
const plugins = await cb.plugins()
|
|
40
|
+
const plugin = plugins.find(p => p.id.includes('capture_webcam_'))
|
|
41
|
+
if (!plugin) {
|
|
42
|
+
throw new Error('No webcam plugin found')
|
|
43
|
+
}
|
|
44
|
+
return new Webcam(plugin, baseUrl)
|
|
45
|
+
}
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -164,6 +164,11 @@ declare module '@capturebridge/sdk/TextInput' {
|
|
|
164
164
|
export default TextInput;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
+
declare module '@capturebridge/sdk/Webcam' {
|
|
168
|
+
const Webcam: any;
|
|
169
|
+
export default Webcam;
|
|
170
|
+
}
|
|
171
|
+
|
|
167
172
|
declare module '@capturebridge/sdk/WindowsScanner' {
|
|
168
173
|
const WindowsScanner: any;
|
|
169
174
|
export default WindowsScanner;
|