- From: Joe Steele <steele@adobe.com>
- Date: Mon, 15 Oct 2012 13:40:29 -0700
- To: "<public-html-media@w3.org>" <public-html-media@w3.org>
- Message-ID: <75B2752E-EDC5-4057-851D-D0F14F5207E1@adobe.com>
I reopened this bug a few weeks ago because I would like to see a mechanism for passing application level parameters down into the CDM when the key session is created.
As I said on on of the recent calls, my reasoning is that some CDMs may transmit authentication/authorization data in-band (that is via CDM-specific mechanisms). 
An example of this would be:
<script>
  function handleKeyNeeded(event) {
    var video = event.target;
    var initData = event.initData;
    var appData = { username: "foo", token: "A53DF98700ABFE11", sessionNonce: "DJKGDH+!9861XxbODY1287x===" };
    if (!video.keys)
      video.keys = MediaKeys("com.example.somesystem");
    if (!video.keys)
      throw "Could not create MediaKeys";
    var keySession = mediaKeys.createSession(mimeType, initData, appData);
    if (!keySession)
      throw "Could not create key session";
    keySession.onkeymessage="handleMessage(event)";
  }
  function handleMessage(event) {
    var keySession = event.target;
    var message = event.message;
    var xmlhttp = new XMLHttpRequest();
    xmlhttp.open("POST", "http://.../getkey", false);
    xmlhttp.send(message);
    var key = new Uint8Array(xmlhttp.response);
    keySession.addKey(key);
  }
</script>
<video src="foo.dash" autoplay onneedkey="handleKeyNeeded(event)" onkeymessage="handleMessage(event)"></video>
The appData parameter would be optional and NULL by default. CDM's which do not handle this parameter could simply ignore it if passed.
This is a use-case which would be used by at least one content protection mechanism today, possibly more than one.
Joe Steele
steele@adobe.com
Received on Monday, 15 October 2012 20:41:33 UTC