@scaleflex/widget-webcam 4.0.6 → 4.1.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/CHANGELOG.md +7493 -7468
- package/LICENSE +21 -21
- package/README.md +189 -189
- package/lib/index.js +22 -22
- package/package.json +5 -5
- package/types/index.d.ts +25 -25
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019 scaleflex
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 scaleflex
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,189 +1,189 @@
|
|
|
1
|
-
# `@scaleflex/widget-webcam`
|
|
2
|
-
|
|
3
|
-
[![Plugins][plugins-image]](#plugins)
|
|
4
|
-
[![Website][filerobot-image]][sfx-url]
|
|
5
|
-
[![Version][filerobot-version]][version-url]
|
|
6
|
-
[![Scaleflex team][made-by-image]][sfx-url]
|
|
7
|
-
[![License][license-image]][license-url]
|
|
8
|
-
[![CodeSandbox][codeSandbox-image]][codeSandbox-url]
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<div align='center'>
|
|
12
|
-
<img title="Scaleflex Widget logo" alt="Scaleflex Widget logo" src="https://assets.scaleflex.com/Corporate+Branding/%5B2025%5D+ALL+LOGOS+%2B+ICONS/SCALEFLEX/VXP+logo/Horizontal+White/VXP+logo+WHITE.png?vh=663932" width="140"/>
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
The webcam plugin for [Scaleflex Media Asset Widget](https://www.npmjs.com/package/@scaleflex/widget-core) gives the possibility to take a photo and record video from the built-in camera and process them for uploading directly.
|
|
16
|
-
|
|
17
|
-
## Usage
|
|
18
|
-
|
|
19
|
-
### NPM
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
npm install --save @scaleflex/widget-webcam
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### YARN
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
yarn add @scaleflex/widget-webcam
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
then
|
|
32
|
-
|
|
33
|
-
```js
|
|
34
|
-
import Webcam from '@scaleflex/widget-webcam'
|
|
35
|
-
...
|
|
36
|
-
...
|
|
37
|
-
...
|
|
38
|
-
scaleflexWidget.use(Webcam, propertiesObject)
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### CDN
|
|
42
|
-
|
|
43
|
-
The plugin from CDN is found inside `Scaleflex` global object `Scaleflex.Webcam`
|
|
44
|
-
|
|
45
|
-
```js
|
|
46
|
-
const Webcam = window.ScaleflexWidget.Webcam
|
|
47
|
-
...
|
|
48
|
-
...
|
|
49
|
-
...
|
|
50
|
-
scaleflexWidget.use(Webcam, propertiesObject)
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Plugin's styles
|
|
54
|
-
|
|
55
|
-
```js
|
|
56
|
-
import '@scaleflex/widget-core/dist/style.css'
|
|
57
|
-
import '@scaleflex/widget-webcam/dist/style.css'
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
or if you prefer the minified version
|
|
61
|
-
|
|
62
|
-
```js
|
|
63
|
-
import '@scaleflex/widget-core/dist/style.min.css'
|
|
64
|
-
import '@scaleflex/widget-webcam/dist/style.min.css'
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
> The plugin's css file should be imported after the [Core's css file](../@scaleflex/widget-core/#modules-styles) for having the styles shown correctly.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
## Properties
|
|
71
|
-
|
|
72
|
-
### `title`
|
|
73
|
-
|
|
74
|
-
<u>Type:</u> `string`.
|
|
75
|
-
|
|
76
|
-
<u>Default:</u> `'Camera'`
|
|
77
|
-
|
|
78
|
-
The title shown in the top bar of the panel.
|
|
79
|
-
|
|
80
|
-
### `countdown: `
|
|
81
|
-
|
|
82
|
-
<u>Type:</u> `number`.
|
|
83
|
-
|
|
84
|
-
<u>Default:</u> `0/false`
|
|
85
|
-
|
|
86
|
-
When capturing a photo, wait the amount of this countdown in seconds and then capture the photo with showing an informer message with the seconds left & Smile text when countdown is passed.
|
|
87
|
-
|
|
88
|
-
### `modes`
|
|
89
|
-
|
|
90
|
-
<u>Type:</u> `array`.
|
|
91
|
-
|
|
92
|
-
<u>Default:</u> `all modes allowed`
|
|
93
|
-
|
|
94
|
-
The modes allowed for the user:
|
|
95
|
-
- `video-audio`: Records a video file including the audio.
|
|
96
|
-
- `video-only`: Records a video file excluding audio.
|
|
97
|
-
- `audio-only`: Records audio only but no video.
|
|
98
|
-
- `picture`: Takes a photo from the camera.
|
|
99
|
-
|
|
100
|
-
### `mirror`
|
|
101
|
-
|
|
102
|
-
<u>Type:</u> `boolean`.
|
|
103
|
-
|
|
104
|
-
<u>Default:</u> `true`
|
|
105
|
-
|
|
106
|
-
Defines if you need to mirror the (preview image) or not.
|
|
107
|
-
|
|
108
|
-
### `facingMode`
|
|
109
|
-
|
|
110
|
-
<u>Type:</u> `string`.
|
|
111
|
-
|
|
112
|
-
<u>Default:</u> `'user'`
|
|
113
|
-
|
|
114
|
-
`In case device has multiple cameras this option gives the possibility to choose which one should be used:
|
|
115
|
-
- `user`: The video source is facing toward the user; this includes, for example, the front-facing camera on a smartphone.
|
|
116
|
-
- `environment`: The video source is facing away from the user, thereby viewing their environment. This is the back camera on a smartphone.
|
|
117
|
-
- `left`: The video source is facing toward the user but to their left, such as a camera aimed toward the user but over their left shoulder.
|
|
118
|
-
- `right`: The video source is facing toward the user but to their right, such as a camera aimed toward the user but over their right shoulder.
|
|
119
|
-
|
|
120
|
-
### `preferredImageMimeType`
|
|
121
|
-
|
|
122
|
-
<u>Type:</u> `string`.
|
|
123
|
-
|
|
124
|
-
<u>Default:</u> `'image/jpeg'`
|
|
125
|
-
|
|
126
|
-
Defines the captured image mime type ex. `image/png` if not defined or defined some un-supported mime type from the browser then `image/jpeg` would be used.
|
|
127
|
-
|
|
128
|
-
### `preferredVideoMimeType`
|
|
129
|
-
|
|
130
|
-
<u>Type:</u> `string`.
|
|
131
|
-
|
|
132
|
-
<u>Default:</u> `null`
|
|
133
|
-
|
|
134
|
-
The mime type for the recorded video to be saved with if you provided un-supported mime type then the browser's default would be used, if you left it `null` then if found any suitable type inside [`allowedFileTypes`](../core/README.md/#restrictions) it would be used.
|
|
135
|
-
|
|
136
|
-
### `showRecordingLength`
|
|
137
|
-
|
|
138
|
-
<u>Type:</u> `boolean`.
|
|
139
|
-
|
|
140
|
-
<u>Default:</u> `true`
|
|
141
|
-
|
|
142
|
-
Whether to show the video's recording length or not while it is in progress.
|
|
143
|
-
|
|
144
|
-
### `isRecordIconHidden`
|
|
145
|
-
|
|
146
|
-
<u>Type:</u> `boolean`.
|
|
147
|
-
|
|
148
|
-
<u>Default:</u> `false`
|
|
149
|
-
|
|
150
|
-
If set to `true`, the record button in webcam will be disabled preventing users from recording videos.
|
|
151
|
-
|
|
152
|
-
### `locale`
|
|
153
|
-
|
|
154
|
-
<u>Type:</u> `object`.
|
|
155
|
-
|
|
156
|
-
<u>Default:</u>
|
|
157
|
-
|
|
158
|
-
```js
|
|
159
|
-
strings: {
|
|
160
|
-
smile: 'Smile!',
|
|
161
|
-
takePicture: 'Take a picture',
|
|
162
|
-
startRecording: 'Begin video recording',
|
|
163
|
-
stopRecording: 'Stop video recording',
|
|
164
|
-
allowAccessTitle: 'Please allow access to your camera',
|
|
165
|
-
allowAccessDescription: 'In order to take pictures or record video with your camera, please allow camera access for this site.',
|
|
166
|
-
noCameraTitle: 'Camera Not Available',
|
|
167
|
-
noCameraDescription: 'In order to take pictures or record video, please connect a camera device',
|
|
168
|
-
recordingStoppedMaxSize: 'Recording stopped because the file size is about to exceed the limit',
|
|
169
|
-
recordingLength: 'Recording length %{recording_length}'
|
|
170
|
-
}
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
Customizing some of the translations or the language's strings and replace the default locale.
|
|
174
|
-
|
|
175
|
-
<!-- Variables -->
|
|
176
|
-
|
|
177
|
-
[npm-url]: https://www.npmjs.com/package/@scaleflex/widget-webcam
|
|
178
|
-
[license-url]: https://opensource.org/licenses/MIT
|
|
179
|
-
[sfx-url]: https://www.scaleflex.com/
|
|
180
|
-
[version-url]: https://www.npmjs.com/package/@scaleflex/widget-webcam
|
|
181
|
-
[codeSandbox-url]: https://codesandbox.io/p/sandbox/scalelfex-widget-v4-sandbox-dtp6l3?file=%2Fsrc%2Findex.js
|
|
182
|
-
|
|
183
|
-
[npm-image]: https://img.shields.io/npm/v/@telus/remark-config.svg?style=for-the-badge&logo=npm
|
|
184
|
-
[license-image]: https://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge
|
|
185
|
-
[made-by-image]: https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-the%20Scaleflex%20team-6986fa.svg?style=for-the-badge
|
|
186
|
-
[plugins-image]: https://img.shields.io/static/v1?label=Scaleflex&message=Plugins&color=yellow&style=for-the-badge
|
|
187
|
-
[filerobot-image]: https://img.shields.io/static/v1?label=Scaleflex&message=website&color=orange&style=for-the-badge
|
|
188
|
-
[filerobot-version]: https://img.shields.io/npm/v/@scaleflex/widget-webcam?label=Version&style=for-the-badge&logo=npm
|
|
189
|
-
[codeSandbox-image]: https://img.shields.io/badge/CodeSandbox-black?style=for-the-badge&logo=CodeSandbox
|
|
1
|
+
# `@scaleflex/widget-webcam`
|
|
2
|
+
|
|
3
|
+
[![Plugins][plugins-image]](#plugins)
|
|
4
|
+
[![Website][filerobot-image]][sfx-url]
|
|
5
|
+
[![Version][filerobot-version]][version-url]
|
|
6
|
+
[![Scaleflex team][made-by-image]][sfx-url]
|
|
7
|
+
[![License][license-image]][license-url]
|
|
8
|
+
[![CodeSandbox][codeSandbox-image]][codeSandbox-url]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
<div align='center'>
|
|
12
|
+
<img title="Scaleflex Widget logo" alt="Scaleflex Widget logo" src="https://assets.scaleflex.com/Corporate+Branding/%5B2025%5D+ALL+LOGOS+%2B+ICONS/SCALEFLEX/VXP+logo/Horizontal+White/VXP+logo+WHITE.png?vh=663932" width="140"/>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
The webcam plugin for [Scaleflex Media Asset Widget](https://www.npmjs.com/package/@scaleflex/widget-core) gives the possibility to take a photo and record video from the built-in camera and process them for uploading directly.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### NPM
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install --save @scaleflex/widget-webcam
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### YARN
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
yarn add @scaleflex/widget-webcam
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
then
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
import Webcam from '@scaleflex/widget-webcam'
|
|
35
|
+
...
|
|
36
|
+
...
|
|
37
|
+
...
|
|
38
|
+
scaleflexWidget.use(Webcam, propertiesObject)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### CDN
|
|
42
|
+
|
|
43
|
+
The plugin from CDN is found inside `Scaleflex` global object `Scaleflex.Webcam`
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
const Webcam = window.ScaleflexWidget.Webcam
|
|
47
|
+
...
|
|
48
|
+
...
|
|
49
|
+
...
|
|
50
|
+
scaleflexWidget.use(Webcam, propertiesObject)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Plugin's styles
|
|
54
|
+
|
|
55
|
+
```js
|
|
56
|
+
import '@scaleflex/widget-core/dist/style.css'
|
|
57
|
+
import '@scaleflex/widget-webcam/dist/style.css'
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
or if you prefer the minified version
|
|
61
|
+
|
|
62
|
+
```js
|
|
63
|
+
import '@scaleflex/widget-core/dist/style.min.css'
|
|
64
|
+
import '@scaleflex/widget-webcam/dist/style.min.css'
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
> The plugin's css file should be imported after the [Core's css file](../@scaleflex/widget-core/#modules-styles) for having the styles shown correctly.
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## Properties
|
|
71
|
+
|
|
72
|
+
### `title`
|
|
73
|
+
|
|
74
|
+
<u>Type:</u> `string`.
|
|
75
|
+
|
|
76
|
+
<u>Default:</u> `'Camera'`
|
|
77
|
+
|
|
78
|
+
The title shown in the top bar of the panel.
|
|
79
|
+
|
|
80
|
+
### `countdown: `
|
|
81
|
+
|
|
82
|
+
<u>Type:</u> `number`.
|
|
83
|
+
|
|
84
|
+
<u>Default:</u> `0/false`
|
|
85
|
+
|
|
86
|
+
When capturing a photo, wait the amount of this countdown in seconds and then capture the photo with showing an informer message with the seconds left & Smile text when countdown is passed.
|
|
87
|
+
|
|
88
|
+
### `modes`
|
|
89
|
+
|
|
90
|
+
<u>Type:</u> `array`.
|
|
91
|
+
|
|
92
|
+
<u>Default:</u> `all modes allowed`
|
|
93
|
+
|
|
94
|
+
The modes allowed for the user:
|
|
95
|
+
- `video-audio`: Records a video file including the audio.
|
|
96
|
+
- `video-only`: Records a video file excluding audio.
|
|
97
|
+
- `audio-only`: Records audio only but no video.
|
|
98
|
+
- `picture`: Takes a photo from the camera.
|
|
99
|
+
|
|
100
|
+
### `mirror`
|
|
101
|
+
|
|
102
|
+
<u>Type:</u> `boolean`.
|
|
103
|
+
|
|
104
|
+
<u>Default:</u> `true`
|
|
105
|
+
|
|
106
|
+
Defines if you need to mirror the (preview image) or not.
|
|
107
|
+
|
|
108
|
+
### `facingMode`
|
|
109
|
+
|
|
110
|
+
<u>Type:</u> `string`.
|
|
111
|
+
|
|
112
|
+
<u>Default:</u> `'user'`
|
|
113
|
+
|
|
114
|
+
`In case device has multiple cameras this option gives the possibility to choose which one should be used:
|
|
115
|
+
- `user`: The video source is facing toward the user; this includes, for example, the front-facing camera on a smartphone.
|
|
116
|
+
- `environment`: The video source is facing away from the user, thereby viewing their environment. This is the back camera on a smartphone.
|
|
117
|
+
- `left`: The video source is facing toward the user but to their left, such as a camera aimed toward the user but over their left shoulder.
|
|
118
|
+
- `right`: The video source is facing toward the user but to their right, such as a camera aimed toward the user but over their right shoulder.
|
|
119
|
+
|
|
120
|
+
### `preferredImageMimeType`
|
|
121
|
+
|
|
122
|
+
<u>Type:</u> `string`.
|
|
123
|
+
|
|
124
|
+
<u>Default:</u> `'image/jpeg'`
|
|
125
|
+
|
|
126
|
+
Defines the captured image mime type ex. `image/png` if not defined or defined some un-supported mime type from the browser then `image/jpeg` would be used.
|
|
127
|
+
|
|
128
|
+
### `preferredVideoMimeType`
|
|
129
|
+
|
|
130
|
+
<u>Type:</u> `string`.
|
|
131
|
+
|
|
132
|
+
<u>Default:</u> `null`
|
|
133
|
+
|
|
134
|
+
The mime type for the recorded video to be saved with if you provided un-supported mime type then the browser's default would be used, if you left it `null` then if found any suitable type inside [`allowedFileTypes`](../core/README.md/#restrictions) it would be used.
|
|
135
|
+
|
|
136
|
+
### `showRecordingLength`
|
|
137
|
+
|
|
138
|
+
<u>Type:</u> `boolean`.
|
|
139
|
+
|
|
140
|
+
<u>Default:</u> `true`
|
|
141
|
+
|
|
142
|
+
Whether to show the video's recording length or not while it is in progress.
|
|
143
|
+
|
|
144
|
+
### `isRecordIconHidden`
|
|
145
|
+
|
|
146
|
+
<u>Type:</u> `boolean`.
|
|
147
|
+
|
|
148
|
+
<u>Default:</u> `false`
|
|
149
|
+
|
|
150
|
+
If set to `true`, the record button in webcam will be disabled preventing users from recording videos.
|
|
151
|
+
|
|
152
|
+
### `locale`
|
|
153
|
+
|
|
154
|
+
<u>Type:</u> `object`.
|
|
155
|
+
|
|
156
|
+
<u>Default:</u>
|
|
157
|
+
|
|
158
|
+
```js
|
|
159
|
+
strings: {
|
|
160
|
+
smile: 'Smile!',
|
|
161
|
+
takePicture: 'Take a picture',
|
|
162
|
+
startRecording: 'Begin video recording',
|
|
163
|
+
stopRecording: 'Stop video recording',
|
|
164
|
+
allowAccessTitle: 'Please allow access to your camera',
|
|
165
|
+
allowAccessDescription: 'In order to take pictures or record video with your camera, please allow camera access for this site.',
|
|
166
|
+
noCameraTitle: 'Camera Not Available',
|
|
167
|
+
noCameraDescription: 'In order to take pictures or record video, please connect a camera device',
|
|
168
|
+
recordingStoppedMaxSize: 'Recording stopped because the file size is about to exceed the limit',
|
|
169
|
+
recordingLength: 'Recording length %{recording_length}'
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Customizing some of the translations or the language's strings and replace the default locale.
|
|
174
|
+
|
|
175
|
+
<!-- Variables -->
|
|
176
|
+
|
|
177
|
+
[npm-url]: https://www.npmjs.com/package/@scaleflex/widget-webcam
|
|
178
|
+
[license-url]: https://opensource.org/licenses/MIT
|
|
179
|
+
[sfx-url]: https://www.scaleflex.com/
|
|
180
|
+
[version-url]: https://www.npmjs.com/package/@scaleflex/widget-webcam
|
|
181
|
+
[codeSandbox-url]: https://codesandbox.io/p/sandbox/scalelfex-widget-v4-sandbox-dtp6l3?file=%2Fsrc%2Findex.js
|
|
182
|
+
|
|
183
|
+
[npm-image]: https://img.shields.io/npm/v/@telus/remark-config.svg?style=for-the-badge&logo=npm
|
|
184
|
+
[license-image]: https://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge
|
|
185
|
+
[made-by-image]: https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-the%20Scaleflex%20team-6986fa.svg?style=for-the-badge
|
|
186
|
+
[plugins-image]: https://img.shields.io/static/v1?label=Scaleflex&message=Plugins&color=yellow&style=for-the-badge
|
|
187
|
+
[filerobot-image]: https://img.shields.io/static/v1?label=Scaleflex&message=website&color=orange&style=for-the-badge
|
|
188
|
+
[filerobot-version]: https://img.shields.io/npm/v/@scaleflex/widget-webcam?label=Version&style=for-the-badge&logo=npm
|
|
189
|
+
[codeSandbox-image]: https://img.shields.io/badge/CodeSandbox-black?style=for-the-badge&logo=CodeSandbox
|
package/lib/index.js
CHANGED
|
@@ -38,11 +38,11 @@ import webcamReducer, { webcamCommonStateUpdated } from './common.slice';
|
|
|
38
38
|
// import { version } from '../package.json'
|
|
39
39
|
// import packageInfo from '../package.json'
|
|
40
40
|
|
|
41
|
-
/**
|
|
42
|
-
* Normalize a MIME type or file extension into a MIME type.
|
|
43
|
-
*
|
|
44
|
-
* @param {string} fileType - MIME type or a file extension prefixed with `.`.
|
|
45
|
-
* @returns {string|undefined} The MIME type or `undefined` if the fileType is an extension and is not known.
|
|
41
|
+
/**
|
|
42
|
+
* Normalize a MIME type or file extension into a MIME type.
|
|
43
|
+
*
|
|
44
|
+
* @param {string} fileType - MIME type or a file extension prefixed with `.`.
|
|
45
|
+
* @returns {string|undefined} The MIME type or `undefined` if the fileType is an extension and is not known.
|
|
46
46
|
*/
|
|
47
47
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
48
48
|
function toMimeType(fileType) {
|
|
@@ -52,29 +52,29 @@ function toMimeType(fileType) {
|
|
|
52
52
|
return fileType;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
/**
|
|
56
|
-
* Is this MIME type a video?
|
|
57
|
-
*
|
|
58
|
-
* @param {string} mimeType - MIME type.
|
|
59
|
-
* @returns {boolean}
|
|
55
|
+
/**
|
|
56
|
+
* Is this MIME type a video?
|
|
57
|
+
*
|
|
58
|
+
* @param {string} mimeType - MIME type.
|
|
59
|
+
* @returns {boolean}
|
|
60
60
|
*/
|
|
61
61
|
function isVideoMimeType(mimeType) {
|
|
62
62
|
return /^video\/[^*]+$/.test(mimeType);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
/**
|
|
66
|
-
* Is this MIME type an image?
|
|
67
|
-
*
|
|
68
|
-
* @param {string} mimeType - MIME type.
|
|
69
|
-
* @returns {boolean}
|
|
65
|
+
/**
|
|
66
|
+
* Is this MIME type an image?
|
|
67
|
+
*
|
|
68
|
+
* @param {string} mimeType - MIME type.
|
|
69
|
+
* @returns {boolean}
|
|
70
70
|
*/
|
|
71
71
|
function isImageMimeType(mimeType) {
|
|
72
72
|
return /^image\/[^*]+$/.test(mimeType);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
/**
|
|
76
|
-
* Setup getUserMedia, with polyfill for older browsers
|
|
77
|
-
* Adapted from: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
|
|
75
|
+
/**
|
|
76
|
+
* Setup getUserMedia, with polyfill for older browsers
|
|
77
|
+
* Adapted from: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
|
|
78
78
|
*/
|
|
79
79
|
function getMediaDevices() {
|
|
80
80
|
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
|
|
@@ -92,8 +92,8 @@ function getMediaDevices() {
|
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
|
-
/**
|
|
96
|
-
* Webcam
|
|
95
|
+
/**
|
|
96
|
+
* Webcam
|
|
97
97
|
*/
|
|
98
98
|
var Webcam = /*#__PURE__*/function (_Plugin) {
|
|
99
99
|
// static VERSION = packageInfo.version
|
|
@@ -226,8 +226,8 @@ var Webcam = /*#__PURE__*/function (_Plugin) {
|
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
/**
|
|
230
|
-
* @returns {object}
|
|
229
|
+
/**
|
|
230
|
+
* @returns {object}
|
|
231
231
|
*/
|
|
232
232
|
}, {
|
|
233
233
|
key: "_getMediaRecorderOptions",
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleflex/widget-webcam",
|
|
3
3
|
"description": "Scaleflex plugin that takes photos or records videos using the device's camera.",
|
|
4
|
-
"version": "4.0
|
|
4
|
+
"version": "4.1.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"style": "dist/style.min.css",
|
|
8
8
|
"types": "types/index.d.ts",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@scaleflex/widget-common": "^4.0
|
|
11
|
-
"@scaleflex/widget-icons": "^4.0
|
|
12
|
-
"@scaleflex/widget-utils": "^4.0
|
|
10
|
+
"@scaleflex/widget-common": "^4.1.0",
|
|
11
|
+
"@scaleflex/widget-icons": "^4.1.0",
|
|
12
|
+
"@scaleflex/widget-utils": "^4.1.0"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"react": "^19.0.0",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "471120d67066617a0d8824eae11b07d1f2259473"
|
|
33
33
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import Filerobot = require("@scaleflex/widget-core");
|
|
2
|
-
import WebcamLocale = require("./generatedLocale");
|
|
3
|
-
|
|
4
|
-
declare module Webcam {
|
|
5
|
-
export type WebcamMode =
|
|
6
|
-
| "video-audio"
|
|
7
|
-
| "video-only"
|
|
8
|
-
| "audio-only"
|
|
9
|
-
| "picture";
|
|
10
|
-
|
|
11
|
-
export interface WebcamOptions extends Filerobot.PluginOptions {
|
|
12
|
-
replaceTargetContent?: boolean;
|
|
13
|
-
target?: Filerobot.PluginTarget;
|
|
14
|
-
onBeforeSnapshot?: () => Promise<void>;
|
|
15
|
-
countdown?: number | boolean;
|
|
16
|
-
mirror?: boolean;
|
|
17
|
-
facingMode?: string;
|
|
18
|
-
modes?: WebcamMode[];
|
|
19
|
-
locale?: WebcamLocale;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
declare class Webcam extends Filerobot.Plugin<Webcam.WebcamOptions> {}
|
|
24
|
-
|
|
25
|
-
export = Webcam;
|
|
1
|
+
import Filerobot = require("@scaleflex/widget-core");
|
|
2
|
+
import WebcamLocale = require("./generatedLocale");
|
|
3
|
+
|
|
4
|
+
declare module Webcam {
|
|
5
|
+
export type WebcamMode =
|
|
6
|
+
| "video-audio"
|
|
7
|
+
| "video-only"
|
|
8
|
+
| "audio-only"
|
|
9
|
+
| "picture";
|
|
10
|
+
|
|
11
|
+
export interface WebcamOptions extends Filerobot.PluginOptions {
|
|
12
|
+
replaceTargetContent?: boolean;
|
|
13
|
+
target?: Filerobot.PluginTarget;
|
|
14
|
+
onBeforeSnapshot?: () => Promise<void>;
|
|
15
|
+
countdown?: number | boolean;
|
|
16
|
+
mirror?: boolean;
|
|
17
|
+
facingMode?: string;
|
|
18
|
+
modes?: WebcamMode[];
|
|
19
|
+
locale?: WebcamLocale;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare class Webcam extends Filerobot.Plugin<Webcam.WebcamOptions> {}
|
|
24
|
+
|
|
25
|
+
export = Webcam;
|