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
Copy file name to clipboardExpand all lines: README.md
+20-8Lines changed: 20 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -169,7 +169,9 @@ Distributed content will overlay the camera stream, wrapped in a `position: abso
169
169
170
170
### `paused` prop
171
171
172
-
With the `paused` prop you can prevent further `decode` propagation and functions passed via `track` are stopped being called. Useful for example if you want to validate results one at a time. This will also freeze the camera stream.
172
+
With the `paused` prop you can prevent further `decode` propagation. Functions passed via `track` are also stopped being called. Useful for example if you want to validate results one at a time.
173
+
174
+
> When the component is paused the camera stream freezes but is actually still running in the background. The browser will tell you that the camera is still in use. If you want to kill the stream completely you can pass `false` to the `camera` prop.
With the `camera` prop you can filter the set of cameras installed on a client device. For example, if you want to access the front camera instead of the rear camera, pass this:
This component uses [getUserMedia](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia) to request camera streams. This method accepts [a constraints object](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints#Properties_of_video_tracks) to configure for example if front or rear camera should be accessed. This is passed by default:
202
+
This component uses [getUserMedia](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia) to request camera streams. This method accepts [a constraints object](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints#Properties_of_video_tracks). By default this component passes this:
195
203
196
204
```javascript
197
205
{
@@ -204,13 +212,17 @@ This component uses [getUserMedia](https://developer.mozilla.org/en-US/docs/Web/
204
212
}
205
213
```
206
214
207
-
You can change the `video` part using the `video-constraints` prop. Note that you only have to pass properties you want to override. If you want to use the front camera for example and change nothing else, pass this:
215
+
This `video` part in this object is essentially what you can change using the `camera` prop. Note that you only have to pass properties you want to override. All the other default properties on the first depth level are preserved. Here are a few examples:
`camera="{ facingMode: 'user' }"`: the `facingMode` property is passed and is the only property that changes. `width` and `height` are still the default value.
218
+
219
+
`camera="false"`: overrides ALL default properties. No camera can match those constraints so no camera is request in the first place. You can use this to turn of the camera at runtime.
220
+
221
+
`camera="{}"`: since an empty object does not contain properties that could override something, this is just like falling back to the default. The same as not using the `camera` prop at all or passing `undefined`/`null`.
222
+
223
+
`camera="true"`: overrides ALL default properties. You will accept any camera type there is. Not recommended though as iOS seems to have trouble when the `height` and `width` constraints are missing.
212
224
213
-
> If you change this property after initialization, a new camera stream will be requested and the `init` event will be emitted again.
225
+
> If you change this property after initialization, a new camera stream has to be requested and the `init` event will be emitted again.
0 commit comments