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

# Stream Media

> Stream audio or video content from decentralized storage protocols like Arweave and IPFS. This endpoint acts as a proxy that handles decentralized storage protocols and enables partial content streaming for media players.

**Supported URL formats:**
- `ar://` - Arweave URLs (e.g., `ar://abc123...`)
- `ipfs://` - IPFS URLs (e.g., `ipfs://Qm...`)
- `https://` - Direct HTTPS URLs

The endpoint supports HTTP Range headers for seeking within media files, returning `206 Partial Content` when range requests are supported by the origin.

<Note>
  This endpoint is **public** and does not require authentication.
</Note>

## Overview

The Media Stream API enables streaming audio and video content from decentralized storage protocols like Arweave and IPFS. It acts as a proxy that:

* Converts `ar://` and `ipfs://` URLs to fetchable gateway URLs
* Supports HTTP Range requests for seeking within media files
* Returns proper headers for audio and video players to function correctly

## Supported URL Formats

| Protocol | Format     | Example                         |
| -------- | ---------- | ------------------------------- |
| Arweave  | `ar://`    | `ar://abc123xyz...`             |
| IPFS     | `ipfs://`  | `ipfs://QmXyz...`               |
| HTTPS    | `https://` | `https://arweave.net/abc123...` |

## Range Request Support

The endpoint supports HTTP Range headers, allowing media players to seek to specific positions in the file. When a range request is made and supported by the origin:

* Returns `206 Partial Content` status
* Includes `Content-Range` header indicating the byte range
* Enables efficient streaming without downloading the entire file

## Example Usage

### Basic Audio Request

```bash theme={null}
curl "https://api.inprocess.world/api/media/stream?url=ar://your-arweave-tx-id"
```

### Basic Video Request

```bash theme={null}
curl "https://api.inprocess.world/api/media/stream?url=ipfs://QmYourVideoHash"
```

### With Range Header (for seeking)

```bash theme={null}
curl -H "Range: bytes=0-1023" \
  "https://api.inprocess.world/api/media/stream?url=ar://your-arweave-tx-id"
```

### In an HTML Audio Element

```html theme={null}
<audio controls>
  <source src="https://api.inprocess.world/api/media/stream?url=ar://your-arweave-tx-id" type="audio/mpeg">
</audio>
```

### In an HTML Video Element

```html theme={null}
<video controls>
  <source src="https://api.inprocess.world/api/media/stream?url=ipfs://QmYourVideoHash" type="video/mp4">
</video>
```


## OpenAPI

````yaml GET /media/stream
openapi: 3.1.0
info:
  title: In•Process API
  description: >-
    The In•Process API enables browsing and managing moments from timelines.
    Retrieve moments from a specific artist's timeline, browse the in•process
    collective timeline, or filter by collection. The API supports creating
    moments, managing collections, handling payments, and interacting with the
    In•Process protocol ecosystem.
  version: 1.0.0
servers:
  - url: https://api.inprocess.world/api
    description: Production server
security: []
paths:
  /media/stream:
    get:
      summary: Stream Media
      description: >-
        Stream audio or video content from decentralized storage protocols like
        Arweave and IPFS. This endpoint acts as a proxy that handles
        decentralized storage protocols and enables partial content streaming
        for media players.


        **Supported URL formats:**

        - `ar://` - Arweave URLs (e.g., `ar://abc123...`)

        - `ipfs://` - IPFS URLs (e.g., `ipfs://Qm...`)

        - `https://` - Direct HTTPS URLs


        The endpoint supports HTTP Range headers for seeking within media files,
        returning `206 Partial Content` when range requests are supported by the
        origin.
      operationId: streamMedia
      parameters:
        - name: url
          in: query
          description: >-
            The URL of the media file to stream. Supports Arweave (`ar://`),
            IPFS (`ipfs://`), and HTTPS URLs.
          required: true
          schema:
            type: string
          examples:
            arweave:
              summary: Arweave URL
              value: ar://abc123xyz...
            ipfs:
              summary: IPFS URL
              value: ipfs://QmXyz...
            https:
              summary: HTTPS URL
              value: https://arweave.net/abc123...
      responses:
        '200':
          description: Full media content returned
          headers:
            Content-Type:
              description: The MIME type of the media content (e.g., audio/mpeg, video/mp4)
              schema:
                type: string
                example: audio/mpeg
            Content-Length:
              description: The size of the media content in bytes
              schema:
                type: integer
            Accept-Ranges:
              description: Indicates that the server accepts range requests
              schema:
                type: string
                example: bytes
            Cache-Control:
              description: Caching directive for the response
              schema:
                type: string
                example: public, max-age=31536000, immutable
          content:
            audio/*:
              schema:
                type: string
                format: binary
            video/*:
              schema:
                type: string
                format: binary
        '206':
          description: Partial content returned (for range requests)
          headers:
            Content-Type:
              description: The MIME type of the media content
              schema:
                type: string
                example: audio/mpeg
            Content-Length:
              description: The size of the partial content in bytes
              schema:
                type: integer
            Content-Range:
              description: The range of bytes being returned
              schema:
                type: string
                example: bytes 0-1023/10240
            Accept-Ranges:
              description: Indicates that the server accepts range requests
              schema:
                type: string
                example: bytes
          content:
            audio/*:
              schema:
                type: string
                format: binary
            video/*:
              schema:
                type: string
                format: binary
        '400':
          description: Invalid or unsupported URL format
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Invalid or unsupported URL format
        '500':
          description: Server error while streaming media
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Failed to stream media
        '502':
          description: Unable to fetch from origin or determine content length
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                status: error
                message: Unable to determine content length
      security: []
components:
  schemas:
    Error:
      type: object
      required:
        - status
        - message
      properties:
        status:
          type: string
          enum:
            - error
          description: Error status
        message:
          type: string
          description: Error message
        errors:
          type: array
          description: >-
            Optional array of field-level validation errors. Typically included
            in 400 Bad Request responses for validation errors.
          items:
            type: object
            required:
              - field
              - message
            properties:
              field:
                type: string
                description: The field name that failed validation
              message:
                type: string
                description: The validation error message for this field

````