uppy/packages/@uppy/webcam/src
Dave Kiss d5b45a82ff Allow definition of MediaRecorder mimeType (#1708)
* 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
2019-07-08 12:14:53 +02:00
..
CameraIcon.js Accessibility follow-up PR: make all svgs not focusable in IE11 (#1662) 2019-06-17 17:08:05 +03:00
CameraScreen.js Feature/accessibility (#1507) 2019-06-11 19:10:32 +03:00
index.js Allow definition of MediaRecorder mimeType (#1708) 2019-07-08 12:14:53 +02:00
PermissionsScreen.js tweak Webcam permission screen copy 2018-07-27 22:43:10 -04:00
RecordButton.js Accessibility follow-up PR: make all svgs not focusable in IE11 (#1662) 2019-06-17 17:08:05 +03:00
SnapshotButton.js Feature/accessibility (#1507) 2019-06-11 19:10:32 +03:00
style.scss Organize color variables (now they're without color- prefix 2019-04-10 11:12:21 +03:00
supportsMediaRecorder.js Move Webcam to @uppy/webcam. 2018-06-14 16:31:19 +02:00
supportsMediaRecorder.test.js webcam: fix supportsMediaRecorder test 2019-05-20 11:27:04 +02:00