Browse Source

docs: Add Webcam docs

Renée Kooi 7 years ago
parent
commit
53e1c1a851
2 changed files with 59 additions and 1 deletions
  1. 2 1
      website/src/docs/plugins.md
  2. 57 0
      website/src/docs/webcam.md

+ 2 - 1
website/src/docs/plugins.md

@@ -7,11 +7,12 @@ order: 10
 
 Plugins are what makes Uppy useful: they help select, manipulate and upload files.
 
-- **Acquirers (neat UIs for picking files):**
+- **Acquirers (various ways of picking files):**
   - [Dashboard](/docs/dashboard) — full featured sleek UI with file previews, metadata editing, upload/pause/resume/cancel buttons and more
   - [DragDrop](/docs/dragdrop) — plain and simple drag and drop area
   - [FileInput](/docs/fileinput) — even more plain and simple, just a button
   - [Provider Plugins](#Provider-Plugins) (remote sources that work through [Uppy Server](/docs/uppy-server/)): Instagram, GoogleDrive, Dropbox
+  - [Webcam](/docs/webcam) — upload selfies or audio / video recordings
 - **Uploaders:**
   - [Tus](/docs/tus) — uploads using the [tus](https://tus.io) resumable upload protocol
   - [XHRUpload](/docs/xhrupload) — classic multipart form uploads or binary uploads using XMLHTTPRequest

+ 57 - 0
website/src/docs/webcam.md

@@ -0,0 +1,57 @@
+---
+type: docs
+order: 26
+title: "Webcam"
+permalink: docs/webcam/
+---
+
+
+[Try it live](/examples/dashboard/) - The Informer is included in the Dashboard by default.
+
+## Options
+
+```js
+uppy.use(Webcam, {
+  onBeforeSnapshot: () => Promise.resolve(),
+  countdown: false,
+  modes: [
+    'video-audio',
+    'video-only',
+    'audio-only',
+    'picture'
+  ],
+  locale: {
+    strings: {
+      smile: 'Smile!'
+    }
+  }
+})
+```
+
+### `target: null`
+
+DOM element, CSS selector, or plugin to mount the informer into.
+
+### `countdown: false`
+
+When taking a picture: the amount of seconds to wait before actually taking a snapshot. If `false` or 0, the timeout is disabled entirely.
+This also shows a 'Smile!' message in the [Informer](/docs/informer) before the picture is taken.
+
+### `onBeforeSnapshot: () => Promise.resolve()`
+
+A hook function to call before a snapshot is taken. The Webcam plugin will wait for the returned Promise to resolve before taking the snapshot. This can be used to implement variations on the `countdown` option for example.
+
+### `modes: []`
+
+The types of recording modes to allow.
+
+ - `video-audio` - Record a video file, capturing both audio and video.
+ - `video-only` - Record a video file with the webcam, but don't record audio.
+ - `audio-only` - Record an audio file with the user's microphone.
+ - `picture` - Take a picture with the webcam.
+
+By default, all modes are allowed, and the Webcam plugin will show controls for recording video as well as taking pictures.
+
+### `locale: {}`
+
+There is only one localizable string: `strings.smile`. It's shown before a picture is taken, when the `countdown` option is set to true.