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: 1930
http://meble-kuchenne.info.pl
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 286 times
Been thanked: 448 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 11 times
WebCamera.fcweb
(18.79 KiB) Downloaded 12 times

stefan.erni
Valued Contributor
Posts: 1246
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 230 times
Been thanked: 247 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 95 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 95 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: 1930
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 286 times
Been thanked: 448 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: 440 times
Been thanked: 655 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: 1246
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 230 times
Been thanked: 247 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: 1930
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 286 times
Been thanked: 448 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).

Post Reply