@capturebridge/sdk 0.38.0 → 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 CHANGED
@@ -1,4 +1,4 @@
1
1
  # Capture Bridge JavaScript Client SDK
2
2
 
3
- - [SDK Documentation for v0.38.0](https://docs.capturebridge.net/client/sdk/javascript/0.38.0/index.html)
4
- - [SDK CHANGELOG](https://docs.capturebridge.net/client/sdk/javascript/0.38.0/CHANGELOG.html)
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
@@ -4,5 +4,5 @@
4
4
  * @constant
5
5
  * @type {string}
6
6
  */
7
- const VERSION = '0.38.0'
7
+ const VERSION = '0.39.0'
8
8
  export default VERSION
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capturebridge/sdk",
3
- "version": "0.38.0",
3
+ "version": "0.39.0",
4
4
  "description": "Capture Bridge JavaScript client SDK",
5
5
  "type": "module",
6
6
  "types": "types.d.ts",
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;