@srgssr/pillarbox-web 1.32.2 → 1.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pillarbox-core.cjs +1 -1
- package/dist/pillarbox-core.es.js +1 -1
- package/dist/pillarbox.cjs +76 -9
- package/dist/pillarbox.cjs.map +1 -1
- package/dist/pillarbox.es.js +76 -9
- package/dist/pillarbox.es.js.map +1 -1
- package/dist/pillarbox.min.css +1 -1
- package/dist/pillarbox.min.css.map +1 -1
- package/dist/pillarbox.umd.js +473 -220
- package/dist/pillarbox.umd.js.map +1 -1
- package/dist/pillarbox.umd.min.js +13 -13
- package/dist/pillarbox.umd.min.js.map +1 -1
- package/dist/types/src/utils/Drm.d.ts +27 -0
- package/dist/types/src/utils/Drm.d.ts.map +1 -1
- package/dist/types/src/utils/typedef.d.ts +27 -12
- package/dist/types/src/utils/typedef.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/pillarbox-core.cjs
CHANGED
package/dist/pillarbox.cjs
CHANGED
|
@@ -94,7 +94,7 @@ function _toPropertyKey(t) {
|
|
|
94
94
|
return "symbol" == typeof i ? i : i + "";
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
const version = "1.32.
|
|
97
|
+
const version = "1.32.2";
|
|
98
98
|
|
|
99
99
|
/** @import VJSPlayer from 'video.js/dist/types/player' */
|
|
100
100
|
/** @import AudioTrack from 'video.js/dist/types/tracks/audio-track' */
|
|
@@ -702,14 +702,7 @@ class Drm {
|
|
|
702
702
|
drmList.forEach(drmVendor => {
|
|
703
703
|
const type = Drm.vendors[drmVendor.type];
|
|
704
704
|
if (Drm.vendors.FAIRPLAY === type) {
|
|
705
|
-
|
|
706
|
-
certificateUrl: certificateUri,
|
|
707
|
-
licenseUrl: licenseUri
|
|
708
|
-
} = drmVendor;
|
|
709
|
-
keySystems[type] = {
|
|
710
|
-
certificateUri,
|
|
711
|
-
licenseUri
|
|
712
|
-
};
|
|
705
|
+
keySystems[type] = Drm.buildFairplayConfig(drmVendor);
|
|
713
706
|
} else {
|
|
714
707
|
keySystems[type] = drmVendor.licenseUrl;
|
|
715
708
|
}
|
|
@@ -719,6 +712,80 @@ class Drm {
|
|
|
719
712
|
};
|
|
720
713
|
}
|
|
721
714
|
|
|
715
|
+
/**
|
|
716
|
+
* Builds the configuration for Apple FairPlay.
|
|
717
|
+
*
|
|
718
|
+
* @param {import('../dataProvider/model/typedef').DrmMetadata} drmVendor the DRM metadata for FairPlay
|
|
719
|
+
*
|
|
720
|
+
* @returns {import('./typedef').KeySystemConfiguration} the FairPlay configuration
|
|
721
|
+
*/
|
|
722
|
+
static buildFairplayConfig(drmVendor) {
|
|
723
|
+
const {
|
|
724
|
+
certificateUrl: certificateUri
|
|
725
|
+
} = drmVendor;
|
|
726
|
+
return {
|
|
727
|
+
certificateUri,
|
|
728
|
+
getContentId: function (emeOptions, contentId) {
|
|
729
|
+
return contentId.replace('skd:', 'https:');
|
|
730
|
+
},
|
|
731
|
+
getLicense: function (emeOptions, licenseUri, keyMessage, callback) {
|
|
732
|
+
Drm.requestLicense(licenseUri, keyMessage, callback);
|
|
733
|
+
}
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Fetch a DRM license from a license server.
|
|
739
|
+
*
|
|
740
|
+
* _If required this logic can also be used for widevine/playready_
|
|
741
|
+
*
|
|
742
|
+
* @param {string} url the license server URL
|
|
743
|
+
* @param {ArrayBuffer} keyMessage the challenge generated by the browser's CDM
|
|
744
|
+
* @param {(function(Error|null, ArrayBuffer):void)} callback the callback provided by videojs-contrib-eme receives (err, key)
|
|
745
|
+
* @see https://github.com/videojs/videojs-contrib-eme/tree/main?tab=readme-ov-file#get-certificatecontent-idlicense-by-functions
|
|
746
|
+
*/
|
|
747
|
+
static requestLicense(url, keyMessage, callback) {
|
|
748
|
+
return _asyncToGenerator(function* () {
|
|
749
|
+
try {
|
|
750
|
+
const response = yield fetch(url, {
|
|
751
|
+
method: 'POST',
|
|
752
|
+
body: keyMessage,
|
|
753
|
+
headers: {
|
|
754
|
+
'Content-Type': 'application/octet-stream'
|
|
755
|
+
}
|
|
756
|
+
});
|
|
757
|
+
if (!response.ok) {
|
|
758
|
+
return callback(yield Drm.parseLicenseError(response));
|
|
759
|
+
}
|
|
760
|
+
callback(null, yield response.arrayBuffer());
|
|
761
|
+
} catch (error) {
|
|
762
|
+
callback(error);
|
|
763
|
+
}
|
|
764
|
+
})();
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* Parses the error response from the license server.
|
|
769
|
+
*
|
|
770
|
+
* @param {Response} response the fetch response object
|
|
771
|
+
*
|
|
772
|
+
* @returns {Promise<string>} the formatted error message
|
|
773
|
+
*/
|
|
774
|
+
static parseLicenseError(response) {
|
|
775
|
+
return _asyncToGenerator(function* () {
|
|
776
|
+
const errMessage = 'DRM license error:';
|
|
777
|
+
try {
|
|
778
|
+
const {
|
|
779
|
+
code,
|
|
780
|
+
message
|
|
781
|
+
} = yield response.json();
|
|
782
|
+
return `${errMessage} ${code || response.status} ${message || response.statusText}`;
|
|
783
|
+
} catch (_unused) {
|
|
784
|
+
return `${errMessage} ${response.status} ${response.statusText}`;
|
|
785
|
+
}
|
|
786
|
+
})();
|
|
787
|
+
}
|
|
788
|
+
|
|
722
789
|
/**
|
|
723
790
|
* Check if some of the resources have DRM.
|
|
724
791
|
*
|