Skip to content

Commit

Permalink
Fix/clearkey from ref UI: Check for initData in protData before overw…
Browse files Browse the repository at this point in the history
…riting (#3942)

* Check for keyPairs in clearkeys object before updating the key session

* Check for length of clearkeys in protData before overwriting init data
  • Loading branch information
dsilhavy authored May 10, 2022
1 parent 50376f5 commit 05f0a6b
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ function ProtectionController(config) {
if (protectionKeyController.isClearKey(selectedKeySystem)) {
// For Clearkey: if parameters for generating init data was provided by the user, use them for generating
// initData and overwrite possible initData indicated in encrypted event (EME)
if (keySystemInfo.protData && keySystemInfo.protData.hasOwnProperty('clearkeys')) {
if (keySystemInfo.protData && keySystemInfo.protData.hasOwnProperty('clearkeys') && Object.keys(keySystemInfo.protData.clearkeys).length !== 0) {
const initData = { kids: Object.keys(keySystemInfo.protData.clearkeys) };
keySystemInfo.initData = new TextEncoder().encode(JSON.stringify(initData));
}
Expand Down

0 comments on commit 05f0a6b

Please sign in to comment.