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

# Playback Guide

> How to go from a library item or channel to a playable stream

Kernel always prefers direct play over transcoding. These endpoints tell you which one you're getting and hand you the right URL; you don't need to decide that yourself.

## On-demand (VOD)

<Steps>
  <Step title="Ask what playback method to use">
    ```bash theme={null}
    curl http://<server>:9014/watch/vod/<item_id>/play-info \
      -H "Device-ID: <device-id>" \
      -H "Device-Audio-Codecs: aac,ac3" \
      -H "Device-Audio-Channels: 6"
    ```

    ```json theme={null}
    {"method": "direct", "url": "/watch/vod/<item_id>/file", "format": "mkv"}
    ```

    `method` is `direct`, `remux`, `audio-only`, or `transcode`. `url` is already the right path to request next.
  </Step>

  <Step title="Play it">
    * **Direct play**: `GET` the returned `url` (`/file`). It's the raw file, with Range support for seeking.
    * **Transcoded**: `GET /watch/vod/<item_id>/master.mpd` (DASH, used by Roku/Android) or `/master.m3u8` (HLS, used by web) to start the transcode job and get a manifest. Segment requests that follow are served as ffmpeg produces them.
  </Step>
</Steps>

## Live TV

```bash theme={null}
curl http://<server>:9014/watch/live/<channel_id> \
  -H "Authorization: Bearer <jwt>" \
  -H "Device-Id: <device-id>" \
  -H "Device-OS: Roku OS"
```

* Web and most clients get back an HLS master playlist directly.
* Roku and Android (detected from `Device-OS`) get a `302` redirect to `/watch/live/<channel_id>/master.mpd`. These clients are DASH-only and will not play HLS.

## Resolving IDs

* `GET /libraries` then `GET /library/{id}` then item IDs for `GET /item/{id}`.
* `GET /channels` for channel IDs used in Live TV playback and `GET /programs` (EPG).

See the endpoint pages for full request/response schemas.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.