You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 5, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+99-91Lines changed: 99 additions & 91 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,82 +4,89 @@ Allow your website to easily control cameras on desktop and mobile devices.
4
4
5
5
Once integrated, your users can open your website in a browser, access their cameras to stream live video and acquire realtime frames.
6
6
7
-
In this guide, you will learn step by step on how to integrate this library into your website.
7
+
In this guide, you will learn step by step on how to integrate this SDK into your website.
8
8
9
9
**Table of Contents**
10
10
11
11
*[Getting Started](#getting-started)
12
-
+[Include the library](#include-the-library)
13
-
+[Interact with the library](#interact-with-the-library)
14
-
*[Hosting the Library](#hosting-the-library)
12
+
*[Include the SDK](#include-the-sdk)
13
+
*[Interact with the SDK](#interact-with-the-sdk)
14
+
*[Hosting the SDK](#hosting-the-sdk)
15
15
*[FAQ](#faq)
16
16
17
-
**Example Usage**
18
-
19
-
Read the user guide of Dynamsoft Label Recognizer on how DCE helps the SDK achieve video recognition:
20
-
21
-
*[Dynamsoft Label Recognizer User Guide](https://www.dynamsoft.com/label-recognition/programming/javascript/user-guide.html?ver=latest&utm_source=dceguide)
17
+
> **Example Usage**
18
+
>
19
+
> Read the user guide of Dynamsoft Label Recognizer on how DCE helps the SDK achieve video recognition:
20
+
>
21
+
> *[Dynamsoft Label Recognizer User Guide](https://www.dynamsoft.com/label-recognition/programming/javascript/user-guide.html?ver=latest&utm_source=dceguide)
22
22
23
23
## Getting Started
24
24
25
-
### Include the library
25
+
### Include the SDK
26
26
27
27
#### Use a CDN
28
28
29
-
The simplest way to include the library is to use either the [jsDelivr](https://jsdelivr.com/) or [UNPKG](https://unpkg.com/) CDN.
29
+
The simplest way to include the SDK is to use either the [jsDelivr](https://jsdelivr.com/) or [UNPKG](https://unpkg.com/) CDN.
> You must set `defaultUIElementURL` before you call `createInstance()` .
119
126
120
-
* Append the default UI element to your page as shown in [Configure the CameraEnhancer object](#configure-the-cameraenhancer-object), customize it before showing it.
127
+
* Append the default UI element to your page as shown in [Configure the CameraEnhancer object](#configure-the-cameraenhancer-object), customize it if necessary.
> The video element will be created and appended to the DIV element with the class `dce-video-container`, make sure the class name is the same. Besides, the CSS property `position` of the DIV element must be either `relative`, `absolute`, `fixed`, or `sticky`.
154
163
155
-
+ Add the camera list and resolution list. If the class names for these lists match the default ones, `dce-sel-camera` and `dce-sel-resolution` , the library will automatically populate the lists and handle the camera/resolution switching.
164
+
* Add the camera list and resolution list. If the class names for these lists match the default ones, `dce-sel-camera` and `dce-sel-resolution` , the SDK will automatically populate the lists and handle the camera/resolution switching.
156
165
157
-
```html
158
-
<selectclass="dce-sel-camera"></select>
159
-
```
166
+
```html
167
+
<selectclass="dce-sel-camera"></select>
168
+
```
160
169
161
-
```html
162
-
<selectclass="dce-sel-resolution"></select>
163
-
```
170
+
```html
171
+
<selectclass="dce-sel-resolution"></select>
172
+
```
164
173
165
-
> By default, only 3 hard-coded resolutions (1920 x 1080, 1280 x 720, 640 x 480), are populated as options. You can show a customized set of options by hardcoding them.
174
+
> By default, only 4 hard-coded resolutions (3840 x 2160, 1920 x 1080, 1280 x 720, 640 x 480), are populated as options. You can show a customized set of options by hardcoding them.
> Generally, you need to provide a resolution that the camera supports. However, in case a camera does not support the specified resolution, it usually uses the cloest supported resolution. As a result, the selected resolution may not be the actual resolution. In this case, add an option with the class name `dce-opt-gotResolution` (as shown above) and the library will then use it to show the **actual resolution**.
184
+
> Generally, you need to provide a resolution that the camera supports. However, in case a camera does not support the specified resolution, it usually uses the cloest supported resolution. As a result, the selected resolution may not be the actual resolution. In this case, add an option with the class name `dce-opt-gotResolution` (as shown above) and the SDK will then use it to show the **actual resolution**.
177
185
178
-
## Hosting the library
186
+
## Hosting the SDK
179
187
180
188
### Step One: Deploy the dist folder
181
189
182
-
Once you have downloaded the library, you can locate the "dist" directory and copy it to your project (usually as part of your website / web application). The following shows some of the files in this directory:
190
+
Once you have downloaded the SDK, you can locate the "dist" directory and copy it to your project (usually as part of your website / web application). The following shows some of the files in this directory:
183
191
184
-
*`dce.js` // The main library file
185
-
*`dce.mjs` // For using the library as a module (`<script type="module">`)
192
+
*`dce.js` // The main SDK file
193
+
*`dce.mjs` // For using the SDK as a module (`<script type="module">`)
186
194
*`dce.ui.html` // Defines the default enhancer UI
187
195
188
196
### Step Two: Configure the Server
189
197
190
198
* Enable HTTPS
191
199
192
-
To use the library, you must access your website / web application via a secure HTTPS connection. This is due to browser security restrictions which only grant camera video streaming access to a [secure context](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).
200
+
To use the SDK, you must access your website / web application via a secure HTTPS connection. This is due to browser security restrictions which only grant camera video streaming access to a [secure context](https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts).
193
201
194
-
> For convenience, self-signed certificates are allowed during development and testing.
202
+
> For convenience, self-signed certificates are allowed during development and testing. Or use "http://localhost".
195
203
196
-
### Step Three: Include the library from the server
204
+
### Step Three: Include the SDK from the server
197
205
198
-
Now that the library is hosted on your server, you can include it accordingly.
206
+
Now that the SDK is hosted on your server, you can include it accordingly.
### Can I open the web page directly from the hard drive?
207
215
208
-
Yes, for simple testing purposes, it's perfectly fine to open the file directly from the hard drive. However, you might encounter some issues in doing so (like unable to access the camera, etc.). The recommendation is to deploy this page to your web server and run it over **HTTPS**. If you don't have a ready-to-use web server but have a package manager like *npm* or *yarn*, you can set up a simple HTTP server in minutes. Check out [`http-server` on npm](https://www.npmjs.com/package/http-server) or [yarn](https://yarnpkg.com/package/http-server).
216
+
Yes, for simple testing purposes, it's perfectly fine to open the file directly from the hard drive. However, you might encounter some issues in doing so (like unable to access the camera, etc.). The recommendation is to deploy this page to your web server and run it over **HTTPS**. If you don't have a ready-to-use web server but have a package manager like *npm* or *yarn*, you can set up a simple HTTP server in minutes. Check out [`http-server` on npm](https://www.npmjs.com/package/http-server) or [yarn](https://yarnpkg.com/package/http-server).
209
217
210
218
### Why can't I use my camera?
211
219
212
220
If you open the web page as `http://` , the camera may not work and you see the following error in the browser console:
213
221
214
-
> [Deprecation] getUserMedia() no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.
222
+
> [Deprecation] getUserMedia() no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See [https://goo.gl/rStTGz](https://goo.gl/rStTGz) for more details.
215
223
216
224
* In Safari 12 the equivalent error is:
217
225
@@ -221,7 +229,7 @@ You get this error because the API [getUserMedia](https://developer.mozilla.org/
221
229
222
230
To make sure your web application can access the camera, please configure your web server to support HTTPS. The following links may help.
0 commit comments