Skip to content
Docs
Get early access

Quickstart

Upload a lesson, wait for it to be ready, and play it in your app.

This guide takes a lesson from a file on disk to playback in a web page. It uses curl so every request is visible; any HTTP client works the same way.

You’ll need an API key with the write scope (see Authentication):

Terminal · environment
export WIREVOD_API="https://api.wirevod.online"
export WIREVOD_KEY="wvk_…"
  1. Create an asset. An asset represents one lesson. Set drm to true to enable content protection; this choice is permanent for the asset.

    Request
    curl -X POST "$WIREVOD_API/v1/assets" \
    -H "X-API-Key: $WIREVOD_KEY" \
    -H "Content-Type: application/json" \
    -d '{"title": "Lecture 1 — Introduction", "drm": false}'
    Response · 201
    {
    "asset": {
    "id": "6f1c2a9e-…",
    "title": "Lecture 1 — Introduction",
    "status": "pending",
    "drm_enabled": false
    }
    }
  2. Start an upload with the exact file size in bytes.

    Request
    curl -X POST "$WIREVOD_API/v1/uploads" \
    -H "X-API-Key: $WIREVOD_KEY" \
    -H "Content-Type: application/json" \
    -d '{"asset_id": "6f1c2a9e-…", "size_bytes": 40109312}'

    The response tells you how to split the file and gives you one upload URL per part:

    Response · 201
    {
    "upload": {
    "id": "a41e7c03-…",
    "part_size": 16777216,
    "part_count": 3,
    "parts": [
    { "number": 1, "url": "https://…" },
    { "number": 2, "url": "https://…" },
    { "number": 3, "url": "https://…" }
    ]
    }
    }
  3. Upload each part with a PUT of its bytes to its URL. Part n starts at byte (n − 1) × part_size; the last part holds the remainder.

    Terminal
    split -b 16777216 -d -a 3 lecture1.mp4 part_
    curl -X PUT --upload-file part_000 "https://…part-1-url…"

    Part URLs are valid for one hour. Interrupted? See resuming uploads.

  4. Complete the upload. WireVoD verifies the parts and starts preparing the lesson.

    Request
    curl -X POST "$WIREVOD_API/v1/uploads/a41e7c03-…/complete" \
    -H "X-API-Key: $WIREVOD_KEY" \
    -H "Content-Type: application/json" -d '{}'
  5. Wait until it’s ready. Poll the asset until status is ready (or failed, with a failure_code).

    Request
    curl "$WIREVOD_API/v1/assets/6f1c2a9e-…" -H "X-API-Key: $WIREVOD_KEY"
  6. Create a playback session when a learner opens the lesson, after your own access checks.

    Request
    curl -X POST "$WIREVOD_API/v1/playback/sessions" \
    -H "X-API-Key: $WIREVOD_KEY" \
    -H "Content-Type: application/json" \
    -d '{"asset_id": "6f1c2a9e-…", "ttl_seconds": 3600}'

    Return the response to the learner’s browser. It contains everything the player needs.

  7. Play it with WirePlayer:

    lesson.html
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/video.js@8.24.1/dist/video-js.min.css" />
    <video id="lesson" class="video-js" playsinline></video>
    <script src="https://cdn.jsdelivr.net/npm/video.js@8.24.1/dist/video.min.js"></script>
    <script src="https://wirevod.online/player/v0.1.0/wireplayer.min.js"></script>
    <script>
    new WireVoD.WirePlayer("lesson", {
    source: { session: () => fetch("/api/lessons/1/session").then((r) => r.json()) },
    });
    </script>
  • Protect paid lessons with content protection. WirePlayer handles it automatically.
  • End access when a subscription lapses: /v1/playback/sessions/{id}.
  • Handle failures gracefully with error codes and limits.