App Developer: USB Webcam Component

Post here to discuss any new features, components, chips, etc, that you would like to see in Flowcode.
Steve-Matrix
Matrix Staff
Posts: 1936
http://meble-kuchenne.info.pl
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 289 times
Been thanked: 452 times

Re: App Developer: USB Webcam Component

Post by Steve-Matrix »

I think that saving a file from a web app will always save to the Downloads folder (otherwise a website could compromise the local file system).

The attached is a small improvement. There is a new WebCamera fcpx component, and the ".fcweb" file is an example that sets the aspect ratio of the snapshot image to the same as the video and also saves the image (to the "Downloads" folder).
Attachments
WebCamera.fcpx
(3.32 KiB) Downloaded 25 times
WebCamera.fcweb
(18.79 KiB) Downloaded 24 times

stefan.erni
Valued Contributor
Posts: 1251
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 231 times
Been thanked: 250 times

Re: App Developer: USB Webcam Component

Post by stefan.erni »

it's working very nice

The buttons can also be placed in the image, also the photo you've taken can be smal in the imagel.
2026-06-11_15-00-09.PNG
2026-06-11_15-00-09.PNG (912.25 KiB) Viewed 428 times
To save the photo immediately, all I have to do is enter the macro command.

Autosave:
2026-06-11_14-08-24.PNG
2026-06-11_14-08-24.PNG (80.17 KiB) Viewed 428 times
The files are perfect.

I have a small problem with the time—it's showing two hours too early, and I haven't been able to find a setting to fix it.

Steve-Matrix
Matrix Staff
Posts: 1936
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 289 times
Been thanked: 452 times

Re: App Developer: USB Webcam Component

Post by Steve-Matrix »

Thanks, Stefan.

The date is UTC. Here is some code that will hopefully set the filename to the local time. This will replace the code int he first icon in the OnSaveImageClick macro.

Code: Select all

var currentdate = new Date(); 

//adjust for local time
var offset = currentdate.getTimezoneOffset();
currentdate.setTime(currentdate.getTime() - (offset*60*1000));

FCL_SFILENAME = currentdate.toISOString();

FCL_SFILENAME = FCL_SFILENAME.replaceAll("T", "_");
FCL_SFILENAME = FCL_SFILENAME.replaceAll(":", "-");
FCL_SFILENAME = FCL_SFILENAME.substring(0, 19);
FCL_SFILENAME = "PIC_" + FCL_SFILENAME + ".png"

The new lines are the 2 after the comment "adjust for local time".

chipfryer27
Valued Contributor
Posts: 2008
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 441 times
Been thanked: 656 times

Re: App Developer: USB Webcam Component

Post by chipfryer27 »

Hi Steve / Stefan

Very interesting posts.

Keen to hear more on how you get on as I think this will be a great component once released.

Regards

stefan.erni
Valued Contributor
Posts: 1251
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 231 times
Been thanked: 250 times

Re: App Developer: USB Webcam Component

Post by stefan.erni »

Hi Steve, Hi Lain

Yes, that's a useful feature and it works well.
The time is correct now.

It would also be helpful if I could send a command from the PC App to the Web App to take the photo.
Both programs are running on the same computer.

Steve-Matrix
Matrix Staff
Posts: 1936
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 289 times
Been thanked: 452 times

Re: App Developer: USB Webcam Component

Post by Steve-Matrix »

This may not be possible due to the way web browser security works. Activity such as using the camera and saving files cannot be automatic and must be initiated via a user gesture (e.g. a mouse click).

stefan.erni
Valued Contributor
Posts: 1251
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 231 times
Been thanked: 250 times

Re: App Developer: USB Webcam Component

Post by stefan.erni »

Hi Steve

If two cameras are connected, would it also be possible to choose which one to use?

Would it also be possible to record a video?
Only about 60 seconds long.

Steve-Matrix
Matrix Staff
Posts: 1936
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 289 times
Been thanked: 452 times

Re: App Developer: USB Webcam Component

Post by Steve-Matrix »

I think when the web app asks for permission, you can choose the camera then.

I have just created a project which records and saved a video, so yes it can. But it has thrown up various issues. I will try to allocate some time to fix these issues over the next few days.

stefan.erni
Valued Contributor
Posts: 1251
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 231 times
Been thanked: 250 times

Re: App Developer: USB Webcam Component

Post by stefan.erni »

Hi Steve

Firefox ask for permission, and which camera
2026-06-17_08-25-28.PNG
2026-06-17_08-25-28.PNG (17.03 KiB) Viewed 62 times
Edge ask for permission, but not for which camera
2026-06-17_08-26-09.PNG
2026-06-17_08-26-09.PNG (20.08 KiB) Viewed 62 times
For the Edge The camera you can choose if you type in edge line_
edge://settings/content/camera
I added a second camera to the Web App
So I can use 2 cameras at the same time

“Record Video” will be missing soon :)
2026-06-17_08-51-35.PNG
2026-06-17_08-51-35.PNG (537.35 KiB) Viewed 62 times

Post Reply