setCapturerFromFile
method configures K21 to process an existing video (.mp4) or image (.png) file instead of capturing from screen. This is useful when you want to analyze pre-recorded content.
Usage
CaptureFromFileConfig Interface
The configuration object requires the following parameter:Parameter | Type | Required | Description |
---|---|---|---|
file | string | Yes | Path to the file to be processed. Must be either .mp4 or .png |
Supported File Types
- Video files (
.mp4
) - Image files (
.png
)
Examples
Process a Video File
Process a Screenshot
Error Handling
The method will throw an error in these cases:- If a screen capturer is already set
- If the file path is not provided
- If the file type is not supported (must be .mp4 or .png)
- If the file path is invalid
Important Notes
- You cannot use
setCapturerFromFile
if you’ve already set a screen capturer usingsetCapturer
- The file must exist and be accessible when the method is called
- Make sure you have appropriate permissions to read the file