---
title: Configure video playback
description: Navigation quality, TypeScript SDK example and recorded choice for the movies benchmark.
sidebar:
  label: Streaming
---

**KPI** · Watch probability plus purchase probability.

![Navigation score by prior navigations per World.](/docs/benchmarks/industry-movies.png)

## After 1,000 navigations per World

Spacefolder chose the highest-value action on **82 of 96** held-out navigations.

| Approach | Expected utility | Score / 100 |
| --- | ---: | ---: |
| Spacefolder | 0.792 | 98.13 |
| Vector search + SQL for matching situations¹ | 0.792 | 98.13 |
| SQL for all situations¹ | 0.767 | 79.38 |
| First listed action | 0.506 | 3.68 |
| Ground truth | 0.792 | 100.00 |

¹ Stack analogies. The replay averaged each action’s outcomes in memory, grouping by exact situation for the first baseline and pooling all situations for the second.

## TypeScript SDK example

[TypeScript SDK](/docs/reference/sdks#typescript-and-javascript) · [Navigate API](/docs/reference/api/navigate/navigate)

```ts
import { SpacefolderClient } from "@spacefolder/sdk";

const sf = new SpacefolderClient();
const navigation = await sf.navigate({
  nav_id: crypto.randomUUID(),
  world_id: "movies_example",
  entity_type: "viewer_session",
  entity_id: "user_123",
  context: { scene: "Returning viewer on a living-room TV" },
  actions: {
    no_action: {"name": "decision.configuration_retained", "data": {}},
    enable_autoplay: {"name": "experience.trailer_autoplay_set", "data": {"enabled": 1}},
    enable_preload: {"name": "experience.player_preload_set", "data": {"enabled": 1}},
  },
  predictions: {
    watch: {"event": "movie_watched", "horizon": "1h"},
    purchase: {"event": "movie_purchased", "horizon": "1h"},
  },
});

let chosen: string | undefined;
let best = -Infinity;
for (const action of ["no_action", "enable_autoplay", "enable_preload"] as const) {
  const watch = navigation.actions?.[action]?.predictions.watch;
  if (!watch || !("probability" in watch) || typeof watch.probability !== "number") continue;
  const purchase = navigation.actions?.[action]?.predictions.purchase;
  if (!purchase || !("probability" in purchase) || typeof purchase.probability !== "number") continue;
  const utility = watch.probability + purchase.probability;
  if (utility > best) {
    best = utility;
    chosen = action;
  }
}
console.log(JSON.stringify({ chosen }, null, 2));
```

## Example output

**Returning viewer on a living-room TV**

```json
{
  "chosen": "enable_preload"
}
```

Apply the chosen player configuration for the viewer session. Record subsequent watch and purchase events against the same session.
