Skip to main content

Playback

Public playback

Use the worker URL:

https://worker.antcdn.net/v1/{edgeKey}/master.m3u8

Private playback (JWT)

For private videos, generate a JWT on your backend and append it as a query param:

https://worker.antcdn.net/v1/{edgeKey}/master.m3u8?jwt={jwt}

See /docs/video-playback-controls/private-videos for the full flow and signing examples.

HLS.js example

<video id="v" controls playsinline></video>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<script>
(async () => {
// Fetch a playback URL (or JWT) from YOUR backend after you validate the user.
const res = await fetch(`/api/playback-url?edgeKey=${encodeURIComponent(EDGE_KEY)}`);
const { playbackUrl } = await res.json();
const v = document.getElementById('v');
if (Hls.isSupported()) {
const hls = new Hls();
hls.loadSource(playbackUrl);
hls.attachMedia(v);
} else {
v.src = playbackUrl;
}
})();
</script>