mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-21 01:15:35 +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 |
||
|---|---|---|
| .. | ||
| CameraIcon.js | ||
| CameraScreen.js | ||
| index.js | ||
| PermissionsScreen.js | ||
| RecordButton.js | ||
| SnapshotButton.js | ||
| style.scss | ||
| supportsMediaRecorder.js | ||
| supportsMediaRecorder.test.js | ||