Google Cast CAF Receiver and DRM + Bearer Token

Viewed 740

I've created a custom receiver app for some DRM-enabled videos on an Azure Media Server, but I have to get a bearer token first. Which I do, and I have sent as customData in the sender request. I've also created a class to process the MPEG-DASH Manifest and get the License Acquisition URL. Here is what I have, in part.

/** variable declaration, for
 * CastReceiverContext, PlaybackConfig, PlayerManager, etc....
 */

playerManager.setMediaPlaybackInfoHandler((loadRequest, playbackConfig) => {
    if (loadRequest.media.customData && loadRequest.media.customData.bearerToken {
        bearerToken = loadRequest.media.customData.bearerToken;
    }
});

playbackConfig.manifestHandler = (manifestString) => {
    const mh = DashManifestParser(manifestString);
    const licenseUrl = mh.licenseAcquisitionUrl();
    if (licenseUrl) {
        playbackConfig.licenseUrl = licenseUrl;
    }
};

playbackConfig.licenseRequestHandler = (request) => {
    console.log("I AM REQUESTING THE LICENSE NOW. WATCH THIS. NO, REALLY!");
};

How do I get this to be processed as part of the DRM request? I can't actually find the right place to inject the bearer token into the license acquisition URL. I understand that at this point, I need to send a request to https://thestacks.keydelivery.eastus.media.azure.net/Widevine/?kid=28ab28d4-ecca-fake-ckid-801ba72c1fe8 with the bearer token. I assume this is done by the receiver app automatically, but it's not. Even playbackConfig.licenseRequestHandler is never being called. I assume that even if my function fails to do what it's supposed to, I'd see an obnoxious log in the debugger -- but nothing shows up but an eventual error around 40s in: {"shakaErrorCode":6006,"shakaErrorData":["Generate request failed."]}

2 Answers

This is usually up to player framework vendor: whether and how the API is provided to insert bearer token string. Inside the player framework, it translates the bearer token into "Authorization" header in the HTTPS request for DRM license or AES decryption key. We should not assume that every player framework provides this and it works. For example, the following player frameworks now provides this and works:

  1. Azure Media Player
  2. Akamai Media Player
  3. JWPlayer
  4. ExoPlayer

Regards, William

I got DRM widevine working on my CAF3 custom receiver by using Akamai Media Player (AMP)

Related