videojs-shaka
Version:
video.js shaka player tech
2,559 lines (2,495 loc) • 140 kB
JavaScript
/*! @name videojs-shaka @version 1.1.2 @license MIT */
(function (QUnit, sinon, videojs) {
'use strict';
QUnit = QUnit && QUnit.hasOwnProperty('default') ? QUnit['default'] : QUnit;
sinon = sinon && sinon.hasOwnProperty('default') ? sinon['default'] : sinon;
videojs = videojs && videojs.hasOwnProperty('default') ? videojs['default'] : videojs;
var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
var minDoc = {};
var topLevel = typeof commonjsGlobal !== 'undefined' ? commonjsGlobal :
typeof window !== 'undefined' ? window : {};
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 || 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 _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
var cov_nbiqdwo7g = function () {
var path = '/Users/dave/Source/shaka-player/videojs-shaka/src/setup-quality-tracks.js',
hash = '88b0891a55e62ebdcfae0a7e33954fcb0f1ed8a9',
Function = function () {}.constructor,
global = new Function('return this')(),
gcv = '__coverage__',
coverageData = {
path: '/Users/dave/Source/shaka-player/videojs-shaka/src/setup-quality-tracks.js',
statementMap: {
'0': {
start: {
line: 3,
column: 17
},
end: {
line: 3,
column: 19
}
},
'1': {
start: {
line: 4,
column: 17
},
end: {
line: 6,
column: 4
}
},
'2': {
start: {
line: 5,
column: 4
},
end: {
line: 5,
column: 32
}
},
'3': {
start: {
line: 8,
column: 2
},
end: {
line: 17,
column: 3
}
},
'4': {
start: {
line: 10,
column: 22
},
end: {
line: 14,
column: 5
}
},
'5': {
start: {
line: 16,
column: 4
},
end: {
line: 16,
column: 27
}
},
'6': {
start: {
line: 19,
column: 2
},
end: {
line: 34,
column: 5
}
},
'7': {
start: {
line: 21,
column: 18
},
end: {
line: 21,
column: 23
}
},
'8': {
start: {
line: 23,
column: 16
},
end: {
line: 23,
column: 18
}
},
'9': {
start: {
line: 24,
column: 4
},
end: {
line: 30,
column: 5
}
},
'10': {
start: {
line: 25,
column: 6
},
end: {
line: 25,
column: 22
}
},
'11': {
start: {
line: 26,
column: 11
},
end: {
line: 30,
column: 5
}
},
'12': {
start: {
line: 27,
column: 6
},
end: {
line: 27,
column: 22
}
},
'13': {
start: {
line: 28,
column: 11
},
end: {
line: 30,
column: 5
}
},
'14': {
start: {
line: 29,
column: 6
},
end: {
line: 29,
column: 22
}
},
'15': {
start: {
line: 31,
column: 4
},
end: {
line: 31,
column: 45
}
},
'16': {
start: {
line: 33,
column: 4
},
end: {
line: 33,
column: 23
}
},
'17': {
start: {
line: 37,
column: 23
},
end: {
line: 67,
column: 71
}
},
'18': {
start: {
line: 39,
column: 6
},
end: {
line: 41,
column: 7
}
},
'19': {
start: {
line: 40,
column: 8
},
end: {
line: 40,
column: 18
}
},
'20': {
start: {
line: 42,
column: 6
},
end: {
line: 44,
column: 7
}
},
'21': {
start: {
line: 43,
column: 8
},
end: {
line: 43,
column: 17
}
},
'22': {
start: {
line: 45,
column: 6
},
end: {
line: 47,
column: 7
}
},
'23': {
start: {
line: 46,
column: 8
},
end: {
line: 46,
column: 18
}
},
'24': {
start: {
line: 48,
column: 6
},
end: {
line: 50,
column: 7
}
},
'25': {
start: {
line: 49,
column: 8
},
end: {
line: 49,
column: 17
}
},
'26': {
start: {
line: 51,
column: 6
},
end: {
line: 53,
column: 7
}
},
'27': {
start: {
line: 52,
column: 8
},
end: {
line: 52,
column: 18
}
},
'28': {
start: {
line: 54,
column: 6
},
end: {
line: 56,
column: 7
}
},
'29': {
start: {
line: 55,
column: 8
},
end: {
line: 55,
column: 17
}
},
'30': {
start: {
line: 57,
column: 6
},
end: {
line: 57,
column: 15
}
},
'31': {
start: {
line: 60,
column: 6
},
end: {
line: 65,
column: 7
}
},
'32': {
start: {
line: 62,
column: 8
},
end: {
line: 62,
column: 50
}
},
'33': {
start: {
line: 63,
column: 8
},
end: {
line: 63,
column: 54
}
},
'34': {
start: {
line: 64,
column: 8
},
end: {
line: 64,
column: 37
}
},
'35': {
start: {
line: 66,
column: 6
},
end: {
line: 66,
column: 25
}
},
'36': {
start: {
line: 69,
column: 2
},
end: {
line: 69,
column: 22
}
},
'37': {
start: {
line: 74,
column: 2
},
end: {
line: 103,
column: 5
}
},
'38': {
start: {
line: 81,
column: 6
},
end: {
line: 85,
column: 9
}
},
'39': {
start: {
line: 88,
column: 6
},
end: {
line: 88,
column: 28
}
},
'40': {
start: {
line: 88,
column: 21
},
end: {
line: 88,
column: 28
}
},
'41': {
start: {
line: 90,
column: 21
},
end: {
line: 92,
column: 8
}
},
'42': {
start: {
line: 91,
column: 8
},
end: {
line: 91,
column: 51
}
},
'43': {
start: {
line: 94,
column: 6
},
end: {
line: 94,
column: 72
}
},
'44': {
start: {
line: 98,
column: 6
},
end: {
line: 101,
column: 7
}
},
'45': {
start: {
line: 99,
column: 22
},
end: {
line: 99,
column: 64
}
},
'46': {
start: {
line: 100,
column: 8
},
end: {
line: 100,
column: 41
}
}
},
fnMap: {
'0': {
name: '_getQuality',
decl: {
start: {
line: 1,
column: 9
},
end: {
line: 1,
column: 20
}
},
loc: {
start: {
line: 1,
column: 40
},
end: {
line: 70,
column: 1
}
},
line: 1
},
'1': {
name: '(anonymous_1)',
decl: {
start: {
line: 4,
column: 55
},
end: {
line: 4,
column: 56
}
},
loc: {
start: {
line: 4,
column: 67
},
end: {
line: 6,
column: 3
}
},
line: 4
},
'2': {
name: '(anonymous_2)',
decl: {
start: {
line: 19,
column: 17
},
end: {
line: 19,
column: 18
}
},
loc: {
start: {
line: 19,
column: 40
},
end: {
line: 34,
column: 3
}
},
line: 19
},
'3': {
name: '(anonymous_3)',
decl: {
start: {
line: 38,
column: 10
},
end: {
line: 38,
column: 11
}
},
loc: {
start: {
line: 38,
column: 30
},
end: {
line: 58,
column: 5
}
},
line: 38
},
'4': {
name: '(anonymous_4)',
decl: {
start: {
line: 59,
column: 12
},
end: {
line: 59,
column: 13
}
},
loc: {
start: {
line: 59,
column: 36
},
end: {
line: 67,
column: 5
}
},
line: 59
},
'5': {
name: 'setupQualityTracks',
decl: {
start: {
line: 72,
column: 24
},
end: {
line: 72,
column: 42
}
},
loc: {
start: {
line: 72,
column: 62
},
end: {
line: 104,
column: 1
}
},
line: 72
},
'6': {
name: '(anonymous_6)',
decl: {
start: {
line: 78,
column: 27
},
end: {
line: 78,
column: 28
}
},
loc: {
start: {
line: 78,
column: 46
},
end: {
line: 102,
column: 5
}
},
line: 78
},
'7': {
name: '(anonymous_7)',
decl: {
start: {
line: 90,
column: 59
},
end: {
line: 90,
column: 60
}
},
loc: {
start: {
line: 90,
column: 71
},
end: {
line: 92,
column: 7
}
},
line: 90
}
},
branchMap: {
'0': {
loc: {
start: {
line: 8,
column: 2
},
end: {
line: 17,
column: 3
}
},
type: 'if',
locations: [{
start: {
line: 8,
column: 2
},
end: {
line: 17,
column: 3
}
}, {
start: {
line: 8,
column: 2
},
end: {
line: 17,
column: 3
}
}],
line: 8
},
'1': {
loc: {
start: {
line: 24,
column: 4
},
end: {
line: 30,
column: 5
}
},
type: 'if',
locations: [{
start: {
line: 24,
column: 4
},
end: {
line: 30,
column: 5
}
}, {
start: {
line: 24,
column: 4
},
end: {
line: 30,
column: 5
}
}],
line: 24
},
'2': {
loc: {
start: {
line: 26,
column: 11
},
end: {
line: 30,
column: 5
}
},
type: 'if',
locations: [{
start: {
line: 26,
column: 11
},
end: {
line: 30,
column: 5
}
}, {
start: {
line: 26,
column: 11
},
end: {
line: 30,
column: 5
}
}],
line: 26
},
'3': {
loc: {
start: {
line: 28,
column: 11
},
end: {
line: 30,
column: 5
}
},
type: 'if',
locations: [{
start: {
line: 28,
column: 11
},
end: {
line: 30,
column: 5
}
}, {
start: {
line: 28,
column: 11
},
end: {
line: 30,
column: 5
}
}],
line: 28
},
'4': {
loc: {
start: {
line: 39,
column: 6
},
end: {
line: 41,
column: 7
}
},
type: 'if',
locations: [{
start: {
line: 39,
column: 6
},
end: {
line: 41,
column: 7
}
}, {
start: {
line: 39,
column: 6
},
end: {
line: 41,
column: 7
}
}],
line: 39
},
'5': {
loc: {
start: {
line: 42,
column: 6
},
end: {
line: 44,
column: 7
}
},
type: 'if',
locations: [{
start: {
line: 42,
column: 6
},
end: {
line: 44,
column: 7
}
}, {
start: {
line: 42,
column: 6
},
end: {
line: 44,
column: 7
}
}],
line: 42
},
'6': {
loc: {
start: {
line: 45,
column: 6
},
end: {
line: 47,
column: 7
}
},
type: 'if',
locations: [{
start: {
line: 45,
column: 6
},
end: {
line: 47,
column: 7
}
}, {
start: {
line: 45,
column: 6
},
end: {
line: 47,
column: 7
}
}],
line: 45
},
'7': {
loc: {
start: {
line: 48,
column: 6
},
end: {
line: 50,
column: 7
}
},
type: 'if',
locations: [{
start: {
line: 48,
column: 6
},
end: {
line: 50,
column: 7
}
}, {
start: {
line: 48,
column: 6
},
end: {
line: 50,
column: 7
}
}],
line: 48
},
'8': {
loc: {
start: {
line: 51,
column: 6
},
end: {
line: 53,
column: 7
}
},
type: 'if',
locations: [{
start: {
line: 51,
column: 6
},
end: {
line: 53,
column: 7
}
}, {
start: {
line: 51,
column: 6
},
end: {
line: 53,
column: 7
}
}],
line: 51
},
'9': {
loc: {
start: {
line: 54,
column: 6
},
end: {
line: 56,
column: 7
}
},
type: 'if',
locations: [{
start: {
line: 54,
column: 6
},
end: {
line: 56,
column: 7
}
}, {
start: {
line: 54,
column: 6
},
end: {
line: 56,
column: 7
}
}],
line: 54
},
'10': {
loc: {
start: {
line: 60,
column: 6
},
end: {
line: 65,
column: 7
}
},
type: 'if',
locations: [{
start: {
line: 60,
column: 6
},
end: {
line: 65,
column: 7
}
}, {
start: {
line: 60,
column: 6
},
end: {
line: 65,
column: 7
}
}],
line: 60
},
'11': {
loc: {
start: {
line: 60,
column: 10
},
end: {
line: 61,
column: 104
}
},
type: 'binary-expr',
locations: [{
start: {
line: 60,
column: 10
},
end: {
line: 60,
column: 53
}
}, {
start: {
line: 61,
column: 9
},
end: {
line: 61,
column: 52
}
}, {
start: {
line: 61,
column: 56
},
end: {
line: 61,
column: 103
}
}],
line: 60
},
'12': {
loc: {
start: {
line: 88,
column: 6
},
end: {
line: 88,
column: 28
}
},
type: 'if',
locations: [{
start: {
line: 88,
column: 6
},
end: {
line: 88,
column: 28
}
}, {
start: {
line: 88,
column: 6
},
end: {
line: 88,
column: 28
}
}],
line: 88
},
'13': {
loc: {
start: {
line: 91,
column: 15
},
end: {
line: 91,
column: 50
}
},
type: 'binary-expr',
locations: [{
start: {
line: 91,
column: 15
},
end: {
line: 91,
column: 26
}
}, {
start: {
line: 91,
column: 30
},
end: {
line: 91,
column: 50
}
}],
line: 91
},
'14': {
loc: {
start: {
line: 98,
column: 6
},
end: {
line: 101,
column: 7
}
},
type: 'if',
locations: [{
start: {
line: 98,
column: 6
},
end: {
line: 101,
column: 7
}
}, {
start: {
line: 98,
column: 6
},
end: {
line: 101,
column: 7
}
}],
line: 98
}
},
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
},
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],
'10': [0, 0],
'11': [0, 0, 0],
'12': [0, 0],
'13': [0, 0],
'14': [0, 0]
},
_coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c'
},
coverage = global[gcv] || (global[gcv] = {});
if (coverage[path] && coverage[path].hash === hash) {
return coverage[path];
}
coverageData.hash = hash;
return coverage[path] = coverageData;
}();
function _getQuality(tech, shakaPlayer) {
cov_nbiqdwo7g.f[0]++;
var tracks = (cov_nbiqdwo7g.s[0]++, []);
var levels = (cov_nbiqdwo7g.s[1]++, shakaPlayer.getVariantTracks().filter(function (t) {
cov_nbiqdwo7g.f[1]++;
cov_nbiqdwo7g.s[2]++;
return t.type === 'variant';
}));
cov_nbiqdwo7g.s[3]++;
if (levels.length > 1) {
cov_nbiqdwo7g.b[0][0]++;
var autoLevel = (cov_nbiqdwo7g.s[4]++, {
id: -1,
label: 'auto',
selected: true
});
cov_nbiqdwo7g.s[5]++;
tracks.push(autoLevel);
} else {
cov_nbiqdwo7g.b[0][1]++;
}
cov_nbiqdwo7g.s[6]++;
levels.forEach(function (level, index) {
cov_nbiqdwo7g.f[2]++;
var track = (cov_nbiqdwo7g.s[7]++, level);
var label = (cov_nbiqdwo7g.s[8]++, '');
cov_nbiqdwo7g.s[9]++;
if (level.height >= 2160) {
cov_nbiqdwo7g.b[1][0]++;
cov_nbiqdwo7g.s[10]++;
label = ' (4k)';
} else {
cov_nbiqdwo7g.b[1][1]++;
cov_nbiqdwo7g.s[11]++;
if (level.height >= 1440) {
cov_nbiqdwo7g.b[2][0]++;
cov_nbiqdwo7g.s[12]++;
label = ' (2k)';
} else {
cov_nbiqdwo7g.b[2][1]++;
cov_nbiqdwo7g.s[13]++;
if (level.height >= 720) {
cov_nbiqdwo7g.b[3][0]++;
cov_nbiqdwo7g.s[14]++;
label = ' (HD)';
} else {
cov_nbiqdwo7g.b[3][1]++;
}
}
}
cov_nbiqdwo7g.s[15]++;
track.label = level.height + 'p' + label;
cov_nbiqdwo7g.s[16]++;
tracks.push(track);
});
var sortedTracks = (cov_nbiqdwo7g.s[17]++, tracks.sort(function (track1, track2) {
cov_nbiqdwo7g.f[3]++;
cov_nbiqdwo7g.s[18]++;
if (track1.language > track2.language) {
cov_nbiqdwo7g.b[4][0]++;
cov_nbiqdwo7g.s[19]++;
return -1;
} else {
cov_nbiqdwo7g.b[4][1]++;
}
cov_nbiqdwo7g.s[20]++;
if (track2.language > track1.language) {
cov_nbiqdwo7g.b[5][0]++;
cov_nbiqdwo7g.s[21]++;
return 1;
} else {
cov_nbiqdwo7g.b[5][1]++;
}
cov_nbiqdwo7g.s[22]++;
if (track1.height > track2.height) {
cov_nbiqdwo7g.b[6][0]++;
cov_nbiqdwo7g.s[23]++;
return -1;
} else {
cov_nbiqdwo7g.b[6][1]++;
}
cov_nbiqdwo7g.s[24]++;
if (track2.height > track1.height) {
cov_nbiqdwo7g.b[7][0]++;
cov_nbiqdwo7g.s[25]++;
return 1;
} else {
cov_nbiqdwo7g.b[7][1]++;
}
cov_nbiqdwo7g.s[26]++;
if (track1.bandwidth > track2.bandwidth) {
cov_nbiqdwo7g.b[8][0]++;
cov_nbiqdwo7g.s[27]++;
return -1;
} else {
cov_nbiqdwo7g.b[8][1]++;
}
cov_nbiqdwo7g.s[28]++;
if (track2.bandwidth > track1.bandwidth) {
cov_nbiqdwo7g.b[9][0]++;
cov_nbiqdwo7g.s[29]++;
return 1;
} else {
cov_nbiqdwo7g.b[9][1]++;
}
cov_nbiqdwo7g.s[30]++;
return 0;
}).reduce(function (accumulator, track) {
cov_nbiqdwo7g.f[4]++;
cov_nbiqdwo7g.s[31]++;
if ((cov_nbiqdwo7g.b[11][0]++, track.height !== accumulator.previousHeight) || (cov_nbiqdwo7g.b[11][1]++, track.height === accumulator.previousHeight) && (cov_nbiqdwo7g.b[11][2]++, track.language !== accumulator.previousLanguage)) {
cov_nbiqdwo7g.b[10][0]++;
cov_nbiqdwo7g.s[32]++;
accumulator.previousHeight = track.height;
cov_nbiqdwo7g.s[33]++;
accumulator.previousLanguage = track.language;
cov_nbiqdwo7g.s[34]++;
accumulator.list.push(track);
} else {
cov_nbiqdwo7g.b[10][1]++;
}
cov_nbiqdwo7g.s[35]++;
return accumulator;
}, {
previousHeight: null,
previousLanguage: null,
list: []
}).list);
cov_nbiqdwo7g.s[36]++;
return sortedTracks;
}
function setupQualityTracks(tech, shakaPlayer) {
cov_nbiqdwo7g.f[5]++;
cov_nbiqdwo7g.s[37]++;
tech.trigger('loadedqualitydata', {
qualityData: {
video: _getQuality(tech, shakaPlayer)
},
qualitySwitchCallback: function qualitySwitchCallback(id, type) {
cov_nbiqdwo7g.f[6]++;
cov_nbiqdwo7g.s[38]++;
shakaPlayer.configure({
abr: {
enabled: id === -1
}
});
cov_nbiqdwo7g.s[39]++;
if (id === -1) {
cov_nbiqdwo7g.b[12][0]++;
cov_nbiqdwo7g.s[40]++;
return;
} else {
cov_nbiqdwo7g.b[12][1]++;
}
var tracks = (cov_nbiqdwo7g.s[41]++, shakaPlayer.getVariantTracks().filter(function (t) {
cov_nbiqdwo7g.f[7]++;
cov_nbiqdwo7g.s[42]++;
return (cov_nbiqdwo7g.b[13][0]++, t.id === id) && (cov_nbiqdwo7g.b[13][1]++, t.type === 'variant');
}));
cov_nbiqdwo7g.s[43]++;
shakaPlayer.selectVariantTrack(tracks[0], true);
cov_nbiqdwo7g.s[44]++;
if (shaka.util.FakeEvent) {
cov_nbiqdwo7g.b[14][0]++;
var event = (cov_nbiqdwo7g.s[45]++, new shaka.util.FakeEvent('variantchanged'));
cov_nbiqdwo7g.s[46]++;
shakaPlayer.dispatchEvent(event);
} else {
cov_nbiqdwo7g.b[14][1]++;
}
}
});
}
var cov_2brk8x8uoa = function () {
var path = '/Users/dave/Source/shaka-player/videojs-shaka/src/setup-text-tracks.js',
hash = 'b6c7ba32c852f30a0d754443aee4abce6d7438b3',
Function = function () {}.constructor,
global = new Function('return this')(),
gcv = '__coverage__',
coverageData = {
path: '/Users/dave/Source/shaka-player/videojs-shaka/src/setup-text-tracks.js',
statementMap: {
'0': {
start: {
line: 2,
column: 2
},
end: {
line: 6,
column: 3
}
},
'1': {
start: {
line: 3,
column: 4
},
end: {
line: 5,
column: 5
}
},
'2': {
start: {
line: 4,
column: 6
},
end: {
line: 4,
column: 18
}
},
'3': {
start: {
line: 19,
column: 26
},
end: {
line: 19,
column: 28
}
},
'4': {
start: {
line: 22,
column: 25
},
end: {
line: 48,
column: 6
}
},
'5': {
start: {
line: 25,
column: 21
},
end: {
line: 33,
column: 5
}
},
'6': {
start: {
line: 37,
column: 30
},
end: {
line: 37,
column: 73
}
},
'7': {
start: {
line: 39,
column: 6
},
end: {
line: 39,
column: 74
}
},
'8': {
start: {
line: 47,
column: 6
},
end: {
line: 47,
column: 29
}
},
'9': {
start: {
line: 56,
column: 23
},
end: {
line: 56,
column: 40
}
},
'10': {
start: {
line: 60,
column: 4
},
end: {
line: 75,
column: 5
}
},
'11': {
start: {
line: 61,
column: 24
},
end: {
line: 61,
column: 37
}
},
'12': {
start: {
line: 63,
column: 6
},
end: {
line: 74,
column: 7
}
},
'13': {
start: {
line: 67,
column: 39
},
end: {
line: 68,
column: 51
}
},
'14': {
start: {
line: 68,
column: 21
},
end: {
line: 68,
column: 50
}
},
'15': {
start: {
line: 71,
column: 8
},
end: {
line: 73,
column: 15
}
},
'16': {
start: {
line: 78,
column: 4
},
end: {
line: 83,
column: 5
}
},
'17': {
start: {
line: 79,
column: 6
},
end: {
line: 79,
column: 55
}
},
'18': {
start: {
line: 80,
column: 6
},
end: {
line: 80,
column: 47
}
},
'19': {
start: {
line: 82,
column: 6
},
end: {
line: 82,
column: 48
}
},
'20': {
start: {
line: 88,
column: 2
},
end: {
line: 88,
column: 60
}
},
'21': {
start: {
line: 91,
column: 2
},
end: {
line: 93,
column: 5
}
},
'22': {
start: {
line: 92,
column: 4
},
end: {
line: 92,
column: 63
}
},
'23': {
start: {
line: 96,
column: 2
},
end: {
line: 96,
column: 30
}
},
'24': {
start: {
line: 98,
column: 2
},
end: {
line: 98,
column: 24
}
},
'25': {
start: {
line: 104,
column: 36
},
end: {
line: 104,
column: 38
}
},
'26': {
start: {
line: 108,
column: 4
},
end: {
line: 108,
column: 79
}
},
'27': {
start: {
line: 110,
column: 4
},
end: {
line: 110,
column: 37
}
},
'28': {
start: {
line: 116,
column: 4
},
end: {
line: 116,
column: 22
}
},
'29': {
start: {
line: 119,
column: 4
},
end: {
line: 122,
column: 5
}
},
'30': {
start: {
line: 120,
column: 6
},
end: {
line: 120,
column: 48
}
},
'31': {
start: {
line: 121,
column: 6
},
end: {
line: 121,
column: 13
}
},
'32': {
start: {
line: 125,
column: 4
},
end: {
line: 125,
column: 91
}
},
'33': {
start: {
line: 128,
column: 2
},
end: {
line: 128,
column: 53
}
}
},
fnMap: {
'0': {
name: 'find',
decl: {
start: {
line: 1,
column: 9
},
end: {
line: 1,
column: 13
}
},
loc: {
start: {
line: 1,
column: 20
},
end: {
line: 7,
column: 1
}
},
line: 1
},
'1': {
name: 'attachDashTextTracksToVideojs',
decl: {
start: {
line: 17,
column: 9
},
end: {
line: 17,
column: 38
}
},
loc: {
start: {
line: 17,
column: 66
},
end: {
line: 99,
column: 1
}
},
line: 17
},
'2': {
name: '(anonymous_2)',
decl: {
start: {
line: 25,
column: 9
},
end: {
line: 25,
column: 10
}
},
loc: {
start: {
line: 25,
column: 21
},
end: {
line: 33,
column: 5
}
},
line: 25
},
'3': {
name: '(anonymous_3)',
decl: {
start: {
line: 36,
column: 9
},
end: {
line: 36,
column: 10
}
},
loc: {
start: {
line: 36,
column: 39
},
end: {
line: 48,
column: 5
}
},
line: 36
},
'4': {
name: 'updateActiveDashTextTrack',
decl: {
start: {
line: 53,
column: 11
},
end: {
line: 53,
column: 36
}
},
loc: {
start: {
line: 53,
column: 39
},
end: {
line: 85,
column: 3
}
},
line: 53
},
'5': {
name: '(anonymous_5)',
decl: {
start: {
line: 68,
column: 10
},
end: {
line: 68,
column: 11
}
},
loc: {
start: {
line: 68,
column: 21
},
end: {
line: 68,
column: 50
}
},
line: 68
},
'6': {
name: '(anonymous_6)',
decl: {
start: {
line: 91,
column: 44
},
end: {
line: 91,
column: 45
}
},
loc: {
start: {
line: 91,
column: 50
},
end: {
line: 93,
column: 3
}
},
line: 91
},
'7': {
name: 'setupTextTracks',
decl: {
start: {
line: 101,
column: 24
},
end: {
line: 101,
column: 39
}
},
loc: {
start: {
line: 101,
column: 59
},
end: {
line: 130,
column: 1
}
},
line: 101
},
'8': {
name: 'clearDashTracks',
decl: {
start: {
line: 107,
column: 11
},
end: {
line: 107,
column: 26
}
},
loc: {
start: {
line: 107,
column: 29
},
end: {
line: 111,
column: 3
}
},
line: 107
},
'9': {
name: 'handleTextTracksAdded',
decl: {
start: {
line: 113,
column: 11
},
end: {
line: 113,
column: 32
}
},
loc: {
start: {
line: 113,
column: 41
},
end: {
line: 126,
column: 3
}
},
line: 113
}
},
branchMap: {
'0': {
loc: {
start: {
line: 3,
column: 4
},
end: {
line: 5,
column: 5
}
},
type: 'if',
locations: [{
start: {
line: 3,
column: 4
},
end: {
line: 5,
column: 5
}
}, {
start: {
line: 3,
column: 4
},
end: {
line: 5,
column: 5
}
}],
line: 3
},
'1': {
loc: {
start: {
line: 28,
column: 15
},
end: {
line: 28,
column: 44
}
},
type: 'binary-expr',
locations: [{
start: {
line: 28,
column: 15
},
end: {
line: 28,
column: 26
}
}, {
start: {
line: 28,
column: 30
},
end: {
line: 28,
column: 44
}
}],
line: 28
},
'2': {
loc: {
start: {
line: 63,
column: 6
},
end: {
line: 74,
column: 7
}
},
type: 'if',
locations: [{
start: {
line: 63,
column: 6
},
end: {
line: 74,
column: 7
}
}, {
start: {
line: 63,
column: 6
},
end: {
line: 74,
column: 7
}
}],
line: 63
},
'3': {
loc: {
start: {
line: 71,
column: 30
},
end: {
line: 73,
column: 14
}
},
type: 'cond-expr',
locations: [{
start: {
line: 72,
column: 10
},
end: {
line: 72,
column: 42
}
}, {
start: {
line: 73,
column: 10
},
end: {
line: 73,
column: 14
}
}],
line: 71
},
'4': {
loc: {
start: {
line: 78,
column: 4
},
end: {
line: 83,
column: 5
}
},
type: 'if',
locations: [{
start: {
line: 78,
column: 4
},
end: {
line: 83,
column: 5
}
}, {
start: {
line: 78,
column: 4
},
end: {
line: 83,
column: 5
}
}],
line: 78
},
'5': {
loc: {
start: {
line: 119,
column: 4
},
end: {
line: 122,
column: 5
}
},
type: 'if',
locations: [{
start: {
line: 119,
column: 4
},
end: {
line: 122,
column: 5
}
}, {
start: {
line: 119,
column: 4
},
end: {
line: 122,
column: 5
}
}],
line: 119
},
'6': {
loc: {
start: {
line: 119,
column: 8
},
end: {
line: 119,
column: 48
}
},
type: 'binary-expr',
locations: [{
start: {
line: 119,
column: 8
},
end: {
line: 119,
column: 22
}
}, {
start: {
line: 119,
column: 26
},
end: {
line: 119,
column: 48
}
}],
line: 119
}
},
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
},
f: {
'0': 0,
'1': 0,
'2': 0,
'3': 0,
'4': 0,
'5': 0,
'6': 0,
'7': 0,
'8': 0,
'9': 0
},
b: {
'0': [0, 0],
'1': [0, 0],
'2': [0, 0],
'3': [0, 0],
'4': [0, 0],
'5': [0, 0],
'6': [0, 0]
},
_coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c'
},
coverage = global[gcv] || (global[gcv] = {});
if (coverage[path] && coverage[path].hash === hash) {
return coverage[path];
}
coverageData.hash = hash;
return coverage[path] = coverageData;
}();
function find(l, f) {
cov_2brk8x8uoa.f[0]++;
cov_2brk8x8uoa.s[0]++;
for (var i = 0; i < l.length; i++) {
cov_2brk8x8uoa.s[1]++;
if (f(l[i])) {
cov_2brk8x8uoa.b[0][0]++;
cov_2brk8x8uoa.s[2]++;
return l[i];
} else {
cov_2brk8x8uoa.b[0][1]++;
}
}
}
function attachDashTextTracksToVideojs(tech, shakaPlayer, tracks) {
cov_2brk8x8uoa.f[1]++;
var trackDictionary = (cov_2brk8x8uoa.s[3]++, []);
var tracksAttached = (cov_2brk8x8uoa.s[4]++, tracks.map(function (track) {
cov_2brk8x8uoa.f[2]++;
cov_2brk8x8uoa.s[5]++;
return {
dashTrack: track,
trackConfig: {
label: (cov_2brk8x8uoa.b[1][0]++, track.label) || (cov_2brk8x8uoa.b[1][1]++, track.language),
language: track.language,
srclang: track.language,
kind: track.kind
}
};
}).map(function (_ref) {
var trackConfig = _ref.trackConfig,
dashTrack = _ref.dashTrack;
cov_2brk8x8uoa.f[3]++;
var remoteTextTrack = (cov_2brk8x8uoa.s[6]++, tech.addRemoteTextTrack(trackConfig, false));
cov_2brk8x8uoa.s[7]++;
trackDictionary.push({
textTrack: remoteTextTrack.track,
dashTrack: dashTrack
});
cov_2brk8x8uoa.s[8]++;
return remoteTextTrack;
}));
function updateActiveDashTextTrack() {
cov_2brk8x8uoa.f[4]++;
var dashTrackToActivate;
var textTracks = (cov_2brk8x8uoa.s[9]++, tech.textTracks());
cov_2brk8x8uoa.s[10]++;
var _loop = function _loop(i) {
var textTrack = (cov_2brk8x8uoa.s[11]++, textTracks[i]);
cov_2brk8x8uoa.s[12]++;
if (textTrack.mode === 'showing') {
cov_2brk8x8uoa.b[2][0]++;
var dictionaryLookupResult = (cov_2brk8x8uoa.s[13]++, find(trackDictionary, function (track) {
cov_2brk8x8uoa.f[5]++;
cov_2brk8x8uoa.s[14]++;
return track.textTrack === textTrack;
}));
cov_2brk8x8uoa.s[15]++;
dashTrackToActivate = dictionaryLookupResult ? (cov_2brk8x8uoa.b[3][0]++, dictionaryLookupResult.dashTrack) : (cov_2brk8x8uoa.b[3][1]++, null);
} else {
cov_2brk8x8uoa.b[2][1]++;
}
};
for (var i = 0; i < textTracks.length; i += 1) {
_loop(i);
}
cov_2brk8x8uoa.s[16]++;
if (dashTrackToActivate) {
cov_2brk8x8uoa.b[4][0]++;
cov_2brk8x8uoa.s[17]++;
shakaPlayer.selectTextTrack(dashTrackToActivate);
cov_2brk8x8uoa.s[18]++;
shakaPlayer.setTextTrackVisibility(true);
} else {
cov_2brk8x8uoa.b[4][1]++;
cov_2brk8x8uoa.s[19]++;
shakaPlayer.setTextTrackVisibility(false);
}
}
cov_2brk8x8uoa.s[20]++;
tech.textTracks().on('change', updateActiveDashTextTrack);
cov_2brk8x8uoa.s[21]++;
shakaPlayer.addEventListener('unloading', function () {
cov_2brk8x8uoa.f[6]++;
cov_2brk8x8uoa.s[22]++;
tech.textTracks().off('change', updateActiveDashTextTrack);
});
cov_2brk8x8uoa.s[23]++;
updateActiveDashTextTrack();
cov_2brk8x8uoa.s[24]++;
return tracksAttached;
}
function setupTextTracks(tech, shakaPlayer) {
cov_2brk8x8uoa.f[7]++;
var dashTracksAttachedToVideoJs = (cov_2brk8x8uoa.s[25]++, []);
function clearDashTracks() {
cov_2brk8x8uoa.f[8]++;
cov_2brk8x8uoa.s[26]++;
dashTracksAttachedToVideoJs.forEach(tech.removeRemoteTextTrack.bind(tech));
cov_2brk8x8uoa.s[27]++;
dashTracksAttachedToVideoJs = [];
}
function handleTextTracksAdded(tracks) {
cov_2brk8x8uoa.f[9]++;
cov_2brk8x8uoa.s[28]++;
clearDashTracks();
cov_2brk8x8uoa.s[29]++;
if ((cov_2brk8x8uoa.b[6][0]++, !tracks.length) || (cov_2brk8x8uoa.b[6][1]++, tech.options_.sideload)) {
cov_2brk8x8uoa.b[5][0]++;
cov_2brk8x8uoa.s[30]++;
shakaPlayer.setTextTrackVisibility(false);
cov_2brk8x8uoa.s[31]++;
return;
} else {
cov_2brk8x8uoa.b[5][1]++;
}
cov_2brk8x8uoa.s[32]++;
dashTracksAttachedToVideoJs = attachDashTextTracksToVideojs(tech, shakaPlayer, tracks);
}
cov_2brk8x8uoa.s[33]++;
handleTextT