Accoding to Table 2-4 of FairPlay Programing Guide, Asset ID in SPC is byte array.
On other hand, the chapter "EME Message Exchange" says "The AssetId can be any string you choose."
So what charactor code should I choose?
In "FPS_in_Safari_Example.html", charactor code of AssetId is like Unicode.
Its javascript code to get byte array is the below:
function stringToArray(string) {
var buffer = new ArrayBuffer(string.length*2); // 2 bytes for each char
var array = new Uint16Array(buffer);
for (var i=0, strLen=string.length; i<strLen; i++) {
array[i] = string.charCodeAt(i);
}
return array;
}The length of Unicode is not always 2 bytes. So it will not working well because Key Server can't extract original string.
It doesn't make sense to treat Asset Id as string in Safari.
Should I pass AssetId to Key Server in the outer of SPC Message?