AVCaptureSessionRuntimeErrorEvent
AVCaptureSessionRuntimeErrorEvent represents an error during capture.
The runtimeerror event of AVCaptureSession is this class, and error is the error the system gave.
It belongs to the @nacrejs/av-capture package; for installation, see AVCaptureSession.
Inheritance: Event → AVCaptureSessionRuntimeErrorEvent
Constructor
AVCaptureSessionRuntimeErrorEvent()
Creates a AVCaptureSessionRuntimeErrorEvent. The runtime creates one itself when it fires the events below; app code can use it to build an event object and fire it with dispatchEvent() to try out a listener.
Instance properties
Also inherits the properties of Event; the most commonly used are type and target. The properties below are read-only; assigning to them throws TypeError.
| Property | Description |
|---|---|
error read-only | The error the system gave |
These properties live on the prototype, not on the event object itself: Object.keys(event) and { ...event } don't include them, so read them one by one. See Events with fields.
Events that use this class
| Object | Events |
|---|---|
AVCaptureSession | runtimeerror |
It can't be canceled: cancelable is false, and preventDefault() has no effect.
Examples
const session = new AVCaptureSession();
session.addEventListener('runtimeerror', (e) => {
console.log(e instanceof AVCaptureSessionRuntimeErrorEvent, e.error instanceof NSError);
});Effect: when capture fails, prints true true. Not verified on a device: this event couldn't be triggered.
Corresponding iOS API
| ObjC | JS |
|---|---|
AVCaptureSessionRuntimeErrorNotification | The runtimeerror event |
userInfo[AVCaptureSessionErrorKey] | event.error |
See also
runtimeerror: when it is firedNSError