Skip to content
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

Merged
merged 12 commits into from Jul 27, 2022

Conversation

arturi
Copy link
Contributor

@arturi arturi commented Jun 22, 2022

Desktop device:

localhost_3000_

Mobile device:

localhost_3000_ (1)

@arturi arturi requested review from Murderlon, aduh95 and nqst and removed request for Murderlon June 22, 2022 20:00
Copy link
Contributor

@nqst nqst left a 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?

packages/@uppy/webcam/src/Webcam.jsx Outdated Show resolved Hide resolved
@aduh95
Copy link
Member

aduh95 commented Jul 6, 2022

On my iPhone, "Take Picture" takes me to the video UI, and "Record Video" to the photo one 🙈

@arturi arturi changed the base branch from main to 3.x July 11, 2022 13:14
packages/@uppy/dashboard/src/components/AddFiles.jsx Outdated Show resolved Hide resolved
@@ -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()`).
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

website/src/docs/webcam.md Outdated Show resolved Hide resolved
arturi and others added 2 commits July 18, 2022 12:52
Co-authored-by: Merlijn Vos <merlijn@soverin.net>
Co-authored-by: Merlijn Vos <merlijn@soverin.net>
Copy link
Member

@aduh95 aduh95 left a 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 {

arturi and others added 2 commits July 21, 2022 11:03
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
@arturi arturi requested a review from aduh95 July 21, 2022 13:30
@arturi
Copy link
Contributor Author

arturi commented Jul 21, 2022

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.

Copy link
Member

@aduh95 aduh95 left a 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.

@aduh95
Copy link
Member

aduh95 commented Jul 21, 2022

Here’s how it looks when I have the options set to true:

1DB2B280-191D-40CA-ADB1-3DAD6D5962C5

And here’s what I see if I click on Camera:

B3EC9D3B-A990-4667-B01F-6F1E938E4B7C

"Take Picture" and "Record Video" both work as expected, but they don't appear by default (probably because the iPad is not a mobile).

@arturi
Copy link
Contributor Author

arturi commented Jul 21, 2022

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,
})

iPad

There’s an option to enable tablets, thank you for mentioning it!

Copy link
Member

@Murderlon Murderlon left a 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.

website/src/docs/webcam.md Outdated Show resolved Hide resolved
Copy link
Member

@aduh95 aduh95 left a 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>
@arturi arturi merged commit a7a4bd0 into 3.x Jul 27, 2022
@arturi arturi deleted the mobile-webcam branch July 27, 2022 09:52
@nqst
Copy link
Contributor

nqst commented Jul 27, 2022

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?

Any chance we could address that?

Murderlon added a commit that referenced this pull request Jul 27, 2022
* '3.x' of https://github.com/transloadit/uppy:
  webcam: Add support for mobileNativeCamera option to Webcam and Dashboard (#3844)
github-actions bot added a commit that referenced this pull request Jul 27, 2022
| 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)
Murderlon added a commit that referenced this pull request Aug 2, 2022
* 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)
  ...
HeavenFox pushed a commit to docsend/uppy that referenced this pull request Jun 27, 2023
| 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants