This project implements a secure, token-based license delivery system for a DRM-enabled live video stream using AWS MediaLive with key rotation and Axinom DRM.
The overall architecture:
AWS MediaLive channel is set up with key rotation enabled.
A Lambda function receives CPIX requests via API Gateway, extracts the Key IDs, and stores them in DynamoDB.
This service retrieves the latest Key IDs from DynamoDB, builds entitlement messages, and signs them to produce valid license tokens using a communication key.
EntitlementGenerator.js
: Generates the entitlement message with the new keyIDs.Shaka.html
: Player.dynamodbClient.js
: Connects to DynamoDB (contains access credentials) and fetches Key IDs.secrets.json
: Stores the communication key and the key ID.tokenGenerator.js
: Generates and signs the DRM license token.
-
Run
npm install
-
Add IAM user credentials to
dynamodbClient.js
-
Start the license service(License generator):
node token-generator-service/index.js
-
Open the player:
If using Visual studio Live Server plugin:
- Run the shaka.html with Visual studio Live Server plugin.
If using IIS :
- Player will be opened in your server URL/Shaka.html.
- Your token generator service URL needs to be changed in the
tokenGenerator()
function in theshaka.html
-
Lambda Function (for SPEKE Proxy)
-
Lambda IAM user (to allow writing to DynamoDB)
-
API Gateway (fronts the Lambda function for MediaLive)
-
IAM user to access the DynamoDB (for accessing DynamoDB from this service)
-
Dynamo DB (stores key_id and created_at)
-
Cloud watch (for Lambda logging)
-
MediaPackage IAM role
-
Media Package (for HLS stream delivery)
-
Media Live (generates the HLS stream with key rotation)
-
Input for Media Live
Further Documentation: