Skip to content

Record Processing


To record the scanning process, use:

DocReader.shared.functionality.recordScanningProcess = true
DocReader.shared.functionality.recordScanningProcessDelegate = self
[RGLDocReader shared].functionality.recordScanningProcess = YES;
[RGLDocReader shared].functionality.recordScanningProcessDelegate = self;

func recordingOutputFileURL() -> URL

Asks the delegate for a URL to use for the output file.

func recordingOutputFileURL() -> URL {
    let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
    return paths[0].appendingPathComponent("")
- (NSURL *)recordingOutputFileURL {
    NSArray *paths = [[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask];
    return [paths[0] URLByAppendingPathComponent:@""];

func didFinishRecording(URL)

Tells the delegate that the recording is finished and a URL of the output file can be obtained.

func didFinishRecording(toFile fileURL: URL) {
    print("didFinishRecording: \(fileURL.absoluteURL)")
- (void)didFinishRecordingToFile:(NSURL *)fileURL {
    NSLog(@"didFinishRecording: %@", [fileURL absoluteURL]);

func didFailWithError(Error)

Tells the delegate that an error has appeared.

func didFailWithError(_ error: Error) {
    print("didFailWithError: \(error.localizedDescription)")
- (void)didFailWithError:(NSError *)error {
    NSLog(@"didFailWithError: %@", [error localizedDescription]);

Timestamp on Recorded Video

If the document recognition is recorded, you can add the timestamp to the saved video. The timestamp is not displayed during the document processing.


Be aware that this feature consumes too much memory. This may lead to unexpected behavior if you set the resolution to high, for example, 4K.

By default, the timestamp is not added to the recorded video.

To display the timestamp in the recorded video, follow the steps:

  1. Enable recordScanningProcess parameter.
  2. Create RGLRecordingTimestampConfig configuration object.
  3. Optionally, change the config object's properties.
  4. Set the config object to recordingTimestampConfig property.

See the following example.

let timestampConfig = RGLRecordingTimestampConfig()

timestampConfig.position = .topRight
timestampConfig.backgroundColor = .purple
timestampConfig.textColor = .white
timestampConfig.textFont = .boldSystemFont(ofSize: 50)
timestampConfig.dateTimeFormat = "E, d MMM yyyy HH:mm:ss Z"
timestampConfig.timezoneName = "GMT+0"  

DocReader.shared.functionality.recordingTimestampConfig = timestampConfig
RGLRecordingTimestampConfig *timestampConfig = [[RGLRecordingTimestampConfig alloc] init];

timestampConfig.position = RGLRecordingTimestampPositionTopRight;
timestampConfig.backgroundColor = [UIColor purpleColor];
timestampConfig.textColor = [UIColor whiteColor];
timestampConfig.textFont = [UIFont boldSystemFontOfSize:50.0];
timestampConfig.dateTimeFormat = @"E, d MMM yyyy HH:mm:ss Z";
timestampConfig.timezoneName = @"GMT+0";

RGLDocReader.shared.functionality.recordingTimestampConfig = timestampConfig;

You can adjust the timestamp's appearance by the parameters as follows in the table.

Parameter Description Available values
position relative position of the timestamp on the video frame
  • top left
  • top right
  • bottom left
  • bottom right
background color color of the rectangle, where timestamp is displayed see the UIColor data type
text color color of the main text of the timestamp's font see the UIColor data type
text font style and typeface of the timestamp's font see the UIFont data type
date and time format textual format of date and time representation string formatted according to the NSDateFormatter data type
time zone name of the time zone in accordance with the tz database see the most recent official IANA Time Zone Database

The default parameters of the recordingTimestampConfig are as follows:

  • Position — bottom right
  • Background — transparent
  • Font — system, 16pt, bold, white color
  • Date and time format — "yyyy-MM-dd, HH:mm:ss"


To record the scanning process, use:

private final VideoEncoderCompletion videoEncoderCompletion;
//in constructor:
this.videoEncoderCompletion = new VideoEncoderCompletion();
private class VideoEncoderCompletion implements IVideoEncoderCompletion { ... }
// set up completion
private var videoEncoderCompletion: VideoEncoderCompletion? = null
//in constructor:
videoEncoderCompletion = VideoEncoderCompletion()
private class VideoEncoderCompletion : IVideoEncoderCompletion { ... }
// set up completion


As we use a weak reference to handle the callback object, into setVideoEncoderCompletion, you should put an object with a life cycle longer than the method life cycle. For example, you can create a variable and put it into the method.

Flutter, React Native, Ionic, Cordova

To record the scanning process, use:

DocumentReader.instance.functionality.recordScanningProcess = true;
DocumentReader.instance.videoEncoderCompletion = (filePath) {
    recordScanningProcess: true
}, (str) => { console.log(str) }, (error) => { console.log(error) });
    recordScanningProcess: true
    recordScanningProcess: true
}, function (m) { }, function (e) { console.log(e); });


To record the scanning process, use:

// Android
// implementation:
private class VideoEncoderCompletion : IVideoEncoderCompletion { ... }

private VideoEncoderCompletion videoEncoderCompletion = new VideoEncoderCompletion();

// set up completion

// iOS
RGLDocReader.Shared.Functionality.RecordScanningProcess = true;
RGLDocReader.Shared.Functionality.RecordScanningProcessDelegate = this;


NSUrl recordingOutputFileURL()

Asks the delegate for a URL to use for the output file:

NSUrl recordingOutputFileURL()
    NSUrl[] paths = NSFileManager.DefaultManager.GetUrls(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomain.User);
    return paths[0].Append("", false);

didFinishRecordingToFile(NSUrl fileURL)

Tells the delegate that the recording is finished and a URL of the output file can be obtained:

void didFinishRecordingToFile(NSUrl fileURL)
    Console.WriteLine("didFinishRecording: " + fileURL.AbsoluteUrl);

didFailWithError(NSError error)

Tells the delegate that an error has appeared:

void didFailWithError(NSError error)
    Console.WriteLine("didFailWithError: " + error.LocalizedDescription);

Next Steps