Skip to content

Commit

Permalink
fix: Correct default initDataTransform for legacy Apple Media Keys (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
avelad authored and joeyparrish committed Dec 8, 2022
1 parent a534a5a commit ac6c4ed
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions build/types/core
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
+../../lib/util/ebml_parser.js
+../../lib/util/error.js
+../../lib/util/event_manager.js
+../../lib/util/fairplay_utils.js
+../../lib/util/fake_event.js
+../../lib/util/fake_event_target.js
+../../lib/util/functional.js
Expand Down
3 changes: 1 addition & 2 deletions build/types/fairplay
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# FairPlay

+../../lib/polyfill/patchedmediakeys_apple.js
+../../lib/util/fairplay_utils.js
+../../lib/polyfill/patchedmediakeys_apple.js
13 changes: 10 additions & 3 deletions lib/util/player_configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ goog.require('shaka.config.AutoShowText');
goog.require('shaka.log');
goog.require('shaka.net.NetworkingEngine');
goog.require('shaka.util.ConfigUtils');
goog.require('shaka.util.FairPlayUtils');
goog.require('shaka.util.LanguageUtils');
goog.require('shaka.util.ManifestParserUtils');
goog.require('shaka.util.Platform');
Expand Down Expand Up @@ -68,9 +69,15 @@ shaka.util.PlayerConfiguration = class {
advanced: {}, // key is arbitrary key system ID, value is a record type
delayLicenseRequestUntilPlayed: false,
initDataTransform: (initData, initDataType, drmInfo) => {
return shaka.util.ConfigUtils.referenceParametersAndReturn(
[initData, initDataType, drmInfo],
initData);
const keySystem = drmInfo.keySystem;
if (keySystem == 'com.apple.fps.1_0' && initDataType == 'skd') {
const cert = drmInfo.serverCertificate;
const contentId =
shaka.util.FairPlayUtils.defaultGetContentId(initData);
initData = shaka.util.FairPlayUtils.initDataTransform(
initData, contentId, cert);
}
return initData;
},
logLicenseExchange: false,
updateExpirationTime: 1,
Expand Down

0 comments on commit ac6c4ed

Please sign in to comment.