> 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/video-recording-video-grabacion/resultados.md).

# Results

Results provided by the Video Provider component.

The Video Provider component will record the user's interaction with the widgets it contains. This recording can be retrieved after the capture process by making a request to a URL.

***

## How to retrieve the recording of the extraction

### Remote recording (default)

Once the extraction process is complete, the recorded video will be provided as a blob file from a URL `blob` (`string`).

The following variables must be configured to retrieve the generated video:

* Operation ID: ID generated and provided by the SDK Provider. It can be obtained from the `emitOperationId` or `emitData`.
* Video Recording API Key: API Key required by Video Provider. Provided by the Facephi team.
* Video Recording URL: URL from which the recorded video will be downloaded. Provided by the Facephi team.

#### How to retrieve the generated video

The API key must be added to the request header:

```javascript
fetch('https://example.url/operation-id-value', { headers: { 'x-api-key': process.env.VIDEO_RECORDING_APIKEY } });
```

#### Video request example

```javascript
const apiKey = process.env.VIDEO_PROVIDER_APIKEY; // Secret key provided by the Facephi team
const videoRecordingUrl = 'https://example.url'; // URL provided by the Facephi team
const operationId = 'operation-id-value'; // Value obtained from the emitOperationId event

function fetchVideo() {
  const url = `${videoRecordingUrl}/${operationId}`;

  fetch(url, {
    headers: {
      'x-api-key': apiKey,
    },
  })
    .then((response) => response.text())
    .then((data) => {
      console.log('Generated video:', data); // The recorded video blob will be provided as a URL (string)
    });
}
```

> If the generated video is too short (less than two seconds), or if the request is made too soon after the extraction process finishes, the request may fail.

***

### Local recording

<pre class="language-javascript"><code class="lang-javascript">// Stop the video recording once the extraction process has finished.
const facephiSelphiWidget = document.getElementById("facephiSelphiWidget");
<strong>facephiSelphiWidget.addEventListener("extractionFinish", handleSelphiExtractionFinish);
</strong>function handleSelphiExtractionFinish(event) {
  const facephiVideoProvider = document.getElementById("facephiVideoProvider");
  const videoBlob = facephiVideoProvider.stopVideo();
}
</code></pre>

Examples of how to use the video:

```javascript
const videoBlob = await videoProvider.stopVideo();

if (videoBlob instanceof Blob) {
  // Play the video
  const videoUrl = URL.createObjectURL(videoBlob);
  const videoElement = document.createElement('video');
  videoElement.src = videoUrl;
  videoElement.controls = true;
  document.body.appendChild(videoElement);

  // Download the video
  const link = document.createElement('a');
  link.href = videoUrl;
  link.download = 'recording.mp4';
  link.click();
}
```
