Page 2 of 2

Re: App Developer: USB Webcam Component

Posted: Thu Jun 11, 2026 12:26 pm
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).

Re: App Developer: USB Webcam Component

Posted: Thu Jun 11, 2026 2:16 pm
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 96 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 96 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.

Re: App Developer: USB Webcam Component

Posted: Thu Jun 11, 2026 4:42 pm
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".

Re: App Developer: USB Webcam Component

Posted: Thu Jun 11, 2026 9:55 pm
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

Re: App Developer: USB Webcam Component

Posted: Fri Jun 12, 2026 10:42 am
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.

Re: App Developer: USB Webcam Component

Posted: Fri Jun 12, 2026 11:04 am
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).