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

how to remember the selected video source for setting as next default source while using Webcam? #4436

Open
2 tasks done
carlshe opened this issue May 2, 2023 · 3 comments
Labels

Comments

@carlshe
Copy link

carlshe commented May 2, 2023

Initial checklist

  • I understand this is a feature request and questions should be posted in the Community Forum
  • I searched issues and couldn’t find anything (or linked relevant results below)

Problem

If there are more than one camera with PC, some one will be selected as video source. How to get the source currently selected, so that it can be stored in web stoarge, and be read for setting the default source for next use?

Solution

The best way is to add a new option to tell Uppy to remember the selected video source and to recover it as initial source for next use.

Alternatives

Expose two functions, one for getting currently selected video source, and anoth is for setting selected video source.

Or there are some similar functions existing.

@carlshe carlshe changed the title how to remember the selected video source for setting as next default source how to remember the selected video source for setting as next default source while using Webcam? May 2, 2023
@arturi arturi removed the Triage label May 7, 2023
@arturi
Copy link
Contributor

arturi commented May 7, 2023

I see how this could be useful, but I believe for rather rare use cases, so unfortunately I don't think we'll be able prioritize this anytime soon.

If you'd like to PR this, what could be done is store the chosen device in plugin optionsm and then it can be remembered / manipulated outside of uppy via uppy.getPlugin('Webcam').setOptions({ device: 'MyLogitechCam' }).

@carlshe
Copy link
Author

carlshe commented May 7, 2023

arturi, thank you very much!

I can read the currently select video source using following code on event 'file-added':
let vs=$('.uppy-Webcam-videoSource-select');let curSelected= vs.val();

But in what an event I can set the device initially? I tried the following code right after the construction of uppy.
let vs2 = $('.uppy-Webcam-videoSource-select'); vs2.val('18c7032a9b7aa1f93ef65ac9cd30566f8b08dfcf7a2e5f0787e600aeda101512');
But vs2 seems always null, that means the select element has not been created yet.

I also tried the code you presented right after the uppy is constructed, just like
uppy.getPlugin('Webcam').setOptions({ device: 'Surface Camera Rear' });.
But it has no effect, too. I did found that the device value is appended to the options of Webcam.

Could please give more guide?
Thanks again!

@arturi
Copy link
Contributor

arturi commented May 10, 2023

I was thinking out loud about how we can design the way to achieve what you want, there's no way to setOptions the selected device right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants