New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webcam: Add support for mobileNativeCamera option to Webcam and Dashboard #3844
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new options don't sound great to me with the import from
: "Import from Take Picture" doesn't make sense.
Do you think we can rename it to something better? Perhaps "Photo camera" & "Video camera" could work?
On my iPhone, "Take Picture" takes me to the video UI, and "Record Video" to the photo one 🙈 |
website/src/docs/webcam.md
Outdated
@@ -156,6 +157,12 @@ Set the preferred mime type for images, for example `'image/png'`. If the browse | |||
|
|||
If no preferred image mime type is given, the Webcam plugin will prefer types listed in the [`allowedFileTypes` restriction](/docs/uppy/#restrictions), if any. | |||
|
|||
### `mobileNativeCamera` | |||
|
|||
Replaces Uppy’s custom camera UI on mobile with “Take Picture” and/or “Record Video” buttons that open native device UI for pictures / video (`Function: boolean` || `boolean`, default: `isMobile()`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really "and/or"? Can you disable one or the other?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not currently, but since we allow that for the webcam plugin, I thought we need to mimic that functionality here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added modes
support, please take a look @Murderlon
Co-authored-by: Merlijn Vos <merlijn@soverin.net>
Co-authored-by: Merlijn Vos <merlijn@soverin.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also want to update the types:
export interface WebcamOptions extends PluginOptions { |
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Two options for the Dashboard (undocumented for now), one for Webcam. In theory if someone is building a mobile-only app, or if desktops start supporting camera UI, someone could use the Dashboard options without the Webcam plugin at all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I tried to add showNativePhotoCameraButton: true, showNativeVideoCameraButton: true
on the Dashboard option, but for some reason the Camera
button is still visible on my iPad (despite it not working). Shouldn't it be hidden if we are forcing the mobile UI?
BTW, I'm still unsure about this is-mobile
check, if it doesn't cover iPad use case, there's probably more it doesn't cover.
Yes, because this option is for the Webcam plugin, Dashboard option is a hidden thing, used by the Webcam plugin. You keep breaking my code! 😂 Correct usage with Webcam plugin: uppy.use(Webcam, {
mobileNativeCamera: true,
})
There’s an option to enable tablets, thank you for mentioning it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything else LGTM. Thanks @aduh95 for the device testings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There’s an option to enable tablets, thank you for mentioning it!
It looks like that by default, the iPad will request the "Desktop Website", and is-mobile
won't detect it as a tablet even with the last commit. However, if I manually select Request Mobile Website
, now it displays the correct option. Not perfect, but I doubt we can make a better default, so LGTM.
Also, using the correct option from the Webcam plugin does indeed work :) Should we rename the "internal" option to have a leading underscore to indicate it's meant to be internal only?
Co-authored-by: Merlijn Vos <merlijn@soverin.net>
Any chance we could address that? |
* '3.x' of https://github.com/transloadit/uppy: webcam: Add support for mobileNativeCamera option to Webcam and Dashboard (#3844)
| Package | Version | Package | Version | | ---------------------- | ------------ | ---------------------- | ------------ | | @uppy/aws-s3 | 3.0.0-beta.2 | @uppy/react | 3.0.0-beta.2 | | @uppy/aws-s3-multipart | 3.0.0-beta.2 | @uppy/remote-sources | 1.0.0-beta.2 | | @uppy/companion | 4.0.0-beta.2 | @uppy/store-redux | 3.0.0-beta.2 | | @uppy/compressor | 1.0.0-beta.2 | @uppy/transloadit | 3.0.0-beta.3 | | @uppy/core | 3.0.0-beta.2 | @uppy/webcam | 3.0.0-beta.2 | | @uppy/dashboard | 3.0.0-beta.2 | @uppy/xhr-upload | 3.0.0-beta.2 | | @uppy/image-editor | 2.0.0-beta.2 | @uppy/robodog | 3.0.0-beta.3 | | @uppy/locales | 3.0.0-beta.3 | uppy | 3.0.0-beta.3 | - @uppy/react: Fix exports in propTypes.js to fix website build (Murderlon) - @uppy/dashboard,@uppy/webcam: Add support for `mobileNativeCamera` option to Webcam and Dashboard (Artur Paikin / #3844) - @uppy/aws-s3-multipart: make `headers` part indexed too in `prepareUploadParts` (Merlijn Vos / #3895) - @uppy/aws-s3,@uppy/core,@uppy/dashboard,@uppy/store-redux,@uppy/xhr-upload: upgrade `nanoid` to v4 (Antoine du Hamel / #3904) - @uppy/companion: update minimal supported Node.js version in the docs (Antoine du Hamel / #3902) - @uppy/companion: upgrade `redis` to version 4.x (Antoine du Hamel / #3589) - @uppy/companion: remove unnecessary ts-ignores (Mikael Finstad / #3900) - meta: use `node:` protocol when using Node.js built-in core modules (Antoine du Hamel / #3871) - meta: upgrade to Vite v3 (Antoine du Hamel / #3882) - @uppy/companion: remove `COMPANION_S3_GETKEY_SAFE_BEHAVIOR` env variable (Antoine du Hamel / #3869) - meta: fix release script for major beta versions (Antoine du Hamel)
* 3.x: (32 commits) @uppy/screen-capture: fix TODOs (#3930) @uppy/status-bar: rename internal modules (#3929) @uppy/transloadit: remove static properties in favor of exports (#3927) @uppy/informer: simplify `render` method (#3931) @uppy/url: remove private methods from public API (#3934) @uppy/dashboard: change `copyToClipboard` signature (#3933) @uppy/drop-target: remove `isFileTransfer` from the public API (#3932) meta: improve beta release script Release: uppy@3.0.0-beta.3 (#3918) Release: uppy@2.13.1 (#3916) Fix exports in propTypes.js to fix website build @uppy/compressor: fix upload causing meta name to reset (#3890) @uppy/transloadit: cancel assemblies when all its files have been removed (#3893) Add retries for flaky e2e test (#3915) Fix `uppy.close()` crashes when remote-sources or image-editor is installed (#3914) webcam: Add support for mobileNativeCamera option to Webcam and Dashboard (#3844) aws-s3-multipart: make `headers` part indexed too in `prepareUploadParts` (#3895) Add missing type for retry-all event (#3901) Companion app type (#3899) e2e: upgrade to Cypress 10 (#3896) ...
| Package | Version | Package | Version | | ---------------------- | ------------ | ---------------------- | ------------ | | @uppy/aws-s3 | 3.0.0-beta.2 | @uppy/react | 3.0.0-beta.2 | | @uppy/aws-s3-multipart | 3.0.0-beta.2 | @uppy/remote-sources | 1.0.0-beta.2 | | @uppy/companion | 4.0.0-beta.2 | @uppy/store-redux | 3.0.0-beta.2 | | @uppy/compressor | 1.0.0-beta.2 | @uppy/transloadit | 3.0.0-beta.3 | | @uppy/core | 3.0.0-beta.2 | @uppy/webcam | 3.0.0-beta.2 | | @uppy/dashboard | 3.0.0-beta.2 | @uppy/xhr-upload | 3.0.0-beta.2 | | @uppy/image-editor | 2.0.0-beta.2 | @uppy/robodog | 3.0.0-beta.3 | | @uppy/locales | 3.0.0-beta.3 | uppy | 3.0.0-beta.3 | - @uppy/react: Fix exports in propTypes.js to fix website build (Murderlon) - @uppy/dashboard,@uppy/webcam: Add support for `mobileNativeCamera` option to Webcam and Dashboard (Artur Paikin / transloadit#3844) - @uppy/aws-s3-multipart: make `headers` part indexed too in `prepareUploadParts` (Merlijn Vos / transloadit#3895) - @uppy/aws-s3,@uppy/core,@uppy/dashboard,@uppy/store-redux,@uppy/xhr-upload: upgrade `nanoid` to v4 (Antoine du Hamel / transloadit#3904) - @uppy/companion: update minimal supported Node.js version in the docs (Antoine du Hamel / transloadit#3902) - @uppy/companion: upgrade `redis` to version 4.x (Antoine du Hamel / transloadit#3589) - @uppy/companion: remove unnecessary ts-ignores (Mikael Finstad / transloadit#3900) - meta: use `node:` protocol when using Node.js built-in core modules (Antoine du Hamel / transloadit#3871) - meta: upgrade to Vite v3 (Antoine du Hamel / transloadit#3882) - @uppy/companion: remove `COMPANION_S3_GETKEY_SAFE_BEHAVIOR` env variable (Antoine du Hamel / transloadit#3869) - meta: fix release script for major beta versions (Antoine du Hamel)
Desktop device:
Mobile device: