> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sdk.anghami.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Soundtrack

> Bidirectional cross-content linking between music and video — the unique Anghami + OSN+ value proposition.

`SoundtrackService` is what makes the combined Anghami + OSN+ catalog interesting. It's a bidirectional bridge between songs and video content:

| Direction     | RPC                    | Returns                                         |
| ------------- | ---------------------- | ----------------------------------------------- |
| Video → Songs | `GetSoundtrack`        | The list of songs featured in a show or movie.  |
| Song → Video  | `GetAssociatedContent` | The shows and movies that feature a given song. |

Both operations are paginated, accessible with API key or OAuth, and idempotent.

## GetSoundtrack — "what's the soundtrack of this show?"

Given a show or movie identifier, return the songs featured in it. The request takes the raw ID plus a `content_type` (`CONTENT_TYPE_SHOW` or `CONTENT_TYPE_MOVIE`) so the server knows which catalog to look in.

```ts theme={null}
const res = await soundtrack.getSoundtrack({
  contentId: "movie_42",
  contentType: ContentType.CONTENT_TYPE_MOVIE,
  pageSize: 50,
});

for (const entry of res.entries) {
  console.log(entry.song.title, entry.song.artist?.name);
}
```

Each entry is a song reference plus context — typically the scene or position where the song appears. The exact context fields depend on the data available for that title.

## GetAssociatedContent — "where else is this song featured?"

Given a `SongID`, return the shows and movies that feature it.

```ts theme={null}
const res = await soundtrack.getAssociatedContent({
  songId: "song_99",
  pageSize: 20,
});

for (const item of res.entries) {
  // item.content is a Content wrapper — branch on the oneof id arm
}
```

Useful UX: from a song's "now playing" view, surface "as heard in…" with a link into the show or movie page.

## Why this exists

Most music APIs are music-only. Most video APIs are video-only. The cross-content surface is what differentiates Anghami + OSN+ — and it's the data foundation for experiences like:

* "Play the soundtrack" CTA on a movie detail page.
* "As heard in…" on a song detail page.
* Recommendation flows that bridge the two catalogs.

## Performance

* The data is sparse — many titles don't have soundtrack metadata, and many songs don't have associated content. Both endpoints handle this gracefully (empty result sets, not errors).
* Treat soundtrack data as slow-moving; cache aggressively.
