-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore/rename readme and fix readme (#218)
* refactor: reorganise components for publishing * redesign(Embed): update dependencies to new format * config(GH-Actions): modify lint action for new folder name * config(gitignore): remove build files * fix: remove test code for published document-capture component * chore(gh-actions): update versions for setup-node, upload-artifact * fix: update package-lock.json * config(gh-actions): add cache and cache-dependency-path * config(gh-actions): use root file as cache-dependency-path * config: update package-lock.json * refactor: set up publishing for components * config: change components directory in embed * fix: run linter on web-components * refactor for publication * remove cypress screenshots * move components to components dir Add readme * move components to components folder * Fix lint * add back exports * export selfie-capture * Fix lint issue Resolve lint issue with modules not resolving * Add custom resolver * rename readme * remove unused file * rename readmes * remove empty readmes * Remove empty file * add file upload readme * add camera readme * remove duplicate readme * revert file changes --------- Co-authored-by: tams sokari <[email protected]> Co-authored-by: tams sokari <[email protected]> Co-authored-by: Michael D'Angelo <[email protected]>
- Loading branch information
1 parent
ba4eedc
commit 40f9232
Showing
4 changed files
with
76 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# SmartCamera.js | ||
|
||
SmartCamera.js is a JavaScript class that provides an interface for interacting with the user's camera device. It has special handling for multi-camera Samsung devices to mitigate issues with blurry images at the edges. | ||
|
||
## Usage | ||
|
||
### Getting Media Stream | ||
|
||
To get the media stream from the user's camera, call the `getMedia` method with the desired constraints. This method returns a Promise that resolves to a MediaStream object. | ||
|
||
```javascript | ||
const constraints = { | ||
video: true, | ||
audio: false, | ||
}; | ||
const stream = await SmartCamera.getMedia(constraints); | ||
``` | ||
|
||
`StartCamera` is a singleton so the `stream` can be accessed anytime via `SmartCamera.stream`. | ||
|
||
```javascript | ||
let video = document.createElement('video'); | ||
|
||
video.autoplay = true; | ||
video.playsInline = true; | ||
video.muted = true; | ||
|
||
if ('srcObject' in video) { | ||
video.srcObject = stream; | ||
} else { | ||
video.src = window.URL.createObjectURL(stream); | ||
} | ||
video.play(); | ||
``` | ||
|
||
### Stopping Media Stream | ||
|
||
To stop the media stream, call the stopMedia method. This will stop all tracks in the stream and set the stream to null. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# SmartFileUpload.js | ||
|
||
This exports a class for dealing with file-uploads in SmileID's web components | ||
|
||
## Usage | ||
Suppose you have an file input field | ||
|
||
```html | ||
<input type='file' id='upload-photo' name='document' accept='image/png, image/jpeg' /> | ||
``` | ||
|
||
```javascript | ||
// get the element | ||
const uploadDocumentPhotoButton = document.getElementById('upload-photo'); | ||
// add a change event listener | ||
uploadDocumentPhotoButton.addEventListener('change', async (event) => { | ||
try { | ||
const { files } = event.target; | ||
|
||
// validate file, and convert file to data url | ||
// returns the data url for the first file | ||
const fileData = await SmartFileUpload.retrieve(files); | ||
|
||
// use the data url | ||
} catch (error) { | ||
// handle error | ||
} | ||
}, | ||
); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# @smileid/styles | ||
|
||
This is a package that contains global styles exported as a string to be used in composing CSS in Web Components and anywhere else |