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

AVRecorder.Init

Starts a new recording session.

Component Version macOS Windows Linux Server iOS SDK
AVRecorder 6.1 ✅ Yes ✅ Yes ❌ No ❌ No ✅ Yes
MBS( "AVRecorder.Init" )

Parameters

none

Result

Returns OK or error.

Description

Starts a new recording session.
You need to call init to get a new session ID which is needed for all other AVRecorder calls.
Please call AVRecorder.Release when you are done with recording.

Examples

Initialize and pick first camera:

Set Variable [ $$SessionID ; Value: MBS("AVRecorder.Init") ]
If [ MBS("IsError") ]
    Show Custom Dialog [ "Sorry" ; $$SessionID ]
    Exit Script [ Text Result: ]
End If

If [ MBS("AVRecorder.VideoDeviceCount"; $$SessionID) = 0 ]
    Show Custom Dialog [ "Please buy a camera" ]
    Exit Script [ Text Result: ]
End If

# pick first camera
Set Variable [ $r ; Value: MBS("AVRecorder.SetVideoDevice"; $$SessionID; 0) ]

Enumerate audio and video devices:

# init
Set Variable [$recorder; Value:MBS("AVRecorder.Init")]
Delete All Records [No dialog]
# audio
Set Variable [$count; Value:MBS("AVRecorder.AudioDeviceCount"; $recorder)]
If [$count > 0]
    Set Variable [$index; Value:0]
    Loop
        # next
        New Record/Request
        Set Field [AVRecorder Devices::Index; $index]
        Set Field [AVRecorder Devices::ID; MBS("AVRecorder.AudioDeviceInfo"; $recorder; $index; "ID")]
        Set Field [AVRecorder Devices::Name; MBS("AVRecorder.AudioDeviceInfo"; $recorder; $index; "Name")]
        Set Field [AVRecorder Devices::Description; MBS("AVRecorder.AudioDeviceInfo"; $recorder; $index; "Description")]
        If [MBS("SystemInfo.isMacOSX")]
            Set Field [AVRecorder Devices::Manufacturer; MBS("AVRecorder.AudioDeviceInfo"; $recorder; $index; "manufacturer")]
            Set Field [AVRecorder Devices::ModelID; MBS("AVRecorder.AudioDeviceInfo"; $recorder; $index; "modelID")]
            Set Field [AVRecorder Devices::TransportType; MBS("AVRecorder.AudioDeviceInfo"; $recorder; $index; "transportType")]
            Set Field [AVRecorder Devices::Connected; MBS("AVRecorder.AudioDeviceInfo"; $recorder; $index; "connected")]
            Set Field [AVRecorder Devices::inUseByAnotherApplication; MBS("AVRecorder.AudioDeviceInfo"; $recorder; $index; "inUseByAnotherApplication")]
            Set Field [AVRecorder Devices::suspended; MBS("AVRecorder.AudioDeviceInfo"; $recorder; $index; "suspended")]
        End If
        Set Field [AVRecorder Devices::Type; "Audio"]
        Commit Records/Requests []
        Set Variable [$index; Value:$index + 1]
        Exit Loop If [$count = $index]
    End Loop
End If
# video
Set Variable [$count; Value:MBS("AVRecorder.VideoDeviceCount"; $recorder)]
If [$count > 0]
    Set Variable [$index; Value:0]
    Loop
        # next
        New Record/Request
        Set Field [AVRecorder Devices::Index; $index]
        Set Field [AVRecorder Devices::ID; MBS("AVRecorder.VideoDeviceInfo"; $recorder; $index; "ID")]
        Set Field [AVRecorder Devices::Name; MBS("AVRecorder.VideoDeviceInfo"; $recorder; $index; "Name")]
        Set Field [AVRecorder Devices::Description; MBS("AVRecorder.VideoDeviceInfo"; $recorder; $index; "Description")]
        If [MBS("SystemInfo.isMacOSX")]
            Set Field [AVRecorder Devices::Manufacturer; MBS("AVRecorder.VideoDeviceInfo"; $recorder; $index; "manufacturer")]
            Set Field [AVRecorder Devices::ModelID; MBS("AVRecorder.VideoDeviceInfo"; $recorder; $index; "modelID")]
            Set Field [AVRecorder Devices::TransportType; MBS("AVRecorder.VideoDeviceInfo"; $recorder; $index; "transportType")]
            Set Field [AVRecorder Devices::Connected; MBS("AVRecorder.VideoDeviceInfo"; $recorder; $index; "connected")]
            Set Field [AVRecorder Devices::inUseByAnotherApplication; MBS("AVRecorder.VideoDeviceInfo"; $recorder; $index; "inUseByAnotherApplication")]
            Set Field [AVRecorder Devices::suspended; MBS("AVRecorder.VideoDeviceInfo"; $recorder; $index; "suspended")]
        End If
        Set Field [AVRecorder Devices::Type; "Video"]
        Commit Records/Requests []
        Set Variable [$index; Value:$index + 1]
        Exit Loop If [$count = $index]
    End Loop
End If
# cleanup
Set Variable [$r; Value:MBS("AVRecorder.Release"; $recorder)]

See also

Release notes

  • Version 7.2
    • Fixed a bug in AVRecorder.Init to work better if no video device is found.

Example Databases

Blog Entries

This function checks for a license.

Created 9th February 2016, last changed 24th February 2022


AVRecorder.HasQRCode - AVRecorder.IsRecording