Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

AVRecorder.CaptureStillPhoto

Captures a still image.

Component Version macOS Windows Linux Server iOS SDK
AVRecorder 6.2 ✅ Yes ✅ Yes ❌ No ❌ No ✅ Yes
MBS( "AVRecorder.CaptureStillPhoto"; AVSession { ; FileName } )   More

Parameters

Parameter Description Example Flags
AVSession The ID for the AVRecorder session as returned by AVRecorder.Init. $AVSession
FileName The file name for the jpeg image. "still.jpg" Optional

Result

Returns image or error.

Description

Captures a still image.
The image is returned a JPEG image as container value on Mac and BMP on Windows.
Added Windows support with plugin version 6.5.

May require running the preview for some time as we capture only current preview frame on Windows. If no frame is yet available, the function returns an error.

If you need content detection, you can always get current frame with AVRecorder.CaptureStillPhoto and pass it to OCR.SetImage for text recognition or Barcode.Detect to find different barcodes.

Examples

Init and Capture photo:

#Start session
Set Variable [$capture; Value:MBS( "AVRecorder.Init" )]
#Pick first video device
Set Variable [$r; Value:MBS( "AVRecorder.SetVideoDevice"; $capture; 0 )]
#Start preview
Set Variable [$r; Value:MBS("AVRecorder.StartPreview"; $capture)]
#Wait a bit to have camera get up and running
Pause/Resume Script [Duration (seconds): ,5]
#Take a picture
Set Variable [$r; Value:MBS( "AVRecorder.CaptureStillPhoto"; $capture )]
#Put in container
Set Field [test::Test; $r]
#Cleanup
Set Variable [$r; Value:MBS( "AVRecorder.Release"; $capture )]

Take picture and store it in record:

Set Variable [ $image ; Value: MBS( "AVRecorder.CaptureStillPhoto"; $$SessionID) ]
# state of last function in same script: 0 = no error, 1 = got error
If [ MBS("IsError") ]
    Show Custom Dialog [ "Sorry" ; $image ]
    Exit Script [ Text Result: ]
End If

If [ not IsEmpty ( LiveStream::Image ) ]
    New Record/Request
End If
Set Field [ LiveStream::Image ; $image ]
Set Field [ LiveStream::Description ; "Webcam" ]
Commit Records/Requests [ With dialog: Off ]

See also

Release notes

Example Databases

Blog Entries

This function checks for a license.

Created 2nd May 2016, last changed 9th March 2022


AVRecorder.CanPerformReactionEffects - AVRecorder.ClosePreview