Skip to content

AVCaptureSessionInterruptEvent ​

AVCaptureSessionInterruptEvent represents the system interrupting a capture session.

The interrupt event of AVCaptureSession is this class, and reason is why it was interrupted.

It belongs to the @nacrejs/av-capture package; for installation, see AVCaptureSession.

Inheritance: Event → AVCaptureSessionInterruptEvent

Constructor ​

AVCaptureSessionInterruptEvent()

Creates a AVCaptureSessionInterruptEvent. 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.

PropertyDescription
reason read-onlyWhy it was interrupted

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 ​

ObjectEvents
AVCaptureSessioninterrupt

It can't be canceled: cancelable is false, and preventDefault() has no effect.

Examples ​

js
const session = new AVCaptureSession();
session.addEventListener('interrupt', (e) => {
  console.log(e instanceof AVCaptureSessionInterruptEvent, e.reason);
});

Effect: when the session is interrupted, prints true and the reason. Not verified on a device.

Corresponding iOS API ​

ObjCJS
AVCaptureSessionWasInterruptedNotificationThe interrupt event
userInfo[AVCaptureSessionInterruptionReasonKey]event.reason
AVCaptureSessionInterruptionReasonVideoDeviceInUseByAnotherClient'videoDeviceInUseByAnotherClient', and likewise for the rest

See also ​