shaka-project / shaka-player-embedded

Shaka Player in a C++ Framework
Apache License 2.0
239 stars 62 forks source link

Problems setting serverCertificate via swift #222

Open chadacious opened 2 years ago

chadacious commented 2 years ago

I'm trying to take a base64 encoded string, convert it to Data and set the serverCertificate:

let TEST_SERVER_CERT = [base64EncodedString]
let serverCert = Data.init(base64Encoded: TEST_SERVER_CERT)
player.configure("drm.advanced.com\\.widevine\\.alpha.serverCertificate", with: serverCert!)

I get back [Error]: "Invalid config, wrong type for .drm.advanced.com.widevine.alpha.serverCertificate"

Will keep trying variations and start debugging but thought I would reach out for help in case someone knows what's up.

chadacious commented 2 years ago

Tried the same thing from Objective C and got the same error:

NSString *base64Encoded = @"[base64EncodedString]";
NSData *serverCert = [[NSData alloc] initWithBase64EncodedString:base64Encoded options:0];
[player configure:@"drm.advanced.com\\.widevine\\.alpha.serverCertificate"
         withData:serverCert];

[Error]: "Invalid config, wrong type for .drm.advanced.com.widevine.alpha.serverCertificate"

Remembering what I saw when debugging, I believe in the javascript it looked like the certificate data type is coming in as a ByteArray instead of a typed Uint8Array so it is failing the type check.

For now, I just modified the compile shaka js code to force set the server certificate for testing and dev purposes.