-
-
Save philcluff/27737782cf474b6361570cbcce4e8d69 to your computer and use it in GitHub Desktop.
Signs URLs for a DRM'd asset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Mux = require('@mux/mux-node'); | |
const mux = new Mux(); | |
async function main() { | |
var args = process.argv.slice(2); | |
if (args.length != 1) { | |
console.log("Usage: node sign-url-drm.js PLAYBACK_ID"); | |
process.exit(1); | |
} | |
let playbackId = args[0]; | |
const playbackToken = await mux.jwt.signPlaybackId(playbackId, {expiration: '365d'}); | |
const drmLicenseToken = await mux.jwt.signDrmLicense(playbackId, {expiration: '365d'}); | |
const storyboardToken = await mux.jwt.signPlaybackId(playbackId, {type: "storyboard", expiration: '365d'}); | |
const thumbnailToken = await mux.jwt.signPlaybackId(playbackId, {type: "thumbnail", expiration: '365d'}); | |
console.log(`Playback Token: ${playbackToken}\n`); | |
console.log(`License Token: ${drmLicenseToken}\n`); | |
console.log(`Storyboard Token: ${storyboardToken}\n`); | |
console.log(`Thumbnail Token: ${thumbnailToken}\n`); | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment