[encrypted-media] Example 5 in section 12.1 has mismatch between initDataType and initData in generateRequest call

cpearce-mozilla has just created a new issue for 
https://github.com/w3c/encrypted-media:

== Example 5 in section 12.1 has mismatch between initDataType and 
initData in generateRequest call ==
In example 5 in section "12.1 Source and Key Known at Page Load (Clear
 Key)", the code that calls generateRequest() is:

          promise.then(
            function(createdMediaKeys) {
              var te = new TextEncoder();
              var initData = te.encode( 
'{"kids":["LwVHf8JLtPrv2GUXFW2v_A"]}');
              var keySession = createdMediaKeys.createSession();
              keySession.addEventListener("message", handleMessage, 
false);
              return keySession.generateRequest('webm', initData);
            }
          ).catch(
            console.error.bind(console, 'Unable to create or 
initialize key session')
          );

I think that should be:

          promise.then(
            function(createdMediaKeys) {
              var te = new TextEncoder();
              var initData = te.encode( 
'{"kids":["LwVHf8JLtPrv2GUXFW2v_A"]}');
              var keySession = createdMediaKeys.createSession();
              keySession.addEventListener("message", handleMessage, 
false);
              return keySession.generateRequest('keyIds', initData);
            }
          ).catch(
            console.error.bind(console, 'Unable to create or 
initialize key session')
          );

i.e. instead of generateRequest('webm', initData), it should be 
generateRequest('keyIds', initData), since initData is actually a 
'keyids' type initData.

Please view or discuss this issue at 
https://github.com/w3c/encrypted-media/issues/134 using your GitHub 
account

Received on Thursday, 3 December 2015 05:07:08 UTC