You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
831 B
Markdown
49 lines
831 B
Markdown
![]()
7 years ago
|
# Api
|
||
|
|
||
|
### QrcodeDecoder()
|
||
|
|
||
|
User `new` to create a decoder object.
|
||
|
|
||
|
```javascript
|
||
|
var qr = new QrcodeDecoder();
|
||
|
```
|
||
|
|
||
|
#### decodeFromImage(img, options)
|
||
|
|
||
|
Decodes an image from url or an `<img>` element with a `src` attribute set.
|
||
|
|
||
|
```javascript
|
||
|
qr.decodeFromImage(img).then((res) => {
|
||
|
console.log(res);
|
||
|
});
|
||
|
```
|
||
|
|
||
|
[Demo](./demo/image.html)
|
||
|
|
||
|
#### decodeFromVideo(videoElem, options)
|
||
|
|
||
|
Decodes directly from a video with a well specified `src` attribute
|
||
|
|
||
|
```javascript
|
||
|
qr.decodeFromVideo(videoElement).then((res) => {
|
||
|
console.log(res);
|
||
|
});
|
||
|
```
|
||
|
|
||
|
[Demo](./demo/video.html)
|
||
|
|
||
|
#### decodeFromCamera(videoElem, options)
|
||
|
|
||
|
Decodes from a videoElement.
|
||
|
|
||
|
```javascript
|
||
|
qr.decodeFromCamera(videoElem).then((res) => {
|
||
|
console.log(res);
|
||
|
});
|
||
|
```
|
||
|
|
||
|
[Demo](./demo/camera.html)
|
||
|
|
||
|
#### stop()
|
||
|
|
||
|
Stops the current `qr` from searching for a QRCode.
|