# Session replay

Record user sessions for replay in Screeb, and start or stop the recording from your code when the workspace settings are not enough.

Session replay records what users see and do in your app, Screeb surveys and messages included, so you can watch the session in the Screeb admin. Once the SDK is installed, you turn it on and choose when recording starts in the workspace settings: see [Configure session replay recording](https://help.screeb.app/observe/session-replay-settings/). No code is needed for that.

Write code only when the start conditions of the settings cannot express your case, for example to record a checkout flow from its first step.

## Start and stop the recording

Starting the recording fails when session replay is off in the workspace settings.

```ts
import { Component } from "@angular/core";
import { Screeb } from "@screeb/sdk-angular";

@Component({
  selector: "app-checkout-replay",
  template: `
    <button (click)="start()">Start recording</button>
    <button (click)="stop()">Stop recording</button>
  `,
})
export class CheckoutReplayComponent {
  constructor(private screeb: Screeb) {}

  async start() {
    await this.screeb.sessionReplayStart();
  }

  async stop() {
    await this.screeb.sessionReplayStop();
  }
}
```

> [!NOTE]
> Session replay is off, and cannot be turned on, while the workspace runs in consent exemption mode: see [Consent exemption](https://developers.screeb.app/sdk-angular/consent-exemption).

## Privacy

Mask or exclude sensitive elements with the [Privacy helpers](https://developers.screeb.app/sdk-angular/privacy-helpers), and see [Session replay privacy](https://help.screeb.app/observe/session-replay-privacy/) for the workspace options.
