How It Works — Theta Video Tech Stack

Every video on this page is uploaded, encoded, and delivered through Theta's decentralized infrastructure. No centralized CDN. No AWS. Pure edge.

📤 EdgeCloud Video API

Upload via POST to api.thetavideoapi.com. Theta edge nodes handle transcoding to HLS adaptive bitrate.

POST /video → upload_url
POST upload_url → video file
GET /video/{id} → playback_uri

🎬 HLS Adaptive Streaming

Videos are encoded to HLS (.m3u8 + .ts segments) and served from edge nodes. hls.js handles playback in browser.

hls.loadSource(m3u8_url)
hls.attachMedia(video)

🌐 Theta P2P SDK

Theta's JavaScript SDK enables peer-to-peer video delivery — viewers relay segments to each other, reducing server load.

theta = new Theta(video)
theta.config{peers:3}

🔐 Service Account Auth

Each video is tied to a service account (srvacc_xxx). Auth via x-tva-sa-id and x-tva-sa-secret headers.

x-tva-sa-id: srvacc_xxx
x-tva-sa-secret: xxx

⚡ Edge Node Network

Thousands of community-run edge nodes cache and serve video segments. Closest node wins — lower latency, lower cost.

media.thetavideoapi.com
/org_xxx/srvacc_xxx/video_xxx/master.m3u8

🪙 TFUEL Powered

Video encoding and delivery is paid in TFUEL. Edge node operators earn TFUEL for serving content. Decentralized economics.

upload cost: ~0.1 TFUEL
transcode: ~0.05 TFUEL
delivery: per GB served

Upload Your Own Video

Want your Theta-related video featured here? The upload pipeline is simple:

1

Request Upload URL

Swift Swap backend requests an upload URL from EdgeCloud Video API

POST https://api.thetavideoapi.com/video
2

Upload Video File

POST the raw video file to the returned upload URL

POST {upload_url} → video file bytes
3

Edge Nodes Transcode

Theta edge nodes automatically transcode to HLS adaptive bitrate (360p, 720p, 1080p)

status: processing → ready
4

Get Playback URL

Poll the video status. Once ready, you get an HLS playback URI served by edge nodes

GET /video/{id} → playback_uri (m3u8)
5

Embed & Play

Add the HLS URL to any video player with hls.js. Viewers get P2P delivery automatically.

hls.loadSource(playback_uri)
3
Videos Live
~10s
Each Duration
360p
Quality
0
Central Servers

Integration Code — Theta Video API

The actual code powering videos on this site. Open source, MIT licensed.

// 1. Upload a video to EdgeCloud
const uploadRes = await fetch('https://api.thetavideoapi.com/video', {
  method: 'POST',
  headers: {
    'x-tva-sa-id': SA_ID,
    'x-tva-sa-secret': SA_SECRET,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ name: 'Swift Swap Intro' })
});
const { body: { upload_uri, id } } = await uploadRes.json();

// 2. Upload the raw video file
await fetch(upload_uri, {
  method: 'POST',
  body: videoFile
});

// 3. Poll for completion
const check = await fetch(`https://api.thetavideoapi.com/video/${id}`, {
  headers: { 'x-tva-sa-id': SA_ID, 'x-tva-sa-secret': SA_SECRET }
});
const { body: { status, playback_uri } } = await check.json();

// 4. Play with hls.js
const hls = new Hls({ enableWorker: true });
hls.loadSource(playback_uri);
hls.attachMedia(videoElement);