AVCaptureMetadataOutput() constructor
The AVCaptureMetadataOutput() constructor creates an output that recognizes things such as codes and faces in the picture.
Syntax
new AVCaptureMetadataOutput()Parameters
None.
Return value
A new AVCaptureMetadataOutput. Right after creation:
metadataObjectTypesis an empty array, so nothing is recognized.availableMetadataObjectTypesis an empty array (verified by testing). It only has content after the output is added to a session that has a camera connected.rectOfInterestis the whole picture,(0, 0, 1, 1)(verified by testing).
Exceptions
TypeError
- Subclassing it:
class Mine extends AVCaptureMetadataOutput {}throws onnew Mine(), with a message starting withIllegal constructor.
Description
The order of use is fixed: first add a camera input to the session, then add this output with addOutput(), and only then write metadataObjectTypes. In the reverse order, writing metadataObjectTypes throws TypeError.
Examples
js
const output = new AVCaptureMetadataOutput();
console.log(output.metadataObjectTypes.length, output.availableMetadataObjectTypes.length);Effect: The console prints 0 0.
Corresponding iOS API
[[AVCaptureMetadataOutput alloc] init].
See also
metadataObjectTypes: what to recognizedetect: something was recognizedaddOutput(): add the output to a session- Installing
@nacrejs/av-capture