videojs-contrib-eme
Version:
Supports Encrypted Media Extensions for playback of encrypted content in Video.js
2,401 lines (2,332 loc) • 495 kB
JavaScript
/*! @name videojs-contrib-eme @version 5.5.1 @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_1l0no6s9gj() {
var path = "/Users/harishaswaminathan/videojs-contrib-eme/src/cdm.js";
var hash = "5fd5ba416f7bccf61d5966620606ac7e3e97aa74";
var global = new Function("return this")();
var gcv = "__coverage__";
var coverageData = {
path: "/Users/harishaswaminathan/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: "5fd5ba416f7bccf61d5966620606ac7e3e97aa74"
};
var coverage = global[gcv] || (global[gcv] = {});
if (!coverage[path] || coverage[path].hash !== hash) {
coverage[path] = coverageData;
}
var actualCoverage = coverage[path];
{
// @ts-ignore
cov_1l0no6s9gj = function () {
return actualCoverage;
};
}
return actualCoverage;
}
cov_1l0no6s9gj();
const genericConfig = (cov_1l0no6s9gj().s[0]++, [{
initDataTypes: ['cenc'],
audioCapabilities: [{
contentType: 'audio/mp4;codecs="mp4a.40.2"'
}],
videoCapabilities: [{
contentType: 'video/mp4;codecs="avc1.42E01E"'
}]
}]);
const keySystems = (cov_1l0no6s9gj().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_1l0no6s9gj().s[2]++;
const detectSupportedCDMs = () => {
cov_1l0no6s9gj().f[0]++;
const Promise = (cov_1l0no6s9gj().s[3]++, window_1.Promise);
const results = (cov_1l0no6s9gj().s[4]++, {
fairplay: Boolean(window_1.WebKitMediaKeys),
playready: false,
widevine: false,
clearkey: false
});
cov_1l0no6s9gj().s[5]++;
if ((cov_1l0no6s9gj().b[1][0]++, !window_1.MediaKeys) || (cov_1l0no6s9gj().b[1][1]++, !window_1.navigator.requestMediaKeySystemAccess)) {
cov_1l0no6s9gj().b[0][0]++;
cov_1l0no6s9gj().s[6]++;
return Promise.resolve(results);
} else {
cov_1l0no6s9gj().b[0][1]++;
}
cov_1l0no6s9gj().s[7]++;
return Promise.all(keySystems.map(({
keySystem,
supportedConfig
}) => {
cov_1l0no6s9gj().f[1]++;
cov_1l0no6s9gj().s[8]++;
return window_1.navigator.requestMediaKeySystemAccess(keySystem, supportedConfig).catch(() => {
cov_1l0no6s9gj().f[2]++;
});
})).then(([fairplay, playready, widevine, clearkey]) => {
cov_1l0no6s9gj().f[3]++;
cov_1l0no6s9gj().s[9]++;
results.fairplay = Boolean(fairplay);
cov_1l0no6s9gj().s[10]++;
results.playready = Boolean(playready);
cov_1l0no6s9gj().s[11]++;
results.widevine = Boolean(widevine);
cov_1l0no6s9gj().s[12]++;
results.clearkey = Boolean(clearkey);
cov_1l0no6s9gj().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);
});
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_n0zvjkcx1() {
var path = "/Users/harishaswaminathan/videojs-contrib-eme/src/utils.js";
var hash = "398f6ab1ffdb66009e6290a7a7e4a1791b425ee7";
var global = new Function("return this")();
var gcv = "__coverage__";
var coverageData = {
path: "/Users/harishaswaminathan/videojs-contrib-eme/src/utils.js",
statementMap: {
"0": {
start: {
line: 5,
column: 35
},
end: {
line: 15,
column: 1
}
},
"1": {
start: {
line: 7,
column: 17
},
end: {
line: 7,
column: 51
}
},
"2": {
start: {
line: 8,
column: 16
},
end: {
line: 8,
column: 39
}
},
"3": {
start: {
line: 10,
column: 2
},
end: {
line: 12,
column: 3
}
},
"4": {
start: {
line: 10,
column: 15
},
end: {
line: 10,
column: 16
}
},
"5": {
start: {
line: 11,
column: 4
},
end: {
line: 11,
column: 36
}
},
"6": {
start: {
line: 14,
column: 2
},
end: {
line: 14,
column: 15
}
},
"7": {
start: {
line: 17,
column: 34
},
end: {
line: 19,
column: 1
}
},
"8": {
start: {
line: 18,
column: 2
},
end: {
line: 18,
column: 80
}
},
"9": {
start: {
line: 21,
column: 35
},
end: {
line: 23,
column: 1
}
},
"10": {
start: {
line: 22,
column: 2
},
end: {
line: 22,
column: 81
}
},
"11": {
start: {
line: 25,
column: 34
},
end: {
line: 30,
column: 1
}
},
"12": {
start: {
line: 26,
column: 15
},
end: {
line: 26,
column: 42
}
},
"13": {
start: {
line: 28,
column: 2
},
end: {
line: 28,
column: 18
}
},
"14": {
start: {
line: 29,
column: 2
},
end: {
line: 29,
column: 23
}
},
"15": {
start: {
line: 32,
column: 33
},
end: {
line: 51,
column: 1
}
},
"16": {
start: {
line: 33,
column: 2
},
end: {
line: 35,
column: 3
}
},
"17": {
start: {
line: 34,
column: 4
},
end: {
line: 34,
column: 16
}
},
"18": {
start: {
line: 37,
column: 2
},
end: {
line: 39,
column: 3
}
},
"19": {
start: {
line: 38,
column: 4
},
end: {
line: 38,
column: 17
}
},
"20": {
start: {
line: 41,
column: 20
},
end: {
line: 41,
column: 46
}
},
"21": {
start: {
line: 42,
column: 20
},
end: {
line: 42,
column: 46
}
},
"22": {
start: {
line: 44,
column: 2
},
end: {
line: 48,
column: 3
}
},
"23": {
start: {
line: 44,
column: 15
},
end: {
line: 44,
column: 16
}
},
"24": {
start: {
line: 45,
column: 4
},
end: {
line: 47,
column: 5
}
},
"25": {
start: {
line: 46,
column: 6
},
end: {
line: 46,
column: 19
}
},
"26": {
start: {
line: 50,
column: 2
},
end: {
line: 50,
column: 14
}
},
"27": {
start: {
line: 53,
column: 31
},
end: {
line: 60,
column: 1
}
},
"28": {
start: {
line: 54,
column: 2
},
end: {
line: 57,
column: 3
}
},
"29": {
start: {
line: 56,
column: 4
},
end: {
line: 56,
column: 37
}
},
"30": {
start: {
line: 59,
column: 2
},
end: {
line: 59,
column: 28
}
},
"31": {
start: {
line: 63,
column: 21
},
end: {
line: 68,
column: 1
}
},
"32": {
start: {
line: 64,
column: 18
},
end: {
line: 64,
column: 40
}
},
"33": {
start: {
line: 65,
column: 13
},
end: {
line: 65,
column: 50
}
},
"34": {
start: {
line: 67,
column: 2
},
end: {
line: 67,
column: 33
}
},
"35": {
start: {
line: 70,
column: 34
},
end: {
line: 81,
column: 1
}
},
"36": {
start: {
line: 71,
column: 17
},
end: {
line: 71,
column: 31
}
},
"37": {
start: {
line: 74,
column: 2
},
end: {
line: 78,
column: 5
}
},
"38": {
start: {
line: 75,
column: 4
},
end: {
line: 77,
column: 5
}
},
"39": {
start: {
line: 76,
column: 6
},
end: {
line: 76,
column: 23
}
},
"40": {
start: {
line: 80,
column: 2
},
end: {
line: 80,
column: 16
}
},
"41": {
start: {
line: 89,
column: 47
},
end: {
line: 98,
column: 1
}
},
"42": {
start: {
line: 90,
column: 17
},
end: {
line: 90,
column: 19
}
},
"43": {
start: {
line: 92,
column: 2
},
end: {
line: 96,
column: 5
}
},
"44": {
start: {
line: 93,
column: 33
},
end: {
line: 93,
column: 96
}
},
"45": {
start: {
line: 95,
column: 4
},
end: {
line: 95,
column: 38
}
},
"46": {
start: {
line: 97,
column: 2
},
end: {
line: 97,
column: 16
}
}
},
fnMap: {
"0": {
name: "(anonymous_0)",
decl: {
start: {
line: 5,
column: 35
},
end: {
line: 5,
column: 36
}
},
loc: {
start: {
line: 5,
column: 47
},
end: {
line: 15,
column: 1
}
},
line: 5
},
"1": {
name: "(anonymous_1)",
decl: {
start: {
line: 17,
column: 34
},
end: {
line: 17,
column: 35
}
},
loc: {
start: {
line: 17,
column: 45
},
end: {
line: 19,
column: 1
}
},
line: 17
},
"2": {
name: "(anonymous_2)",
decl: {
start: {
line: 21,
column: 35
},
end: {
line: 21,
column: 36
}
},
loc: {
start: {
line: 21,
column: 46
},
end: {
line: 23,
column: 1
}
},
line: 21
},
"3": {
name: "(anonymous_3)",
decl: {
start: {
line: 25,
column: 34
},
end: {
line: 25,
column: 35
}
},
loc: {
start: {
line: 25,
column: 43
},
end: {
line: 30,
column: 1
}
},
line: 25
},
"4": {
name: "(anonymous_4)",
decl: {
start: {
line: 32,
column: 33
},
end: {
line: 32,
column: 34
}
},
loc: {
start: {
line: 32,
column: 65
},
end: {
line: 51,
column: 1
}
},
line: 32
},
"5": {
name: "(anonymous_5)",
decl: {
start: {
line: 53,
column: 31
},
end: {
line: 53,
column: 32
}
},
loc: {
start: {
line: 53,
column: 55
},
end: {
line: 60,
column: 1
}
},
line: 53
},
"6": {
name: "(anonymous_6)",
decl: {
start: {
line: 63,
column: 21
},
end: {
line: 63,
column: 22
}
},
loc: {
start: {
line: 63,
column: 34
},
end: {
line: 68,
column: 1
}
},
line: 63
},
"7": {
name: "(anonymous_7)",
decl: {
start: {
line: 70,
column: 34
},
end: {
line: 70,
column: 35
}
},
loc: {
start: {
line: 70,
column: 47
},
end: {
line: 81,
column: 1
}
},
line: 70
},
"8": {
name: "(anonymous_8)",
decl: {
start: {
line: 74,
column: 30
},
end: {
line: 74,
column: 31
}
},
loc: {
start: {
line: 74,
column: 35
},
end: {
line: 78,
column: 3
}
},
line: 74
},
"9": {
name: "(anonymous_9)",
decl: {
start: {
line: 89,
column: 47
},
end: {
line: 89,
column: 48
}
},
loc: {
start: {
line: 89,
column: 63
},
end: {
line: 98,
column: 1
}
},
line: 89
},
"10": {
name: "(anonymous_10)",
decl: {
start: {
line: 92,
column: 34
},
end: {
line: 92,
column: 35
}
},
loc: {
start: {
line: 92,
column: 49
},
end: {
line: 96,
column: 3
}
},
line: 92
}
},
branchMap: {
"0": {
loc: {
start: {
line: 18,
column: 56
},
end: {
line: 18,
column: 77
}
},
type: "binary-expr",
locations: [{
start: {
line: 18,
column: 56
},
end: {
line: 18,
column: 68
}
}, {
start: {
line: 18,
column: 72
},
end: {
line: 18,
column: 77
}
}],
line: 18
},
"1": {
loc: {
start: {
line: 22,
column: 57
},
end: {
line: 22,
column: 78
}
},
type: "binary-expr",
locations: [{
start: {
line: 22,
column: 57
},
end: {
line: 22,
column: 69
}
}, {
start: {
line: 22,
column: 73
},
end: {
line: 22,
column: 78
}
}],
line: 22
},
"2": {
loc: {
start: {
line: 33,
column: 2
},
end: {
line: 35,
column: 3
}
},
type: "if",
locations: [{
start: {
line: 33,
column: 2
},
end: {
line: 35,
column: 3
}
}, {
start: {
line: 33,
column: 2
},
end: {
line: 35,
column: 3
}
}],
line: 33
},
"3": {
loc: {
start: {
line: 37,
column: 2
},
end: {
line: 39,
column: 3
}
},
type: "if",
locations: [{
start: {
line: 37,
column: 2
},
end: {
line: 39,
column: 3
}
}, {
start: {
line: 37,
column: 2
},
end: {
line: 39,
column: 3
}
}],
line: 37
},
"4": {
loc: {
start: {
line: 45,
column: 4
},
end: {
line: 47,
column: 5
}
},
type: "if",
locations: [{
start: {
line: 45,
column: 4
},
end: {
line: 47,
column: 5
}
}, {
start: {
line: 45,
column: 4
},
end: {
line: 47,
column: 5
}
}],
line: 45
},
"5": {
loc: {
start: {
line: 54,
column: 2
},
end: {
line: 57,
column: 3
}
},
type: "if",
locations: [{
start: {
line: 54,
column: 2
},
end: {
line: 57,
column: 3
}
}, {
start: {
line: 54,
column: 2
},
end: {
line: 57,
column: 3
}
}],
line: 54
},
"6": {
loc: {
start: {
line: 54,
column: 6
},
end: {
line: 55,
column: 47
}
},
type: "binary-expr",
locations: [{
start: {
line: 54,
column: 6
},
end: {
line: 54,
column: 46
}
}, {
start: {
line: 55,
column: 6
},
end: {
line: 55,
column: 47
}
}],
line: 54
},
"7": {
loc: {
start: {
line: 64,
column: 18
},
end: {
line: 64,
column: 40
}
},
type: "binary-expr",
locations: [{
start: {
line: 64,
column: 18
},
end: {
line: 64,
column: 29
}
}, {
start: {
line: 64,
column: 33
},
end: {
line: 64,
column: 40
}
}],
line: 64
},
"8": {
loc: {
start: {
line: 65,
column: 13
},
end: {
line: 65,
column: 50
}
},
type: "binary-expr",
locations: [{
start: {
line: 65,
column: 13
},
end: {
line: 65,
column: 26
}
}, {
start: {
line: 65,
column: 30
},
end: {
line: 65,
column: 50
}
}],
line: 65
},
"9": {
loc: {
start: {
line: 75,
column: 4
},
end: {
line: 77,
column: 5
}
},
type: "if",
locations: [{
start: {
line: 75,
column: 4
},
end: {
line: 77,
column: 5
}
}, {
start: {
line: 75,
column: 4
},
end: {
line: 77,
column: 5
}
}],
line: 75
}
},
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,
"14": 0,
"15": 0,
"16": 0,
"17": 0,
"18": 0,
"19": 0,
"20": 0,
"21": 0,
"22": 0,
"23": 0,
"24": 0,
"25": 0,
"26": 0,
"27": 0,
"28": 0,
"29": 0,
"30": 0,
"31": 0,
"32": 0,
"33": 0,
"34": 0,
"35": 0,
"36": 0,
"37": 0,
"38": 0,
"39": 0,
"40": 0,
"41": 0,
"42": 0,
"43": 0,
"44": 0,
"45": 0,
"46": 0
},
f: {
"0": 0,
"1": 0,
"2": 0,
"3": 0,
"4": 0,
"5": 0,
"6": 0,
"7": 0,
"8": 0,
"9": 0,
"10": 0
},
b: {
"0": [0, 0],
"1": [0, 0],
"2": [0, 0],
"3": [0, 0],
"4": [0, 0],
"5": [0, 0],
"6": [0, 0],
"7": [0, 0],
"8": [0, 0],
"9": [0, 0]
},
_coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
hash: "398f6ab1ffdb66009e6290a7a7e4a1791b425ee7"
};
var coverage = global[gcv] || (global[gcv] = {});
if (!coverage[path] || coverage[path].hash !== hash) {
coverage[path] = coverageData;
}
var actualCoverage = coverage[path];
{
// @ts-ignore
cov_n0zvjkcx1 = function () {
return actualCoverage;
};
}
return actualCoverage;
}
cov_n0zvjkcx1();
cov_n0zvjkcx1().s[0]++;
const stringToUint16Array = string => {
cov_n0zvjkcx1().f[0]++; // 2 bytes for each char
const buffer = (cov_n0zvjkcx1().s[1]++, new ArrayBuffer(string.length * 2));
const array = (cov_n0zvjkcx1().s[2]++, new Uint16Array(buffer));
cov_n0zvjkcx1().s[3]++;
for (let i = (cov_n0zvjkcx1().s[4]++, 0); i < string.length; i++) {
cov_n0zvjkcx1().s[5]++;
array[i] = string.charCodeAt(i);
}
cov_n0zvjkcx1().s[6]++;
return array;
};
cov_n0zvjkcx1().s[7]++;
const uint8ArrayToString = array => {
cov_n0zvjkcx1().f[1]++;
cov_n0zvjkcx1().s[8]++;
return String.fromCharCode.apply(null, new Uint8Array((cov_n0zvjkcx1().b[0][0]++, array.buffer) || (cov_n0zvjkcx1().b[0][1]++, array)));
};
cov_n0zvjkcx1().s[9]++;
const uint16ArrayToString = array => {
cov_n0zvjkcx1().f[2]++;
cov_n0zvjkcx1().s[10]++;
return String.fromCharCode.apply(null, new Uint16Array((cov_n0zvjkcx1().b[1][0]++, array.buffer) || (cov_n0zvjkcx1().b[1][1]++, array)));
};
cov_n0zvjkcx1().s[11]++;
const getHostnameFromUri = uri => {
cov_n0zvjkcx1().f[3]++;
const link = (cov_n0zvjkcx1().s[12]++, document_1.createElement('a'));
cov_n0zvjkcx1().s[13]++;
link.href = uri;
cov_n0zvjkcx1().s[14]++;
return link.hostname;
};
cov_n0zvjkcx1().s[15]++;
const arrayBuffersEqual = (arrayBuffer1, arrayBuffer2) => {
cov_n0zvjkcx1().f[4]++;
cov_n0zvjkcx1().s[16]++;
if (arrayBuffer1 === arrayBuffer2) {
cov_n0zvjkcx1().b[2][0]++;
cov_n0zvjkcx1().s[17]++;
return true;
} else {
cov_n0zvjkcx1().b[2][1]++;
}
cov_n0zvjkcx1().s[18]++;
if (arrayBuffer1.byteLength !== arrayBuffer2.byteLength) {
cov_n0zvjkcx1().b[3][0]++;
cov_n0zvjkcx1().s[19]++;
return false;
} else {
cov_n0zvjkcx1().b[3][1]++;
}
const dataView1 = (cov_n0zvjkcx1().s[20]++, new DataView(arrayBuffer1));
const dataView2 = (cov_n0zvjkcx1().s[21]++, new DataView(arrayBuffer2));
cov_n0zvjkcx1().s[22]++;
for (let i = (cov_n0zvjkcx1().s[23]++, 0); i < dataView1.byteLength; i++) {
cov_n0zvjkcx1().s[24]++;
if (dataView1.getUint8(i) !== dataView2.getUint8(i)) {
cov_n0zvjkcx1().b[4][0]++;
cov_n0zvjkcx1().s[25]++;
return false;
} else {
cov_n0zvjkcx1().b[4][1]++;
}
}
cov_n0zvjkcx1().s[26]++;
return true;
};
cov_n0zvjkcx1().s[27]++;
const arrayBufferFrom = bufferOrTypedArray => {
cov_n0zvjkcx1().f[5]++;
cov_n0zvjkcx1().s[28]++;
if ((cov_n0zvjkcx1().b[6][0]++, bufferOrTypedArray instanceof Uint8Array) || (cov_n0zvjkcx1().b[6][1]++, bufferOrTypedArray instanceof Uint16Array)) {
cov_n0zvjkcx1().b[5][0]++;
cov_n0zvjkcx1().s[29]++;
return bufferOrTypedArray.buffer;
} else {
cov_n0zvjkcx1().b[5][1]++;
}
cov_n0zvjkcx1().s[30]++;
return bufferOrTypedArray;
}; // Normalize between Video.js 6/7 (videojs.mergeOptions) and 8 (videojs.obj.merge).
cov_n0zvjkcx1().s[31]++;
const merge = (...args) => {
cov_n0zvjkcx1().f[6]++;
const context = (cov_n0zvjkcx1().s[32]++, (cov_n0zvjkcx1().b[7][0]++, videojs__default["default"].obj) || (cov_n0zvjkcx1().b[7][1]++, videojs__default["default"]));
const fn = (cov_n0zvjkcx1().s[33]++, (cov_n0zvjkcx1().b[8][0]++, context.merge) || (cov_n0zvjkcx1().b[8][1]++, context.mergeOptions));
cov_n0zvjkcx1().s[34]++;
return fn.apply(context, args);
};
cov_n0zvjkcx1().s[35]++;
const mergeAndRemoveNull = (...args) => {
cov_n0zvjkcx1().f[7]++;
const result = (cov_n0zvjkcx1().s[36]++, merge(...args)); // Any header whose value is `null` will be removed.
cov_n0zvjkcx1().s[37]++;
Object.keys(result).forEach(k => {
cov_n0zvjkcx1().f[8]++;
cov_n0zvjkcx1().s[38]++;
if (result[k] === null) {
cov_n0zvjkcx1().b[9][0]++;
cov_n0zvjkcx1().s[39]++;
delete result[k];
} else {
cov_n0zvjkcx1().b[9][1]++;
}
});
cov_n0zvjkcx1().s[40]++;
return result;
};
/**
* Transforms the keySystems object into a MediaKeySystemConfiguration Object array.
*
* @param {Object} keySystems object from the options.
* @return {Array} of MediaKeySystemConfiguration objects.
*/
cov_n0zvjkcx1().s[41]++;
const getMediaKeySystemConfigurations = keySystems => {
cov_n0zvjkcx1().f[9]++;
const config = (cov_n0zvjkcx1().s[42]++, []);
cov_n0zvjkcx1().s[43]++;
Object.keys(keySystems).forEach(keySystem => {
cov_n0zvjkcx1().f[10]++;
const mediaKeySystemConfig = (cov_n0zvjkcx1().s[44]++, getSupportedConfigurations(keySystem, keySystems[keySystem])[0]);
cov_n0zvjkcx1().s[45]++;
config.push(mediaKeySystemConfig);
});
cov_n0zvjkcx1().s[46]++;
return config;
};
function cov_dxrfrp6d5() {
var path = "/Users/harishaswaminathan/videojs-contrib-eme/src/http-handler.js";
var hash = "7c379fc0257b8857bbbb9cdcc2c507c5d0f2d1ef";
var global = new Function("return this")();
var gcv = "__coverage__";
var coverageData = {
path: "/Users/harishaswaminathan/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: "7c379fc0257b8857bbbb9cdcc2c507c5d0f2d1ef"
};
var coverage = global[gcv] || (global[gcv] = {});
if (!coverage[path] || coverage[path].hash !== hash) {
coverage[path] = coverageData;
}
var actualCoverage = coverage[path];
{
// @ts-ignore
cov_dxrfrp6d5 = function () {
return actualCoverage;
};
}
return actualCoverage;
}
cov_dxrfrp6d5();
let httpResponseHandler = (cov_dxrfrp6d5().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_dxrfrp6d5().s[1]++;
if (!httpResponseHandler) {
cov_dxrfrp6d5().b[0][0]++;
cov_dxrfrp6d5().s[2]++;
httpResponseHandler = (callback, decodeResponseBody) => {
cov_dxrfrp6d5().f[0]++;
cov_dxrfrp6d5().s[3]++;
return (err, response, responseBody) => {
cov_dxrfrp6d5().f[1]++;
cov_dxrfrp6d5().s[4]++;
if (err) {
cov_dxrfrp6d5().b[1][0]++;
cov_dxrfrp6d5().s[5]++;
callback(err);
cov_dxrfrp6d5().s[6]++;
return;
} else {
cov_dxrfrp6d5().b[1][1]++;
} // if the HTTP status code is 4xx or 5xx, the request also failed
cov_dxrfrp6d5().s[7]++;
if ((cov_dxrfrp6d5().b[3][0]++, response.statusCode >= 400) && (cov_dxrfrp6d5().b[3][1]++, response.statusCode <= 599)) {
cov_dxrfrp6d5().b[2][0]++;
let cause = (cov_dxrfrp6d5().s[8]++, responseBody);
cov_dxrfrp6d5().s[9]++;
if (decodeResponseBody) {
cov_dxrfrp6d5().b[4][0]++;
cov_dxrfrp6d5().s[10]++;
cause = String.fromCharCode.apply(null, new Uint8Array(responseBody));
} else {
cov_dxrfrp6d5().b[4][1]++;
}
cov_dxrfrp6d5().s[11]++;
callback({
cause
});
cov_dxrfrp6d5().s[12]++;
return;
} else {
cov_dxrfrp6d5().b[2][1]++;
} // otherwise, request succeeded
cov_dxrfrp6d5().s[13]++;
callback(null, responseBody);
};
};
} else {
cov_dxrfrp6d5().b[0][1]++;
}
function cov_1jp3z7j48a() {
var path = "/Users/harishaswaminathan/videojs-contrib-eme/src/playready.js";
var hash = "032254b82a75cb7201161be170d85e77a585bd71";
var global = new Function("return this")();
var gcv = "__coverage__";
var coverageData = {
path: "/Users/harishaswaminathan/videojs-contrib-eme/src/playready.js",
statementMap: {
"0": {
start: {
line: 14,
column: 34
},
end: {
line: 53,
column: 1
}
},
"1": {
start: {
line: 16,
column: 20