REVERSE-MORTGAGES.INFO

Big ttity components updating drm sexy

On PlayReady DRM, DRM Client requests a key from DRM license server with the initiator information directly. Media Pipeline gets the license key from DRM Client. The following diagram shows the operation flow of PlayReady DRM content playback.

The following introduces each component of the above diagram:

  • DRM Service
    DRM Service manages DRM Client instance and provides APIs to manage DRM Client.

  • Web App
    Web App requests Media Pipeline to play DRM content and sends DRM message (initiator information) to DRM client.

  • DRM Client
    DRM Client holds initiator information and gets a license key from License Server. Licensing error might occur during content playback via DRM Client.

  • Media Pipeline
    Media Pipeline gets the license key from DRM Client. Media Pipeline decrypts DRM content with license key and plays it.

  • Content Server
    Content Server stores and publishes DRM content.

  • License Server
    License Server manages rights and returns key for decryption.

The following sequence diagram shows PlayReady DRM playback process among the components.

PlayReady DRM playback sequence is described as below:

  1. Web app requests DRM Service to create DRM Client with load() method. The load() method requires DRM type and App ID.

  2. DRM Service creates DRM Client instance and returns its ID to Web App with a callback function.

  3. Web App uses sendDrmMessage() method to give a DRM message to DRM client. DRM message holds initiator information in DRM message format.

  4. DRM client verifies DRM message and returns the result with msgId. The msgId is used to identify subscription message of getRightsError() method.

  5. As licensing error might occur during content playback via DRM Client, web app needs to subscribe licensing error message with getRightsError() method.

  6. DRM client gets a license key from License Server.

  7. Web App gives a content target, DRM Client ID, and playback options to Media Pipeline with video element and mediaOption Parameter.

  8. Media Pipeline gets a license key from DRM Client.

  9. Media Pipeline decrypts DRM content stream with license key and plays the decrypted content stream.

  10. Callback function, registered by getRightsError() method for licensing error message, verifies message and handles errors during content playback.

  11. DRM Client must be removed with unload() method before unloading app.

Licensing error message is broadcasted to every subscribed app. Web app needs to check valid message with msgId which is given by sendDrmMessage() method.

You must unload DRM Client before:

  • Terminating app

  • Preparing to play other types of DRM content (for re-initialization).

To play PlayReady DRM content, you need to use LS API of DRM Service and mediaOption parameter. You can play PlayReady DRM content as follows:

1. Add the webOS library in your app to call DRM Service API.

// HTML Code ... <script type="text/javascript" src="lib/webOS.js"></script> ...

2. Call load() method when the app is loaded.

var appId = "com.yourdomain.yourapp"; // Define DRM Type var drmType = "playready"; var clientId; var isDrmClientLoaded; function loadDrmClient() { var request = webOS.service.request("luna://com.webos.service.drm", { method:"load", parameters: { "drmType": drmType, "appId": appId }, onSuccess: function (result) { clientId = result.clientId; isDrmClientLoaded= true; console.log("DRM Client is loaded successfully."); }, onFailure: function (result) { console.log("[" + result.errorCode + "] " + result.errorText); // Do something for error handling } }); }

3. Send DRM message (initiator information) with sendDrmMessage() method.

// Message example for playready var msg = '<?xml version="1.0" encoding="utf-8"?> <PlayReadyInitiator xmlns= "http://schemas.microsoft.com/DRM/2007/03/protocols/"> <LicenseAcquisition> <Header> <WRMHEADER xmlns= "http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" version="4.0.0.0"> <DATA> <PROTECTINFO> <KEYLEN>16</KEYLEN> <ALGID>AESCTR</ALGID> </PROTECTINFO> <LA_URL>http://playready.directtaps.net/pr/svc/rightsmanager.asmx</LA_URL> <KID>lFmb2gxg0Cr5bfEnJXgJeA==</KID> <CHECKSUM>P7ORpD2IpA==</CHECKSUM> </DATA> </WRMHEADER> </Header> <CustomData>AuthZToken XYZ</CustomData> </LicenseAcquisition> </PlayReadyInitiator>' var msgId; // Message type for PlayReady var msgType = "application/vnd.ms-playready.initiator+xml"; // Unique ID of DRM system var drmSystemId = "urn:dvb:casystemid:19219"; function sendRightInformation() { request = webOS.service.request("luna://com.webos.service.drm", { method:"sendDrmMessage", parameters: { "clientId": clientId, "msgType": msgType, "msg": msg, "drmSystemId": drmSystemId }, onSuccess: function (result) { msgId = result.msgId; var resultCode = result.resultCode; var resultMsg = result.resultMsg; console.log("Message ID: " + msgId); console.log("[" + resultCode + "] " + resultMsg); if (resultCode != 0){ // Do Handling DRM message error } }, onFailure: function (result) { console.log("[" + result.errorCode + "] " + result.errorText); } }); }

4. Subscribe licensing error message with getRightsError() method.

// JavaScript code var subscriptionHandler; ... function subscribeLicensingError() { var request = webOS.service.request("luna://com.webos.service.drm", { method:"getRightsError", parameters: { "clientId": clientId, "subscribe": true }, onSuccess: function (result) { // Subscription Callback contentId = result.contentId; if (contentId == msgId) { if ( 0 == result.errorState) { console.log("No license"); // Do something for error handling } else if ( 1 == result.errorState) { console.log("Invalid license"); // Do something for error handling } console.log("DRM System ID: " + result.drmSystemId); console.log("License Server URL: " + result.rightIssueUrl); } }, onFailure: function (result) { console.log("[" + result.errorCode + "] " + result.errorText); } }); //Register subscription handler subscriptionHandler = request; } ...

5. Create an object for mediaOption of video element and set the playback options.

// HTML code <video id="myVideo" ...> </video> // JavaScript code var options = {}; options.option = {}; options.option.drm = {}; options.option.drm.type = drmType; options.option.drm.clientId = clientId;

6. Convert the created object to JSON string and encode it.

var mediaOption = encodeURIComponent(JSON.stringify(options));

7. Create the source element

var source = document.createElement("source");

8. Add attributes to the created source element for media content. Add the encoded string to type attribute as below:

var dataURL = "http://example.com/test.mp4"; source.setAttribute('src', dataURL); source.setAttribute('type', 'video/mp4;mediaOption=' + mediaOption);

9. Add the created source element to video element or audio element.

video = document.getElementById('myVideo'); video.appendChild(source);

10. Call unload() method and cancel the subscription before terminating app or preparing to play other types of DRM content (for re-initialization).

// HTML Code ... <body onunload="unloadDrmClient()"> ... // JavaScript Code ... function unloadDrmClient() { if (isDrmClientLoaded) { var request = webOS.service.request("luna://com.webos.service.drm", { method:"unload", parameters: { "clientId": clientId }, onSuccess: function (result) { isDrmClientLoaded = false; console.log("DRM Client is unloaded successfully."); }, onFailure: function (result) { console.log("[" + result.errorCode + "] " + result.errorText); // Do something for error handling } }); // Cancel the subscription subscriptionHandler.cancel(); } }
http://webostv.developer.lge.com/develop/app-developer-guide/playing-drm-content/