Sub CaptureVideo
Try
SetState(openstate, True, VideoMode)
If cam.RecordingVideo = False Then
mSubs.ActMode = mSubs.eMode.Record
cam.StartVideoRecording (MyTaskIndex)
Else
cam.StopVideoRecording (MyTaskIndex)
File.Copy(mSubs.VideoFileDir, "temp-" & mSubs.VideoFileName, mSubs.VideoFileDir, mSubs.VideoFileName)
'ToastMessageShow($"Video file saved: $1.2{File.Size(mSubs.VideoFileDir, mSubs.VideoFileName) / 1024 / 1024} MB"$, True)
Wait For (PrepareSurface) Complete (Success As Boolean)
SetState(openstate, False, VideoMode)
End If
Catch
HandleError(LastException)
End Try
End Sub