AES-128 Keys
Getting Started
SpatialGen supports AES-128 encrypted HLS playback. This endpoint is in Beta and may change. Reach out to contact@spatialgen.com for Beta acce.
AES-128 Streaming Workflow
During playback, your app requests a content key through your server. Your server sends the video’s Asset ID to drm.spatialgen.com with your API key. Keep the API key on your server.
SpatialGen returns the content key as a base64 encoded string. Decode it into 16 raw bytes before passing it to the player. The IV is declared in the HLS playlist as defined in the HLS AES-128 spec.
Requesting Content Keys
POST /aes128/key
Send asset_id in a JSON body with your API key in the X-SPATIALGEN-APPKEY header. Your workspace must have DRM enabled. V2 API keys need the videos:read scope.
A successful request returns a JSON object containing the base64 encoded content key in the key field.
HLS players normally fetch keys with GET. Use Shaka request and response filters, or your server, to send this POST request and decode the JSON response for the player.
Example Request
// Example data to sendconst data = { asset_id: "<asset_id>"};
// Fetch call from your serverfetch('https://drm.spatialgen.com/aes128/key', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-SPATIALGEN-APPKEY': apiKey }, body: JSON.stringify(data)})Example Response
{ "key": "<base64 encoded content key>"}