VOD (on demand)

One file in, every quality out.

A video is created before its file exists, so its address is settled first. This page covers creating one, sending the file, what comes out, private playback and what is counted.

01

Create the video

An asset is one video. It exists before the file does: the address it will play at is settled when you create it, so you can put that address in a page while the upload is still running.

Create an asset
curl -X POST https://dash.yunzheng.space/api/v1/vod/assets \
  -H "Authorization: Bearer $ORBIT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"title":"Launch keynote","visibility":"unlisted"}'
FieldWhat it sets
titleWhat the video is called. Up to 200 characters.
visibilitypublic, unlisted (default) or private. Only private requires a signed address.
tagsYours to find things by. They are not published with the video.
descriptionOptional. Up to 2000 characters.
unlisted means the address cannot be guessed. It is not access control: anybody who has the address can watch. private is the setting that is.
02

Send the file

Three calls: say how big the file is, send each part, then say you are finished. The declared size is required and it is checked on completion — a file that does not match what was declared is refused rather than half-transcoded.

Begin, send, complete
B=https://dash.yunzheng.space/api/v1/vod/assets/$ID

curl -X POST $B/upload \
  -H "Authorization: Bearer $ORBIT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"size":734003200,"content_type":"video/mp4"}'
# -> {"upload_id":"ovu_...","part_size":8388608}

split -b 8388608 video.mp4 part-
n=1; for f in part-*; do
  curl -X PUT $B/upload/$UPLOAD_ID/parts/$n \
    -H "Authorization: Bearer $ORBIT_TOKEN" --data-binary @$f
  n=$((n+1))
done

curl -X POST $B/upload/$UPLOAD_ID/complete \
  -H "Authorization: Bearer $ORBIT_TOKEN"
# -> {"asset_id":"ovd_...","job_id":"ovj_..."}

Each part is answered with the list of parts that have landed, so an upload that is interrupted resumes by sending only what is missing. Parts may be sent in any order; the size of every part except the last one has to be the part_size you were given.

The console does exactly this. Dropping a file onto the VOD page sends the same three calls, shows a bar as the parts go, and offers Resume on the part that failed.
03

What comes out

One HLS ladder per video: the resolution you uploaded, and the standard sizes below it, up to as many as your pack allows. Video is H.264 and audio is AAC at 128 kbit/s, cut into six-second pieces with independent_segments set, which is what lets a player change quality without interrupting the picture.

PackHighest qualityQualities per video
Free720p2
Pro1080p4
Business2160p (4K)6
Unlimited2160p (4K)6
Nothing is scaled up. A 720p file on the Business pack still tops out at 720p — the ceiling is a ceiling, not a target.

A poster is taken from the first frame, and a later frame is used instead when the first one is close to black. reprocess makes the ladder again from the original file, which is what to use after a pack change; the current ladder keeps playing until the new one is finished.

Ask for the qualities that exist
curl https://dash.yunzheng.space/api/v1/vod/assets/$ID/renditions \
  -H "Authorization: Bearer $ORBIT_TOKEN"
04

Play it

A public or unlisted video plays at one address, and it does not change:

The playback address and the poster
https://vod.yunzheng.space/a/<asset_id>/master.m3u8
https://vod.yunzheng.space/a/<asset_id>/poster.jpg

Any player that speaks HLS takes that address. Ours adds a quality menu, picture-in-picture and a statistics panel, and it is two lines:

Embed the player
<script src="https://vod.yunzheng.space/v1.js"></script>
<div id="p"></div>
<script>
  OrbitPlayer.mount(document.getElementById('p'), {
    src: 'https://vod.yunzheng.space/a/<asset_id>/master.m3u8',
    vod: true, latency: 'standard'
  })
</script>

A private video is refused at that address. Ask for a signed one instead; it carries an expiry and a signature, and it stops answering when the expiry passes.

A signed address, for an hour
curl -X POST https://dash.yunzheng.space/api/v1/vod/assets/$ID/playback \
  -H "Authorization: Bearer $ORBIT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"ttl_s":3600}'
# -> {"master_url":"https://vod.yunzheng.space/a/ovd_.../master.m3u8?exp=...&sig=...",
#     "expires_at":"..."}

To sign in your own backend instead — one link per viewer, with no round trip to us — hold a playback key. The secret is shown once, at creation, and cannot be read back afterwards; revoking a key stops every link already signed with it, including one a viewer has open.

Playback keys
curl -X POST   https://dash.yunzheng.space/api/v1/vod/keys -H "Authorization: Bearer $ORBIT_TOKEN"
curl           https://dash.yunzheng.space/api/v1/vod/keys -H "Authorization: Bearer $ORBIT_TOKEN"
curl -X DELETE https://dash.yunzheng.space/api/v1/vod/keys/$KEY_ID -H "Authorization: Bearer $ORBIT_TOKEN"
05

What is counted

LimitMeaning
Videoshow many assets you may have at once
Storagethe original file plus every quality made from it, and the poster
Transcoding a monthminutes of video encoded, counted once per quality
Delivery a monthwhat left the edge towards viewers
Highest qualitythe ceiling the ladder is built to, per pack
Qualities per videohow many rungs the ladder may have

Deleting a video gives the storage back at once, and the address stops answering in the same moment. A reprocess is counted again, because it is another encode.

Usage is on the VOD page of the console beside the library, against what your packs allow, and in GET /v1/account/quota under the same names.
Next

Related

Getting started

How an Orbit account is organised, what lives where in the console, and the shortest path from signing in to serving a name from our network.

DNS hosting

Add a zone, point your registrar at our name servers, manage records: weighted answers, health-checked records, ALIAS at the apex, zone-file import.

Connect a hostname

Delegate the whole domain, delegate one hostname, or add a CNAME and leave your DNS where it is. What each one costs you and when to pick it.

← All documentation