mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-25 03:08:34 +00:00
* Allow definition of MediaRecorder mimeType This PR introduces a new option for the `@uppy/webcam` plugin called `preferredMimeType` which defaults as `null`. If a value is passed, the browser's `MediaRecorder` implementation checks if the `preferredMimeType` is supported, and if it thinks it is, will attempt to record using the `preferredMimeType` rather than the browser default. If the `preferredMimeType` is unsupported, the browser will fall back to using its default recording mime type. This allows, for example, a user to pass `preferredMimeType: "video/webm"` during the `@uppy/webcam` plugin construction which will instruct the browser to record to a `.webm` container. Specific codecs may also be passed here. For example, `video/webm;codecs=vp8` may still parse as valid by the browser. ## Limitations This does not currently change the mime type for captured images on line 282 (`image/jpeg`) and will only pass the `preferredMimeType` to the browser `MediaRecorder` API. ### Reference https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/MediaRecorder https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/isTypeSupported https://cs.chromium.org/chromium/src/third_party/blink/web_tests/fast/mediarecorder/MediaRecorder-isTypeSupported.html?q=MediaRecorder-isTypeSupported&dr https://www.webmproject.org/about/faq/ * Constantize preferredMimeType * Lint fix * Change option name to preferredVideoMimeType * One more preferredVideoMimeType * Update comment * docs: add preferredVideoMimeType |
||
|---|---|---|
| .. | ||
| src | ||
| types | ||
| LICENSE | ||
| package.json | ||
| README.md | ||
@uppy/webcam
The Webcam plugin for Uppy lets you take photos and record videos with a built-in camera on desktop and mobile devices.
Uppy is being developed by the folks at Transloadit, a versatile file encoding service.
Example
const Uppy = require('@uppy/core')
const Webcam = require('@uppy/webcam')
const uppy = Uppy()
uppy.use(Webcam, {
mirror: true,
facingMode: 'user'
})
Installation
$ npm install @uppy/webcam --save
We recommend installing from npm and then using a module bundler such as Webpack, Browserify or Rollup.js.
Alternatively, you can also use this plugin in a pre-built bundle from Transloadit's CDN: Edgly. In that case Uppy will attach itself to the global window.Uppy object. See the main Uppy documentation for instructions.
Documentation
Documentation for this plugin can be found on the Uppy website.