videojs-contrib-eme
Version:
Supports Encrypted Media Extensions for playback of encrypted content in Video.js
2,306 lines (2,246 loc) • 498 kB
JavaScript
/*! @name videojs-contrib-eme @version 5.5.2 @license Apache-2.0 */
(function (QUnit, videojs, sinon) {
'use strict';
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var QUnit__default = /*#__PURE__*/_interopDefaultLegacy(QUnit);
var videojs__default = /*#__PURE__*/_interopDefaultLegacy(videojs);
var sinon__default = /*#__PURE__*/_interopDefaultLegacy(sinon);
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function getAugmentedNamespace(n) {
if (n.__esModule) return n;
var a = Object.defineProperty({}, '__esModule', {value: true});
Object.keys(n).forEach(function (k) {
var d = Object.getOwnPropertyDescriptor(n, k);
Object.defineProperty(a, k, d.get ? d : {
enumerable: true,
get: function () {
return n[k];
}
});
});
return a;
}
var win;
if (typeof window !== "undefined") {
win = window;
} else if (typeof commonjsGlobal !== "undefined") {
win = commonjsGlobal;
} else if (typeof self !== "undefined") {
win = self;
} else {
win = {};
}
var window_1 = win;
function cov_2b3qmvl21i() {
var path = "/Users/srimron-soutter/repos/github/vjs/videojs-contrib-eme/src/cdm.js";
var hash = "eb8df1a7b7cd7a5a72d110eef003b0ababa285e5";
var global = new Function("return this")();
var gcv = "__coverage__";
var coverageData = {
path: "/Users/srimron-soutter/repos/github/vjs/videojs-contrib-eme/src/cdm.js",
statementMap: {
"0": {
start: {
line: 3,
column: 22
},
end: {
line: 11,
column: 2
}
},
"1": {
start: {
line: 13,
column: 19
},
end: {
line: 40,
column: 1
}
},
"2": {
start: {
line: 44,
column: 35
},
end: {
line: 67,
column: 1
}
},
"3": {
start: {
line: 45,
column: 18
},
end: {
line: 45,
column: 32
}
},
"4": {
start: {
line: 46,
column: 18
},
end: {
line: 51,
column: 3
}
},
"5": {
start: {
line: 53,
column: 2
},
end: {
line: 55,
column: 3
}
},
"6": {
start: {
line: 54,
column: 4
},
end: {
line: 54,
column: 36
}
},
"7": {
start: {
line: 57,
column: 2
},
end: {
line: 66,
column: 5
}
},
"8": {
start: {
line: 58,
column: 4
},
end: {
line: 58,
column: 100
}
},
"9": {
start: {
line: 60,
column: 4
},
end: {
line: 60,
column: 41
}
},
"10": {
start: {
line: 61,
column: 4
},
end: {
line: 61,
column: 43
}
},
"11": {
start: {
line: 62,
column: 4
},
end: {
line: 62,
column: 41
}
},
"12": {
start: {
line: 63,
column: 4
},
end: {
line: 63,
column: 41
}
},
"13": {
start: {
line: 65,
column: 4
},
end: {
line: 65,
column: 19
}
}
},
fnMap: {
"0": {
name: "(anonymous_0)",
decl: {
start: {
line: 44,
column: 35
},
end: {
line: 44,
column: 36
}
},
loc: {
start: {
line: 44,
column: 41
},
end: {
line: 67,
column: 1
}
},
line: 44
},
"1": {
name: "(anonymous_1)",
decl: {
start: {
line: 57,
column: 36
},
end: {
line: 57,
column: 37
}
},
loc: {
start: {
line: 57,
column: 70
},
end: {
line: 59,
column: 3
}
},
line: 57
},
"2": {
name: "(anonymous_2)",
decl: {
start: {
line: 58,
column: 90
},
end: {
line: 58,
column: 91
}
},
loc: {
start: {
line: 58,
column: 96
},
end: {
line: 58,
column: 98
}
},
line: 58
},
"3": {
name: "(anonymous_3)",
decl: {
start: {
line: 59,
column: 11
},
end: {
line: 59,
column: 12
}
},
loc: {
start: {
line: 59,
column: 58
},
end: {
line: 66,
column: 3
}
},
line: 59
}
},
branchMap: {
"0": {
loc: {
start: {
line: 53,
column: 2
},
end: {
line: 55,
column: 3
}
},
type: "if",
locations: [{
start: {
line: 53,
column: 2
},
end: {
line: 55,
column: 3
}
}, {
start: {
line: 53,
column: 2
},
end: {
line: 55,
column: 3
}
}],
line: 53
},
"1": {
loc: {
start: {
line: 53,
column: 6
},
end: {
line: 53,
column: 72
}
},
type: "binary-expr",
locations: [{
start: {
line: 53,
column: 6
},
end: {
line: 53,
column: 23
}
}, {
start: {
line: 53,
column: 27
},
end: {
line: 53,
column: 72
}
}],
line: 53
}
},
s: {
"0": 0,
"1": 0,
"2": 0,
"3": 0,
"4": 0,
"5": 0,
"6": 0,
"7": 0,
"8": 0,
"9": 0,
"10": 0,
"11": 0,
"12": 0,
"13": 0
},
f: {
"0": 0,
"1": 0,
"2": 0,
"3": 0
},
b: {
"0": [0, 0],
"1": [0, 0]
},
_coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
hash: "eb8df1a7b7cd7a5a72d110eef003b0ababa285e5"
};
var coverage = global[gcv] || (global[gcv] = {});
if (!coverage[path] || coverage[path].hash !== hash) {
coverage[path] = coverageData;
}
var actualCoverage = coverage[path];
{
// @ts-ignore
cov_2b3qmvl21i = function () {
return actualCoverage;
};
}
return actualCoverage;
}
cov_2b3qmvl21i();
const genericConfig = (cov_2b3qmvl21i().s[0]++, [{
initDataTypes: ['cenc'],
audioCapabilities: [{
contentType: 'audio/mp4;codecs="mp4a.40.2"'
}],
videoCapabilities: [{
contentType: 'video/mp4;codecs="avc1.42E01E"'
}]
}]);
const keySystems = (cov_2b3qmvl21i().s[1]++, [// Fairplay
// Requires different config than other CDMs
{
keySystem: 'com.apple.fps',
supportedConfig: [{
initDataTypes: ['sinf'],
videoCapabilities: [{
contentType: 'video/mp4'
}]
}]
}, // Playready
{
keySystem: 'com.microsoft.playready.recommendation',
supportedConfig: genericConfig
}, // Widevine
{
keySystem: 'com.widevine.alpha',
supportedConfig: genericConfig
}, // Clear
{
keySystem: 'org.w3.clearkey',
supportedConfig: genericConfig
}]); // Asynchronously detect the list of supported CDMs by requesting key system access
// when possible, otherwise rely on browser-specific EME API feature detection.
cov_2b3qmvl21i().s[2]++;
const detectSupportedCDMs = () => {
cov_2b3qmvl21i().f[0]++;
const Promise = (cov_2b3qmvl21i().s[3]++, window_1.Promise);
const results = (cov_2b3qmvl21i().s[4]++, {
fairplay: Boolean(window_1.WebKitMediaKeys),
playready: false,
widevine: false,
clearkey: false
});
cov_2b3qmvl21i().s[5]++;
if ((cov_2b3qmvl21i().b[1][0]++, !window_1.MediaKeys) || (cov_2b3qmvl21i().b[1][1]++, !window_1.navigator.requestMediaKeySystemAccess)) {
cov_2b3qmvl21i().b[0][0]++;
cov_2b3qmvl21i().s[6]++;
return Promise.resolve(results);
} else {
cov_2b3qmvl21i().b[0][1]++;
}
cov_2b3qmvl21i().s[7]++;
return Promise.all(keySystems.map(({
keySystem,
supportedConfig
}) => {
cov_2b3qmvl21i().f[1]++;
cov_2b3qmvl21i().s[8]++;
return window_1.navigator.requestMediaKeySystemAccess(keySystem, supportedConfig).catch(() => {
cov_2b3qmvl21i().f[2]++;
});
})).then(([fairplay, playready, widevine, clearkey]) => {
cov_2b3qmvl21i().f[3]++;
cov_2b3qmvl21i().s[9]++;
results.fairplay = Boolean(fairplay);
cov_2b3qmvl21i().s[10]++;
results.playready = Boolean(playready);
cov_2b3qmvl21i().s[11]++;
results.widevine = Boolean(widevine);
cov_2b3qmvl21i().s[12]++;
results.clearkey = Boolean(clearkey);
cov_2b3qmvl21i().s[13]++;
return results;
});
};
const IS_CHROMIUM = videojs__default["default"].browser.IS_CHROMIUM || /Chrome|CriOS/i.test(window_1.navigator.userAgent);
const IS_WINDOWS = videojs__default["default"].browser.IS_WINDOWS || /Windows/i.test(window_1.navigator.userAgent);
QUnit__default["default"].module('videojs-contrib-eme CDM Module');
QUnit__default["default"].skip('detectSupportedCDMs() returns a Promise', function (assert) {
const promise = detectSupportedCDMs();
assert.ok(promise.then);
}); // NOTE: This test is not future-proof. It verifies that the CDM detect function
// works as expected given browser's *current* CDM support. If that support changes,
// this test may need updating.
QUnit__default["default"].test('detectSupportedCDMs() promise resolves correctly on different browsers', function (assert) {
const done = assert.async();
const promise = detectSupportedCDMs();
promise.then(result => {
// Currently, widevine and clearkey don't work in headless Chrome, so we can't verify cdm support in
// the remote Video.js test environment. However, it can be verified if testing locally in a real browser.
// Headless Chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=788662
if (videojs__default["default"].browser.IS_CHROME) {
assert.equal(result.fairplay, false, 'fairplay not supported in Chrome');
assert.equal(result.playready, false, 'playready not supported in Chrome'); // Uncomment if testing locally in actual browser
// assert.equal(result.clearkey, true, 'clearkey is supported in Chrome');
// assert.equal(result.widevine, true, 'widevine is supported in Chrome');
} // Widevine requires a plugin in Ubuntu Firefox so it also does not work in the remote Video.js test environment
if (videojs__default["default"].browser.IS_FIREFOX) {
assert.equal(result.fairplay, false, 'fairplay not supported in FF');
assert.equal(result.playready, false, 'playready not supported in FF');
assert.equal(result.clearkey, true, 'clearkey is supported in FF'); // Uncomment if testing locally in actual browser
// assert.equal(result.widevine, true, 'widevine is supported in Chrome and FF');
}
if (videojs__default["default"].browser.IS_ANY_SAFARI) {
assert.deepEqual(result, {
fairplay: true,
clearkey: true,
playready: false,
widevine: false
}, 'fairplay support reported in Safari');
}
if (videojs__default["default"].browser.IS_EDGE && IS_CHROMIUM && !IS_WINDOWS) {
assert.deepEqual(result, {
fairplay: false,
playready: false,
widevine: true,
clearkey: true
}, 'widevine support reported in non-Windows Chromium Edge');
}
if (videojs__default["default"].browser.IS_EDGE && IS_CHROMIUM && IS_WINDOWS) {
assert.deepEqual(result, {
fairplay: false,
playready: true,
widevine: true,
clearkey: true
}, 'widevine and playready support reported in Windows Chromium Edge');
}
done();
}).catch(done);
});
const stringToArrayBuffer = string => {
const buffer = new ArrayBuffer(string.length * 2);
const typedArray = new Uint16Array(buffer);
for (let i = 0; i < string.length; i++) {
typedArray[i] = string.charCodeAt(i);
}
return buffer;
};
const getMockEventBus = () => {
const calls = [];
const mockEventBus = {
calls,
trigger: event => {
calls.push(event);
},
isDisposed: () => {
return false;
}
};
return mockEventBus;
};
const license = 'this is a license';
const challengeElement = `
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<AcquireLicenseResponse xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols">
<AcquireLicenseResult>
<Response xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols/messages">
<LicenseResponse xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols">
<Version>1</Version>
<Licenses>
<License>${license}</License>
</Licenses>
</LicenseResponse>
</Response>
</AcquireLicenseResult>
</AcquireLicenseResponse>
</soap:Body>
</soap:Envelope>`;
const defaultHeaders = [{
name: 'Content-Type',
value: 'text/xml; charset=utf-8'
}, {
name: 'SOAPAction',
value: '"http://schemas.microsoft.com/DRM/2007/03/protocols/AcquireLicense"'
}];
const createHeaders = headers => {
return headers.reduce((acc, header) => {
return acc + `
<HttpHeader>
<name>${header.name}</name>
<value>${header.value}</value>
</HttpHeader>
`;
}, '');
};
const createMessageBuffer = headers => {
headers = headers || defaultHeaders; // can't use TextEncoder because Safari doesn't support it
return stringToArrayBuffer(`
<PlayReadyKeyMessage type="LicenseAcquisition">
<LicenseAcquisition Version="1">
<Challenge encoding="base64encoded">${window_1.btoa(challengeElement)}</Challenge>
<HttpHeaders>${createHeaders(headers)}</HttpHeaders>
</LicenseAcquisition>
</PlayReadyKeyMessage>`);
};
const unwrappedPlayreadyMessage = `
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<AcquireLicense xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols">
<challenge>
<Challenge xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols/messages">
<LA xmlns="http://schemas.microsoft.com/DRM/2007/03/protocols" Id="SignedData" xml:space="preserve"><Version>1</Version><ContentHeader><WRMHEADER xmlns="http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" version="4.0.0.0"><DATA><PROTECTINFO><KEYLEN>16</KEYLEN><ALGID>AESCTR</ALGID></PROTECTINFO><KID>U24lieXb6USvujjSyhfRdg==</KID><CHECKSUM>TKWDEqady2g=</CHECKSUM><LA_URL>https://foo.bar.license</LA_URL></DATA></WRMHEADER></ContentHeader><CLIENTINFO><CLIENTVERSION>4.2.0.5545</CLIENTVERSION></CLIENTINFO><RevocationLists><RevListInfo><ListID>ioydTlK2p0WXkWklprR5Hw==</ListID><Version>13</Version></RevListInfo><RevListInfo><ListID>Ef/RUojT3U6Ct2jqTCChbA==</ListID><Version>68</Version></RevListInfo></RevocationLists><LicenseNonce>U9WysleTindM/gVQyExDdw==</LicenseNonce><ClientTime>1706149441</ClientTime> <EncryptedData xmlns="http://www.w3.org/2001/04/xmlenc#" Type="http://www.w3.org/2001/04/xmlenc#Element"><EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"></EncryptionMethod><KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"><EncryptedKey xmlns="http://www.w3.org/2001/04/xmlenc#"><EncryptionMethod Algorithm="http://schemas.microsoft.com/DRM/2007/03/protocols#ecc256"></EncryptionMethod><KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"><KeyName>WMRMServer</KeyName></KeyInfo><CipherData><CipherValue>barfoobarfoo</CipherValue></CipherData></EncryptedKey></KeyInfo><CipherData><CipherValue>foocipherbarcipher</CipherValue></CipherData></EncryptedData></LA>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></CanonicalizationMethod>
<SignatureMethod Algorithm="http://schemas.microsoft.com/DRM/2007/03/protocols#ecdsa-sha256"></SignatureMethod>
<Reference URI="#SignedData">
<DigestMethod Algorithm="http://schemas.microsoft.com/DRM/2007/03/protocols#sha256"></DigestMethod>
<DigestValue>FL7P8/ITc+xFvUeoyMRq2JnNbJuhhKINsXtdDuM1Y78=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>Ocy3UTUu52QI0MIzdftANLQgJM3SsP6E2XvPlKYzQBtvscJbm/uTi38zrfY2RBU3FJZLtcj0O72lb5Mq5/CNJA==</SignatureValue>
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<KeyValue>
<ECCKeyValue>
<PublicKey>nxbw6pwjF4fF5sEqM23KU54ifXrRvejWK5GVdjdzCMY3dvjdp7Ho5h5YiZ34xOSAUHJsZwa4DW+P6XFIDauDzg==</PublicKey>
</ECCKeyValue>
</KeyValue>
</KeyInfo>
</Signature>
</Challenge>
</challenge>
</AcquireLicense>
</soap:Body>
</soap:Envelope>
`;
var _nodeResolve_empty = {};
var _nodeResolve_empty$1 = /*#__PURE__*/Object.freeze({
__proto__: null,
'default': _nodeResolve_empty
});
var require$$0 = /*@__PURE__*/getAugmentedNamespace(_nodeResolve_empty$1);
var topLevel = typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof window !== 'undefined' ? window : {};
var minDoc = require$$0;
var doccy;
if (typeof document !== 'undefined') {
doccy = document;
} else {
doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];
if (!doccy) {
doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc;
}
}
var document_1 = doccy;
function _extends() {
_extends = Object.assign ? Object.assign.bind() : function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function cov_3smlfyjsx() {
var path = "/Users/srimron-soutter/repos/github/vjs/videojs-contrib-eme/src/http-handler.js";
var hash = "cb9f4eb4a3d389a752465572bb081eb5470b1414";
var global = new Function("return this")();
var gcv = "__coverage__";
var coverageData = {
path: "/Users/srimron-soutter/repos/github/vjs/videojs-contrib-eme/src/http-handler.js",
statementMap: {
"0": {
start: {
line: 3,
column: 26
},
end: {
line: 3,
column: 49
}
},
"1": {
start: {
line: 7,
column: 0
},
end: {
line: 29,
column: 1
}
},
"2": {
start: {
line: 8,
column: 2
},
end: {
line: 28,
column: 4
}
},
"3": {
start: {
line: 8,
column: 58
},
end: {
line: 28,
column: 3
}
},
"4": {
start: {
line: 9,
column: 4
},
end: {
line: 12,
column: 5
}
},
"5": {
start: {
line: 10,
column: 6
},
end: {
line: 10,
column: 20
}
},
"6": {
start: {
line: 11,
column: 6
},
end: {
line: 11,
column: 13
}
},
"7": {
start: {
line: 15,
column: 4
},
end: {
line: 24,
column: 5
}
},
"8": {
start: {
line: 16,
column: 18
},
end: {
line: 16,
column: 30
}
},
"9": {
start: {
line: 18,
column: 6
},
end: {
line: 20,
column: 7
}
},
"10": {
start: {
line: 19,
column: 8
},
end: {
line: 19,
column: 78
}
},
"11": {
start: {
line: 22,
column: 6
},
end: {
line: 22,
column: 24
}
},
"12": {
start: {
line: 23,
column: 6
},
end: {
line: 23,
column: 13
}
},
"13": {
start: {
line: 27,
column: 4
},
end: {
line: 27,
column: 33
}
}
},
fnMap: {
"0": {
name: "(anonymous_0)",
decl: {
start: {
line: 8,
column: 24
},
end: {
line: 8,
column: 25
}
},
loc: {
start: {
line: 8,
column: 58
},
end: {
line: 28,
column: 3
}
},
line: 8
},
"1": {
name: "(anonymous_1)",
decl: {
start: {
line: 8,
column: 58
},
end: {
line: 8,
column: 59
}
},
loc: {
start: {
line: 8,
column: 91
},
end: {
line: 28,
column: 3
}
},
line: 8
}
},
branchMap: {
"0": {
loc: {
start: {
line: 7,
column: 0
},
end: {
line: 29,
column: 1
}
},
type: "if",
locations: [{
start: {
line: 7,
column: 0
},
end: {
line: 29,
column: 1
}
}, {
start: {
line: 7,
column: 0
},
end: {
line: 29,
column: 1
}
}],
line: 7
},
"1": {
loc: {
start: {
line: 9,
column: 4
},
end: {
line: 12,
column: 5
}
},
type: "if",
locations: [{
start: {
line: 9,
column: 4
},
end: {
line: 12,
column: 5
}
}, {
start: {
line: 9,
column: 4
},
end: {
line: 12,
column: 5
}
}],
line: 9
},
"2": {
loc: {
start: {
line: 15,
column: 4
},
end: {
line: 24,
column: 5
}
},
type: "if",
locations: [{
start: {
line: 15,
column: 4
},
end: {
line: 24,
column: 5
}
}, {
start: {
line: 15,
column: 4
},
end: {
line: 24,
column: 5
}
}],
line: 15
},
"3": {
loc: {
start: {
line: 15,
column: 8
},
end: {
line: 15,
column: 64
}
},
type: "binary-expr",
locations: [{
start: {
line: 15,
column: 8
},
end: {
line: 15,
column: 34
}
}, {
start: {
line: 15,
column: 38
},
end: {
line: 15,
column: 64
}
}],
line: 15
},
"4": {
loc: {
start: {
line: 18,
column: 6
},
end: {
line: 20,
column: 7
}
},
type: "if",
locations: [{
start: {
line: 18,
column: 6
},
end: {
line: 20,
column: 7
}
}, {
start: {
line: 18,
column: 6
},
end: {
line: 20,
column: 7
}
}],
line: 18
}
},
s: {
"0": 0,
"1": 0,
"2": 0,
"3": 0,
"4": 0,
"5": 0,
"6": 0,
"7": 0,
"8": 0,
"9": 0,
"10": 0,
"11": 0,
"12": 0,
"13": 0
},
f: {
"0": 0,
"1": 0
},
b: {
"0": [0, 0],
"1": [0, 0],
"2": [0, 0],
"3": [0, 0],
"4": [0, 0]
},
_coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
hash: "cb9f4eb4a3d389a752465572bb081eb5470b1414"
};
var coverage = global[gcv] || (global[gcv] = {});
if (!coverage[path] || coverage[path].hash !== hash) {
coverage[path] = coverageData;
}
var actualCoverage = coverage[path];
{
// @ts-ignore
cov_3smlfyjsx = function () {
return actualCoverage;
};
}
return actualCoverage;
}
cov_3smlfyjsx();
let httpResponseHandler = (cov_3smlfyjsx().s[0]++, videojs__default["default"].xhr.httpHandler); // to make sure this doesn't break with older versions of Video.js,
// do a super simple wrapper instead
cov_3smlfyjsx().s[1]++;
if (!httpResponseHandler) {
cov_3smlfyjsx().b[0][0]++;
cov_3smlfyjsx().s[2]++;
httpResponseHandler = (callback, decodeResponseBody) => {
cov_3smlfyjsx().f[0]++;
cov_3smlfyjsx().s[3]++;
return (err, response, responseBody) => {
cov_3smlfyjsx().f[1]++;
cov_3smlfyjsx().s[4]++;
if (err) {
cov_3smlfyjsx().b[1][0]++;
cov_3smlfyjsx().s[5]++;
callback(err);
cov_3smlfyjsx().s[6]++;
return;
} else {
cov_3smlfyjsx().b[1][1]++;
} // if the HTTP status code is 4xx or 5xx, the request also failed
cov_3smlfyjsx().s[7]++;
if ((cov_3smlfyjsx().b[3][0]++, response.statusCode >= 400) && (cov_3smlfyjsx().b[3][1]++, response.statusCode <= 599)) {
cov_3smlfyjsx().b[2][0]++;
let cause = (cov_3smlfyjsx().s[8]++, responseBody);
cov_3smlfyjsx().s[9]++;
if (decodeResponseBody) {
cov_3smlfyjsx().b[4][0]++;
cov_3smlfyjsx().s[10]++;
cause = String.fromCharCode.apply(null, new Uint8Array(responseBody));
} else {
cov_3smlfyjsx().b[4][1]++;
}
cov_3smlfyjsx().s[11]++;
callback({
cause
});
cov_3smlfyjsx().s[12]++;
return;
} else {
cov_3smlfyjsx().b[2][1]++;
} // otherwise, request succeeded
cov_3smlfyjsx().s[13]++;
callback(null, responseBody);
};
};
} else {
cov_3smlfyjsx().b[0][1]++;
}
function cov_24tdc8i42i() {
var path = "/Users/srimron-soutter/repos/github/vjs/videojs-contrib-eme/src/consts/errors.js";
var hash = "e57ac7426e617e3d3ae554c0d84e1b8a5beba426";
var global = new Function("return this")();
var gcv = "__coverage__";
var coverageData = {
path: "/Users/srimron-soutter/repos/github/vjs/videojs-contrib-eme/src/consts/errors.js",
statementMap: {
"0": {
start: {
line: 1,
column: 14
},
end: {
line: 12,
column: 1
}
}
},
fnMap: {},
branchMap: {},
s: {
"0": 0
},
f: {},
b: {},
_coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
hash: "e57ac7426e617e3d3ae554c0d84e1b8a5beba426"
};
var coverage = global[gcv] || (global[gcv] = {});
if (!coverage[path] || coverage[path].hash !== hash) {
coverage[path] = coverageData;
}
var actualCoverage = coverage[path];
{
// @ts-ignore
cov_24tdc8i42i = function () {
return actualCoverage;
};
}
return actualCoverage;
}
cov_24tdc8i42i();
const Error$1 = (cov_24tdc8i42i().s[0]++, {
EMEFailedToRequestMediaKeySystemAccess: 'eme-failed-request-media-key-system-access',
EMEFailedToCreateMediaKeys: 'eme-failed-create-media-keys',
EMEFailedToAttachMediaKeysToVideoElement: 'eme-failed-attach-media-keys-to-video',
EMEFailedToCreateMediaKeySession: 'eme-failed-create-media-key-session',
EMEFailedToSetServerCertificate: 'eme-failed-set-server-certificate',
EMEFailedToGenerateLicenseRequest: 'eme-failed-generate-license-request',
EMEFailedToUpdateSessionWithReceivedLicenseKeys: 'eme-failed-update-session',
EMEFailedToCloseSession: 'eme-failed-close-session',
EMEFailedToRemoveKeysFromSession: 'eme-failed-remove-keys',
EMEFailedToLoadSessionBySessionId: 'eme-failed-load-session'
});
function cov_1i0w9nqead() {
var path = "/Users/srimron-soutter/repos/github/vjs/videojs-contrib-eme/src/fairplay.js";
var hash = "ef999e724d02d0d3e082eb4a0982145131faf201";
var global = new Function("return this")();
var gcv = "__coverage__";
var coverageData = {
path: "/Users/srimron-soutter/repos/github/vjs/videojs-contrib-eme/src/fairplay.js",
statementMap: {
"0": {
start: {
line: 15,
column: 42
},
end: {
line: 15,
column: 61
}
},
"1": {
start: {
line: 17,
column: 39
},
end: {
line: 52,
column: 1
}
},
"2": {
start: {
line: 18,
column: 2
},
end: {
line: 20,
column: 3
}
},
"3": {
start: {
line: 19,
column: 4
},
end: {
line: 19,
column: 33
}
},
"4": {
start: {
line: 28,
column: 15
},
end: {
line: 28,
column: 16
}
},
"5": {
start: {
line: 29,
column: 17
},
end: {
line: 29,
column: 95
}
},
"6": {
start: {
line: 30,
column: 19
},
end: {
line: 30,
column: 39
}
},
"7": {
start: {
line: 31,
column: 24
},
end: {
line: 31,
column: 75
}
},
"8": {
start: {
line: 33,
column: 2
},
end: {
line: 33,
column: 30
}
},
"9": {
start: {
line: 34,
column: 2
},
end: {
line: 34,
column: 32
}
},
"10": {
start: {
line: 36,
column: 2
},
end: {
line: 36,
column: 50
}
},
"11": {
start: {
line: 37,
column: 2
},
end: {
line: 37,
column: 14
}
},
"12": {
start: {
line: 39,
column: 18
},
end: {
line: 39,
column: 60
}
},
"13": {
start: {
line: 41,
column: 2
},
end: {
line: 41,
column: 18
}
},
"14": {
start: {
line: 42,
column: 2
},
end: {
line: 42,
column: 31
}
},
"15": {
start: {
line: 44,
column: 2
},
end: {
line: 44,
column: 52
}
},
"16": {
start: {
line: 45,
column: 2
},
end: {
line: 45,
column: 14
}
},
"17": {
start: {
line: 47,
column: 20
},
end: {
line: 47,
column: 67
}
},
"18": {
start: {
line: 49,
column: 2
},
end: {
line: 49,
column: 22
}
},
"19": {
start: {
line: 51,
column: 2
},
end: {
line: 51,
column: 54
}
},
"20": {
start: {
line: 54,
column: 15
},
end: {
line: 142,
column: 1
}
},
"21": {
start: {
line: 55,
column: 2
},
end: {
line: 141,
column: 5
}
},
"22": {
start: {
line: 56,
column: 4
},
end: {
line: 69,
column: 5
}
},
"23": {
start: {
line: 57,
column: 6
},
end: {
line: 68,
column: 7
}
},
"24": {
start: {
line: 58,
column: 8
},
end: {
line: 58,
column: 89
}
},
"25": {
start: {
line: 60,
column: 25
},
end: {
line: 63,
column: 9
}
},
"26": {
start: {
line: 65,
column: 8
},
end: {
line: 65,
column: 34
}
},
"27": {
start: {
line: 66,
column: 8
},
end: {
line: 66,
column: 45
}
},
"28": {
start: {
line: 67,
column: 8
},
end: {
line: 67,
column: 15
}
},
"29": {
start: {
line: 73,
column: 4
},
end: {
line: 87,
column: 5
}
},
"30": {
start: {
line: 74,
column: 6
},
end: {
line: 77,
column: 8
}
},
"31": {
start: {
line: 79,
column: 23
},
end: {
line: 82,
column: 7
}
},
"32": {
start: {
line: 84,
column: 6
},
end: {
line: 84,
column: 32
}
},
"33": {
start: {
line: 85,
column: 6
},
end: {
line: 85,
column: 45
}
},
"34": {
start: {
line: 86,
column: 6
},
end: {
line: 86,
column: 13
}
},
"35": {
start: {
line: 89,
column: 4
},
end: {
line: 92,
column: 7
}
},
"36": {
start: {
line: 94,
column: 4
},
end: {
line: 94,
column: 37
}
},
"37": {
start: {
line: 96,
column: 4
},
end: {
line: 124,
column: 7
}
},
"38": {
start: {
line: 97,
column: 6
},
end: {
line: 100,
column: 9
}
},
"39": {
start: {
line: 101,
column: 6
},
end: {
line: 123,
column: 9
}
},
"40": {
start: {
line: 102,
column: 8
},
end: {
line: 105,
column: 9
}
},
"41": {
start: {
line: 104,
column: 10
},
end: {
line: 104,
column: 79
}
},
"42": {
start: {
line: 106,
column: 8
},
end: {
line: 115,
column: 9
}
},
"43": {
start: {
line: 107,
column: 27
},
end: {
line: 110,
column: 11
}
},
"44": {
start: {
line: 112,
column: 10
},
end: {
line: 112,
column: 34
}
},
"45": {
start: {
line: 113,
column: 10
},
end: {
line: 113,
column: 22
}
},
"46": {
start: {
line: 114,
column: 10
},
end: {
line: 114,
column: 17
}
},
"47": {
start: {
line: 117,
column: 8
},
end: {
line: 117,
column: 51
}
},
"48": {
start: {
line: 119,
column: 8
},
end: {
line: 122,
column: 11
}
},
"49": {
start: {
line: 126,
column: 4
},
end: {
line: 128,
column: 7
}
},
"50": {
start: {
line: 127,
column: 6
},
end: {
line: 127,
column: 16
}
},
"51": {
start: {
line: 131,
column: 4
},
end: {
line: 140,
column: 7
}
},
"52": {
start: {
line: 132,
column: 20
},
end: {
line: 132,
column: 36
}
},
"53": {
start: {
line: 133,
column: 23
},
end: {
line: 136,
column: 7
}
},
"54": {
start: {
line: 138,
column: 6
},
end: {
line: 138,
column: 32
}
},
"55": {
start: {
line: 139,
column: 6
},
end: {
line: 139,
column: 85
}
},
"56": {
start: {
line: 144,
column: 37
},
end: {
line: 169,
column: 1
}
},
"57": {
start: {
line: 145,
column: 2
},
end: {
line: 168,
column: 4
}
},
"58": {
start: {
line: 146,
column: 20
},
end: {
line: 149,
column: 5
}
},
"59": {
start: {
line: 151,
column: 4
},
end: {
line: 167,
column: 8
}
},
"60": {
start: {
line: 158,
column: 6
},
end: {
line: 161,
column: 7
}
},
"61": {
start: {
line: 159,
column: 8
},
end: {
line: 159,
column: 22
}
},
"62": {
start: {
line: 160,
column: 8
},
end: {
line: 160,
column: 15
}
},
"63": {
start: {
line: 166,
column: 6
},
end: {
line: 166,
column: 46
}
},
"64": {
start: {
line: 171,
column: 35
},
end: {
line: 173,
column: 1
}
},
"65": {
start: {
line: 172,
column: 2
},
end: {
line: 172,
column: 44
}
},
"66": {
start: {
line: 175,
column: 33
},
end: {
line: 193,
column: 1
}
},
"67": {
start: {
line: 176,
column: 2
},
end: {
line: 192,
column: 4
}
},
"68": {
start: {
line: 177,
column: 20
},
end: {
line: 181,
column: 5
}
},
"69": {
start: {
line: 183,
column: 4
},
end: {
line: 191,
column: 44
}
},
"70": {
start: {
line: 195,
column: 17
},
end: {
line: 230,
column: 1
}
},
"71": {
start: {
line: 196,
column: 26
},
end: {
line: 196,
column: 72
}
},
"72": {
start: {
line: 197,
column: 25
},
end: {
line: 198,
column: 70
}
},
"73": {
start: {
line: 199,
column: 23
},
end: {
line: 199,
column: 74
}
},
"74": {
start: {
line: 200,
column: 21
},
end: {
line: 201,
column: 66
}
},
"75": {
start: {
line: 203,
column: 2
},
end: {
line: 229,
column: 5
}
},
"76": {
start: {
line: 204,
column: 4
},
end: {
line: 217,
column: 7
}
},
"77": {
start: {
line: 205,
column: 6
},
end: {
line: 214,
column: 7
}
},
"78": {
start: {
line: 206,
column: 25
},
end: {
line: 209,
column: 9
}
},
"79": {
start: {
line: 211,
column: 8
},
end: {
line: 211,
column: 32
}
},
"80": {
start: {
line: 212,
column: 8
},
end: {
line: 212,
column: 20
}
},
"81": {
start: {
line: 213,
column: 8
},
end: {
line: 213,
column: 15
}
},
"82": {
start: {
line: 216,
column: 6
},
end: {
line: 216,
column: 20
}
},
"83": {
start: {
line: 219,
column: 4
},
end: {
line: 228,
column: 7
}
}
},
fnMap: {
"0": {
name: "(anonymous_0)",
decl: {
start: {
line: 17,
column: 39
},
end: {
line: 17,
column: 40
}
},
loc: {
start: {
line: 17,
column: 65
},
end: {
line: 52,
column: 1
}
},
line: 17
},
"1": {
name: "(anonymous_1)",
decl: {
start: {
line: 54,
column: 15
},
end: {
line: 54,
column: 16
}
},
loc: {
start: {
line: 54,
column: 96
},
end: {
line: 142,
column: 1
}
},
line: 54
},
"2": {
name: "(anonymous_2)",
decl: {
start: {
line: 55,
column: 21
},
end: {
line: 55,
column: 22
}
},
loc: {
start: {
line: 55,
column: 42
},
end: {
line: 141,
column: 3
}
},
line: 55
},
"3": {
name: "(anonymous_3)",
decl: {
start: {
line: 96,
column: 52
},
end: {
line: 96,
column: 53
}
},
loc: {
start: {
line: 96,
column: 63
},
end: {
line: 124,
column: 5
}
},
line: 96
},
"4": {
name: "(anonymous_4)",
decl: {
start: {
line: 101,
column: 52
},
end: {
line: 101,
column: 53
}
},
loc: {
start: {
line: 101,
column: 70
},
end: {
line: 123,
column: 7
}
},
line: 101
},
"5": {
name: "(anonymous_5)",
decl: {
start: {
line: 126,
column: 50
},
end: {
line: 126,
column: 51
}
},
loc: {
start: {
line: 126,
column: 56
},
end: {
line: 128,
column: 5
}
},
line: 126
},
"6": {
name: "(anonymous_6)",
decl: {
start: {
line: 131,
column: 50
},
end: {
line: 131,
column: 51
}
},
loc: {
start: {
line: 131,
column: 56
},
end: {
line: 140,
column: 5
}
},
line: 131
},
"7": {
name: "(anonymous_7)",
decl: {
start: {
line: 144,
column: 37
},
end: {
line: 144,
column: 38
}
},
loc: {
start: {
line: 144,
column: 69
},
end: {
line: 169,
column: 1
}
},
line: 144
},
"8": {
name: "(anonymous_8)",
decl: {
start: {
line: 145,
column: 9
},
end: {
line: 145,
column: 10
}
},
loc: {
start: {
line: 145,
column: 35
},
end: {
line: 168,
column: 3
}
},
line: 145
},
"9": {
name: "(anonymous_9)",
decl: {
start: {
line: 157,
column: 27
},
end: {
line: 157,
column: 28
}