> For the complete documentation index, see [llms.txt](https://docs.facephi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.facephi.com/docs.facephi-en/sdks/sdk-web/componentes/selphi-biometria-facial/eventos/stabilizing.md).

# stabilizing

## Details

It is emitted on each frame while the stabilization process is active.

**Event:** `stabilizing`

**Type:** `FacephiSelphiWidgetCustomEvent<StabilizingEvent>` | `CustomEvent<StabilizingEvent>`

### Syntax

```typescript
selphi.addEventListener('stabilizing', onStabilizing);
```

### Received object

The useful payload is of type `SelphiStabilizingDetail` and is in `event.detail.detail`:

* `eventType` (`string`): Type of event emitted.
* `diagnostic` (`number`): Stabilization code for the current frame.

**Stabilization codes `diagnostic`**:

| ID   | Name                           | Description                                                  |
| ---- | ------------------------------ | ------------------------------------------------------------ |
| `1`  | OK                             | Stabilization phase passed.                                  |
| `2`  | NotStabilized                  | The user must remain still and facing forward.               |
| `3`  | NotStabilizedTooFar            | The user must be within the predefined area.                 |
| `4`  | NotStabilizedSunGlasses        | Occlusions on the face prevent detection.                    |
| `5`  | NotStabilizedTooClose          | The user must move farther away to avoid optical distortion. |
| `6`  | NotStabilizedTooMovement       | The user does not remain still.                              |
| `8`  | NotStabilizedNoFrontal         | Face not centered (generic incorrect posture).               |
| `9`  | NotStabilizedNoFrontalTooLeft  | Face turned too far to the left.                             |
| `10` | NotStabilizedNoFrontalTooRight | Face turned too far to the right.                            |
| `11` | NotStabilizedNoFrontalTooDown  | Face tilted too far down.                                    |
| `12` | NotStabilizedNoFrontalTooUp    | Face tilted too far up.                                      |
| `13` | NoStabilizedNoColor            | Color image with insufficient color.                         |
| `14` | NotStabilizedLowQuality        | Low image quality.                                           |
| `15` | NotStabilizedLowFaceQuality    | Low face quality.                                            |
| `16` | NotStabilizedLowPatternQuality | Poor pattern.                                                |
| `17` | OkGlasses                      | Stabilization passed with glasses.                           |
| `18` | NotStabilizedInvalidResolution | Invalid resolution (720 or 480 expected).                    |
| `19` | NotStabilizedMask              | Does not pass stabilization due to wearing a mask.           |

## Description

Reports the result of each stabilization attempt. When the widget returns `OK` or `OkGlasses`, it moves on to the next step before extraction.

### Considerations

Only emitted if [stabilization](/docs.facephi-en/sdks/sdk-web/componentes/selphi-biometria-facial/propiedades/stabilization.md) is enabled. The useful payload is in `event.detail.detail` (see [event format](/docs.facephi-en/sdks/sdk-web/componentes/selphi-biometria-facial/eventos.md#formato-de-los-eventos)).

***

## Example

```jsx
<facephi-selphi-widget
    onStabilizing={(event) => {
      const { diagnostic } = event.detail.detail;
      console.log('Stabilizing diagnostic:', diagnostic);
    }}
/>
```

```typescript
import { type SelphiStabilizingDetail } from '@facephi/sdk-web-wc';

selphi.addEventListener('stabilizing', (event) => {
  const detail: SelphiStabilizingDetail = event.detail.detail;
});
```
