-
Notifications
You must be signed in to change notification settings - Fork 34
Custom Handlers
Ingan121 edited this page Sep 6, 2025
·
5 revisions
- Vineless supports writing your own handler for processing the license generation and key parsing
- Write a JS file to
lib/customhandlers/<handler_name>.jswith the following content:
export default class YourCustomHandlerName {
constructor(host, keySystem, sessionId, tab) {
this.host = host;
this.keySystem = keySystem;
this.sessionId = sessionId;
this.tab = tab;
}
async generateChallenge(pssh, extra) {
const { serverCert } = extra;
// your challenge generation handler here
// this.session = new SomeInternalHandler();
// const challenge = await this.session.generateChallenge(pssh);
return challenge; // base64-encoded challenge data to return
}
async parseLicense(license) {
// license: base64-encoded license data
// your license parsing logic here
// const keys = await this.session.parseLicense(body);
return {
type: "WIDEVINE", // or "PLAYREADY" or "CLEARKEY"
pssh: "AAAAXHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAADwSEDAvgN1BHkiGvKW7H4AYoCQSEDAvgN1BHkiGvKW7H4AYoCQSEDAvgN1BHkiGvKW7H4AYoCRI88aJmwY=",
keys: [{
kid: "9eb4050de44b4802932e27d75083e266",
k: "166634c675823c235a4a9446fad52e4d"
}]
}
}
}- In
lib/customhandlers/main.js, import your handler and put it into theCustomHandlersobject.
import YourCustomHandlerName from "./yourhandler.js"
export const CustomHandlers = {
"hardcoded": { /* ... */ },
"yourhandler": {
"name": "Your Custom Handler's Name",
"description": "Your Custom Handler's Description",
"handler": YourCustomHandlerName, // the imported handler class
"for": "widevine", // or "playready", omit for both
"disabled": false // true hides it from the list
}
};