videojs-playlist
Version:
Playlist plugin for Video.js
2,557 lines (2,486 loc) • 188 kB
JavaScript
/*! @name videojs-playlist @version 4.3.1 @license Apache-2.0 */
(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 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;
var cov_14i98g141m = function () {
var path = '/Users/poneill/dev/videojs-playlist/src/auto-advance.js',
hash = '445d03648826c8a2cda2eb374d06163a88b4152d',
Function = function () {}.constructor,
global = new Function('return this')(),
gcv = '__coverage__',
coverageData = {
path: '/Users/poneill/dev/videojs-playlist/src/auto-advance.js',
statementMap: {
'0': {
start: {
line: 12,
column: 21
},
end: {
line: 13,
column: 62
}
},
'1': {
start: {
line: 13,
column: 2
},
end: {
line: 13,
column: 62
}
},
'2': {
start: {
line: 21,
column: 12
},
end: {
line: 34,
column: 1
}
},
'3': {
start: {
line: 22,
column: 13
},
end: {
line: 22,
column: 41
}
},
'4': {
start: {
line: 24,
column: 2
},
end: {
line: 26,
column: 3
}
},
'5': {
start: {
line: 25,
column: 4
},
end: {
line: 25,
column: 36
}
},
'6': {
start: {
line: 28,
column: 2
},
end: {
line: 30,
column: 3
}
},
'7': {
start: {
line: 29,
column: 4
},
end: {
line: 29,
column: 36
}
},
'8': {
start: {
line: 32,
column: 2
},
end: {
line: 32,
column: 20
}
},
'9': {
start: {
line: 33,
column: 2
},
end: {
line: 33,
column: 20
}
},
'10': {
start: {
line: 48,
column: 14
},
end: {
line: 80,
column: 1
}
},
'11': {
start: {
line: 49,
column: 2
},
end: {
line: 49,
column: 16
}
},
'12': {
start: {
line: 53,
column: 2
},
end: {
line: 56,
column: 3
}
},
'13': {
start: {
line: 54,
column: 4
},
end: {
line: 54,
column: 46
}
},
'14': {
start: {
line: 55,
column: 4
},
end: {
line: 55,
column: 11
}
},
'15': {
start: {
line: 58,
column: 2
},
end: {
line: 58,
column: 45
}
},
'16': {
start: {
line: 60,
column: 2
},
end: {
line: 77,
column: 4
}
},
'17': {
start: {
line: 64,
column: 25
},
end: {
line: 64,
column: 51
}
},
'18': {
start: {
line: 64,
column: 31
},
end: {
line: 64,
column: 51
}
},
'19': {
start: {
line: 70,
column: 4
},
end: {
line: 70,
column: 37
}
},
'20': {
start: {
line: 72,
column: 4
},
end: {
line: 76,
column: 21
}
},
'21': {
start: {
line: 73,
column: 6
},
end: {
line: 73,
column: 20
}
},
'22': {
start: {
line: 74,
column: 6
},
end: {
line: 74,
column: 39
}
},
'23': {
start: {
line: 75,
column: 6
},
end: {
line: 75,
column: 29
}
},
'24': {
start: {
line: 79,
column: 2
},
end: {
line: 79,
column: 60
}
},
'25': {
start: {
line: 89,
column: 18
},
end: {
line: 91,
column: 1
}
},
'26': {
start: {
line: 90,
column: 2
},
end: {
line: 90,
column: 13
}
}
},
fnMap: {
'0': {
name: '(anonymous_0)',
decl: {
start: {
line: 12,
column: 21
},
end: {
line: 12,
column: 22
}
},
loc: {
start: {
line: 13,
column: 2
},
end: {
line: 13,
column: 62
}
},
line: 13
},
'1': {
name: '(anonymous_1)',
decl: {
start: {
line: 21,
column: 12
},
end: {
line: 21,
column: 13
}
},
loc: {
start: {
line: 21,
column: 24
},
end: {
line: 34,
column: 1
}
},
line: 21
},
'2': {
name: '(anonymous_2)',
decl: {
start: {
line: 48,
column: 14
},
end: {
line: 48,
column: 15
}
},
loc: {
start: {
line: 48,
column: 33
},
end: {
line: 80,
column: 1
}
},
line: 48
},
'3': {
name: '(anonymous_3)',
decl: {
start: {
line: 60,
column: 41
},
end: {
line: 60,
column: 42
}
},
loc: {
start: {
line: 60,
column: 52
},
end: {
line: 77,
column: 3
}
},
line: 60
},
'4': {
name: '(anonymous_4)',
decl: {
start: {
line: 64,
column: 25
},
end: {
line: 64,
column: 26
}
},
loc: {
start: {
line: 64,
column: 31
},
end: {
line: 64,
column: 51
}
},
line: 64
},
'5': {
name: '(anonymous_5)',
decl: {
start: {
line: 72,
column: 61
},
end: {
line: 72,
column: 62
}
},
loc: {
start: {
line: 72,
column: 67
},
end: {
line: 76,
column: 5
}
},
line: 72
},
'6': {
name: '(anonymous_6)',
decl: {
start: {
line: 89,
column: 18
},
end: {
line: 89,
column: 19
}
},
loc: {
start: {
line: 89,
column: 26
},
end: {
line: 91,
column: 1
}
},
line: 89
}
},
branchMap: {
'0': {
loc: {
start: {
line: 13,
column: 2
},
end: {
line: 13,
column: 62
}
},
type: 'binary-expr',
locations: [{
start: {
line: 13,
column: 2
},
end: {
line: 13,
column: 23
}
}, {
start: {
line: 13,
column: 27
},
end: {
line: 13,
column: 36
}
}, {
start: {
line: 13,
column: 40
},
end: {
line: 13,
column: 46
}
}, {
start: {
line: 13,
column: 50
},
end: {
line: 13,
column: 62
}
}],
line: 13
},
'1': {
loc: {
start: {
line: 24,
column: 2
},
end: {
line: 26,
column: 3
}
},
type: 'if',
locations: [{
start: {
line: 24,
column: 2
},
end: {
line: 26,
column: 3
}
}, {
start: {
line: 24,
column: 2
},
end: {
line: 26,
column: 3
}
}],
line: 24
},
'2': {
loc: {
start: {
line: 28,
column: 2
},
end: {
line: 30,
column: 3
}
},
type: 'if',
locations: [{
start: {
line: 28,
column: 2
},
end: {
line: 30,
column: 3
}
}, {
start: {
line: 28,
column: 2
},
end: {
line: 30,
column: 3
}
}],
line: 28
},
'3': {
loc: {
start: {
line: 53,
column: 2
},
end: {
line: 56,
column: 3
}
},
type: 'if',
locations: [{
start: {
line: 53,
column: 2
},
end: {
line: 56,
column: 3
}
}, {
start: {
line: 53,
column: 2
},
end: {
line: 56,
column: 3
}
}],
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,
'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
},
f: {
'0': 0,
'1': 0,
'2': 0,
'3': 0,
'4': 0,
'5': 0,
'6': 0
},
b: {
'0': [0, 0, 0, 0],
'1': [0, 0],
'2': [0, 0],
'3': [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;
}();
cov_14i98g141m.s[0]++;
var validSeconds = function validSeconds(s) {
cov_14i98g141m.f[0]++;
cov_14i98g141m.s[1]++;
return (cov_14i98g141m.b[0][0]++, typeof s === 'number') && (cov_14i98g141m.b[0][1]++, !isNaN(s)) && (cov_14i98g141m.b[0][2]++, s >= 0) && (cov_14i98g141m.b[0][3]++, s < Infinity);
};
cov_14i98g141m.s[2]++;
var reset = function reset(player) {
cov_14i98g141m.f[1]++;
var aa = (cov_14i98g141m.s[3]++, player.playlist.autoadvance_);
cov_14i98g141m.s[4]++;
if (aa.timeout) {
cov_14i98g141m.b[1][0]++;
cov_14i98g141m.s[5]++;
player.clearTimeout(aa.timeout);
} else {
cov_14i98g141m.b[1][1]++;
}
cov_14i98g141m.s[6]++;
if (aa.trigger) {
cov_14i98g141m.b[2][0]++;
cov_14i98g141m.s[7]++;
player.off('ended', aa.trigger);
} else {
cov_14i98g141m.b[2][1]++;
}
cov_14i98g141m.s[8]++;
aa.timeout = null;
cov_14i98g141m.s[9]++;
aa.trigger = null;
};
cov_14i98g141m.s[10]++;
var setup = function setup(player, delay) {
cov_14i98g141m.f[2]++;
cov_14i98g141m.s[11]++;
reset(player);
cov_14i98g141m.s[12]++;
if (!validSeconds(delay)) {
cov_14i98g141m.b[3][0]++;
cov_14i98g141m.s[13]++;
player.playlist.autoadvance_.delay = null;
cov_14i98g141m.s[14]++;
return;
} else {
cov_14i98g141m.b[3][1]++;
}
cov_14i98g141m.s[15]++;
player.playlist.autoadvance_.delay = delay;
cov_14i98g141m.s[16]++;
player.playlist.autoadvance_.trigger = function () {
cov_14i98g141m.f[3]++;
cov_14i98g141m.s[17]++;
var cancelOnPlay = function cancelOnPlay() {
cov_14i98g141m.f[4]++;
cov_14i98g141m.s[18]++;
return setup(player, delay);
};
cov_14i98g141m.s[19]++;
player.one('play', cancelOnPlay);
cov_14i98g141m.s[20]++;
player.playlist.autoadvance_.timeout = player.setTimeout(function () {
cov_14i98g141m.f[5]++;
cov_14i98g141m.s[21]++;
reset(player);
cov_14i98g141m.s[22]++;
player.off('play', cancelOnPlay);
cov_14i98g141m.s[23]++;
player.playlist.next();
}, delay * 1000);
};
cov_14i98g141m.s[24]++;
player.one('ended', player.playlist.autoadvance_.trigger);
};
cov_14i98g141m.s[25]++;
var setReset_ = function setReset_(fn) {
cov_14i98g141m.f[6]++;
cov_14i98g141m.s[26]++;
reset = fn;
};
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);
}
var proxy = function proxy(props) {
var player = _extends({}, videojs.EventTarget.prototype, {
play: function play() {},
paused: function paused() {},
ended: function ended() {},
poster: function poster() {},
src: function src() {},
currentSrc: function currentSrc() {},
addRemoteTextTrack: function addRemoteTextTrack() {},
removeRemoteTextTrack: function removeRemoteTextTrack() {},
remoteTextTracks: function remoteTextTracks() {},
playlist: function playlist() {
return [];
},
ready: function ready(cb) {
return cb();
},
setTimeout: function setTimeout(cb, wait) {
return window_1.setTimeout(cb, wait);
},
clearTimeout: function clearTimeout(id) {
return window_1.clearTimeout(id);
}
}, props);
player.constructor = videojs.getComponent('Player');
player.playlist.player_ = player;
player.playlist.autoadvance_ = {};
player.playlist.currentIndex_ = -1;
player.playlist.autoadvance = function () {};
player.playlist.contains = function () {};
player.playlist.currentItem = function () {};
player.playlist.first = function () {};
player.playlist.indexOf = function () {};
player.playlist.next = function () {};
player.playlist.previous = function () {};
return player;
};
QUnit.module('auto-advance');
QUnit.test('set up ended listener if one does not exist yet', function (assert) {
var player = proxy();
var ones = [];
player.one = function (type) {
ones.push(type);
};
setup(player, 0);
assert.equal(ones.length, 1, 'there should have been only one one event added');
assert.equal(ones[0], 'ended', 'the event we want to one is "ended"');
});
QUnit.test('off previous listener if exists before adding a new one', function (assert) {
var player = proxy();
var ones = [];
var offs = [];
player.one = function (type) {
ones.push(type);
};
player.off = function (type) {
offs.push(type);
};
setup(player, 0);
assert.equal(ones.length, 1, 'there should have been only one one event added');
assert.equal(ones[0], 'ended', 'the event we want to one is "ended"');
assert.equal(offs.length, 0, 'we should not have off-ed anything yet');
setup(player, 10);
assert.equal(ones.length, 2, 'there should have been only two one event added');
assert.equal(ones[0], 'ended', 'the event we want to one is "ended"');
assert.equal(ones[1], 'ended', 'the event we want to one is "ended"');
assert.equal(offs.length, 1, 'there should have been only one off event added');
assert.equal(offs[0], 'ended', 'the event we want to off is "ended"');
});
QUnit.test('do nothing if timeout is weird', function (assert) {
var player = proxy();
var ones = [];
var offs = [];
player.one = function (type) {
ones.push(type);
};
player.off = function (type) {
offs.push(type);
};
setup(player, -1);
setup(player, -100);
setup(player, null);
setup(player, {});
setup(player, []);
assert.equal(offs.length, 0, 'we did nothing');
assert.equal(ones.length, 0, 'we did nothing');
});
QUnit.test('reset if timeout is weird after we advance', function (assert) {
var player = proxy();
var ones = [];
var offs = [];
player.one = function (type) {
ones.push(type);
};
player.off = function (type) {
offs.push(type);
};
setup(player, 0);
setup(player, -1);
setup(player, 0);
setup(player, -100);
setup(player, 0);
setup(player, null);
setup(player, 0);
setup(player, {});
setup(player, 0);
setup(player, []);
setup(player, 0);
setup(player, NaN);
setup(player, 0);
setup(player, Infinity);
setup(player, 0);
setup(player, -Infinity);
assert.equal(offs.length, 8, 'we reset the advance 8 times');
assert.equal(ones.length, 8, 'we autoadvanced 8 times');
});
QUnit.test('reset if we have already started advancing', function (assert) {
var player = proxy();
var oldClearTimeout = window_1.clearTimeout;
var clears = 0;
window_1.clearTimeout = function () {
clears++;
}; // pretend we started autoadvancing
player.playlist.autoadvance_.timeout = 1;
setup(player, 0);
assert.equal(clears, 1, 'we reset the auto advance');
window_1.clearTimeout = oldClearTimeout;
});
QUnit.test('timeout is given in seconds', function (assert) {
var player = proxy();
var oldSetTimeout = window_1.setTimeout;
player.addEventListener = Function.prototype;
window_1.setTimeout = function (fn, timeout) {
assert.equal(timeout, 10 * 1000, 'timeout was given in seconds');
};
setup(player, 10);
player.trigger('ended');
window_1.setTimeout = oldSetTimeout;
});
QUnit.test('cancel a pending auto-advance if play is requested', function (assert) {
var clock = sinon.useFakeTimers();
var player = proxy();
sinon.spy(player.playlist, 'next');
setup(player, 10);
player.trigger('ended');
clock.tick(10000);
assert.equal(player.playlist.next.callCount, 1, 'next was called');
setup(player, 10);
player.trigger('ended');
clock.tick(5000);
player.trigger('play');
clock.tick(5000);
assert.equal(player.playlist.next.callCount, 1, 'next was not called because a "play" occurred');
player.trigger('ended');
clock.tick(10000);
assert.equal(player.playlist.next.callCount, 2, 'next was called again because the content ended again and the appropriate wait time elapsed');
});
var cov_g6zj6xivc = function () {
var path = '/Users/poneill/dev/videojs-playlist/src/play-item.js',
hash = 'ee3874444c4c418ebb585c26bbb8508f2a48fa70',
Function = function () {}.constructor,
global = new Function('return this')(),
gcv = '__coverage__',
coverageData = {
path: '/Users/poneill/dev/videojs-playlist/src/play-item.js',
statementMap: {
'0': {
start: {
line: 9,
column: 20
},
end: {
line: 18,
column: 1
}
},
'1': {
start: {
line: 10,
column: 17
},
end: {
line: 10,
column: 42
}
},
'2': {
start: {
line: 11,
column: 10
},
end: {
line: 11,
column: 38
}
},
'3': {
start: {
line: 15,
column: 2
},
end: {
line: 17,
column: 3
}
},
'4': {
start: {
line: 16,
column: 4
},
end: {
line: 16,
column: 44
}
},
'5': {
start: {
line: 32,
column: 17
},
end: {
line: 64,
column: 1
}
},
'6': {
start: {
line: 33,
column: 17
},
end: {
line: 33,
column: 51
}
},
'7': {
start: {
line: 35,
column: 2
},
end: {
line: 35,
column: 67
}
},
'8': {
start: {
line: 37,
column: 2
},
end: {
line: 39,
column: 3
}
},
'9': {
start: {
line: 38,
column: 4
},
end: {
line: 38,
column: 66
}
},
'10': {
start: {
line: 41,
column: 2
},
end: {
line: 41,
column: 35
}
},
'11': {
start: {
line: 42,
column: 2
},
end: {
line: 42,
column: 27
}
},
'12': {
start: {
line: 43,
column: 2
},
end: {
line: 43,
column: 22
}
},
'13': {
start: {
line: 45,
column: 2
},
end: {
line: 61,
column: 5
}
},
'14': {
start: {
line: 47,
column: 4
},
end: {
line: 47,
column: 76
}
},
'15': {
start: {
line: 48,
column: 4
},
end: {
line: 48,
column: 63
}
},
'16': {
start: {
line: 50,
column: 4
},
end: {
line: 58,
column: 5
}
},
'17': {
start: {
line: 51,
column: 26
},
end: {
line: 51,
column: 39
}
},
'18': {
start: {
line: 55,
column: 6
},
end: {
line: 57,
column: 7
}
},
'19': {
start: {
line: 56,
column: 8
},
end: {
line: 56,
column: 42
}
},
'20': {
start: {
line: 60,
column: 4
},
end: {
line: 60,
column: 54
}
},
'21': {
start: {
line: 63,
column: 2
},
end: {
line: 63,
column: 16
}
}
},
fnMap: {
'0': {
name: '(anonymous_0)',
decl: {
start: {
line: 9,
column: 20
},
end: {
line: 9,
column: 21
}
},
loc: {
start: {
line: 9,
column: 32
},
end: {
line: 18,
column: 1
}
},
line: 9
},
'1': {
name: '(anonymous_1)',
decl: {
start: {
line: 32,
column: 17
},
end: {
line: 32,
column: 18
}
},
loc: {
start: {
line: 32,
column: 35
},
end: {
line: 64,
column: 1
}
},
line: 32
},
'2': {
name: '(anonymous_2)',
decl: {
start: {
line: 45,
column: 15
},
end: {
line: 45,
column: 16
}
},
loc: {
start: {
line: 45,
column: 21
},
end: {
line: 61,
column: 3
}
},
line: 45
},
'3': {
name: '(anonymous_3)',
decl: {
start: {
line: 56,
column: 31
},
end: {
line: 56,
column: 32
}
},
loc: {
start: {
line: 56,
column: 38
},
end: {
line: 56,
column: 40
}
},
line: 56
}
},
branchMap: {
'0': {
loc: {
start: {
line: 11,
column: 10
},
end: {
line: 11,
column: 38
}
},
type: 'binary-expr',
locations: [{
start: {
line: 11,
column: 10
},
end: {
line: 11,
column: 16
}
}, {
start: {
line: 11,
column: 20
},
end: {
line: 11,
column: 33
}
}, {
start: {
line: 11,
column: 37
},
end: {
line: 11,
column: 38
}
}],
line: 11
},
'1': {
loc: {
start: {
line: 33,
column: 17
},
end: {
line: 33,
column: 51
}
},
type: 'binary-expr',
locations: [{
start: {
line: 33,
column: 17
},
end: {
line: 33,
column: 33
}
}, {
start: {
line: 33,
column: 37
},
end: {
line: 33,
column: 51
}
}],
line: 33
},
'2': {
loc: {
start: {
line: 35,
column: 39
},
end: {
line: 35,
column: 65
}
},
type: 'binary-expr',
locations: [{
start: {
line: 35,
column: 39
},
end: {
line: 35,
column: 57
}
}, {
start: {
line: 35,
column: 61
},
end: {
line: 35,
column: 65
}
}],
line: 35
},
'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: 41,
column: 16
},
end: {
line: 41,
column: 33
}
},
type: 'binary-expr',
locations: [{
start: {
line: 41,
column: 16
},
end: {
line: 41,
column: 27
}
}, {
start: {
line: 41,
column: 31
},
end: {
line: 41,
column: 33
}
}],
line: 41
},
'5': {
loc: {
start: {
line: 47,
column: 5
},
end: {
line: 47,
column: 26
}
},
type: 'binary-expr',
locations: [{
start: {
line: 47,
column: 5
},
end: {
line: 47,
column: 20
}
}, {
start: {
line: 47,
column: 24
},
end: {
line: 47,
column: 26
}
}],
line: 47
},
'6': {
loc: {
start: {
line: 48,
column: 35
},
end: {
line: 48,
column: 61
}
},
type: 'binary-expr',
locations: [{
start: {
line: 48,
column: 35
},
end: {
line: 48,
column: 53
}
}, {
start: {
line: 48,
column: 57
},
end: {
line: 48,
column: 61
}
}],
line: 48
},
'7': {
loc: {
start: {
line: 50,
column: 4
},
end: {
line: 58,
column: 5
}
},
type: 'if',
locations: [{
start: {
line: 50,
column: 4
},
end: {
line: 58,
column: 5
}
}, {
start: {
line: 50,
column: 4
},
end: {
line: 58,
column: 5
}
}],
line: 50
},
'8': {
loc: {
start: {
line: 55,
column: 6
},
end: {
line: 57,
column: 7
}
},
type: 'if',
locations: [{
start: {
line: 55,
column: 6
},
end: {
line: 57,
column: 7
}
}, {
start: {
line: 55,
column: 6
},
end: {
line: 57,
column: 7
}
}],
line: 55
},
'9': {
loc: {
start: {
line: 55,
column: 10
},
end: {
line: 55,
column: 86
}
},
type: 'binary-expr',
locations: [{
start: {
line: 55,
column: 10
},
end: {
line: 55,
column: 44
}
}, {
start: {
line: 55,
column: 48
},
end: {
line: 55,
column: 86
}
}],
line: 55
}
},
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
},
f: {
'0': 0,
'1': 0,
'2': 0,
'3': 0
},
b: {
'0': [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: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c'
},
coverage = global[gcv] || (global[gcv] = {});
if (coverage[path] && coverage[path].hash === hash) {
return coverage[path];
}
coverageData.hash = hash;
return coverage[path] = coverageData;
}();
cov_g6zj6xivc.s[0]++;
var clearTracks = function clearTracks(player) {
cov_g6zj6xivc.f[0]++;
var tracks = (cov_g6zj6xivc.s[1]++, player.remoteTextTracks());
var i = (cov_g6zj6xivc.s[2]++, (cov_g6zj6xivc.b[0][0]++, tracks) && (cov_g6zj6xivc.b[0][1]++, tracks.length) || (cov_g6zj6xivc.b[0][2]++, 0));
cov_g6zj6xivc.s[3]++;
while (i--) {
cov_g6zj6xivc.s[4]++;
player.removeRemoteTextTrack(tracks[i]);
}
};
cov_g6zj6xivc.s[5]++;
var playItem = function playItem(player, item) {
cov_g6zj6xivc.f[1]++;
var replay = (cov_g6zj6xivc.s[6]++, (cov_g6zj6xivc.b[1][0]++, !player.paused()) || (cov_g6zj6xivc.b[1][1]++, player.ended()));
cov_g6zj6xivc.s[7]++;
player.trigger('beforeplaylistitem', (cov_g6zj6xivc.b[2][0]++, item.originalValue) || (cov_g6zj6xivc.b[2][1]++, item));
cov_g6zj6xivc.s[8]++;
if (item.playlistItemId_) {
cov_g6zj6xivc.b[3][0]++;
cov_g6zj6xivc.s[9]++;
player.playlist.currentPlaylistItemId_ = item.playlistItemId_;
} else {
cov_g6zj6xivc.b[3][1]++;
}
cov_g6zj6xivc.s[10]++;
player.poster((cov_g6zj6xivc.b[4][0]++, item.poster) || (cov_g6zj6xivc.b[4][1]++, ''));
cov_g6zj6xivc.s[11]++;
player.src(item.sources);
cov_g6zj6xivc.s[12]++;
clearTracks(player);
cov_g6zj6xivc.s[13]++;
player.ready(function () {
cov_g6zj6xivc.f[2]++;
cov_g6zj6xivc.s[14]++;
((cov_g6zj6xivc.b[5][0]++, item.textTracks) || (cov_g6zj6xivc.b[5][1]++, [])).forEach(player.addRemoteTextTrack.bind(player));
cov_g6zj6xivc.s[15]++;
player.trigger('playlistitem', (cov_g6zj6xivc.b[6][0]++, item.originalValue) || (cov_g6zj6xivc.b[6][1]++, item));
cov_g6zj6xivc.s[16]++;
if (replay) {
cov_g6zj6xivc.b[7][0]++;
var playPromise = (cov_g6zj6xivc.s[17]++, player.play());
cov_g6zj6xivc.s[18]++;
if ((cov_g6zj6xivc.b[9][0]++, typeof playPromise !== 'undefined') && (cov_g6zj6xivc.b[9][1]++, typeof playPromise.then === 'function')) {
cov_g6zj6xivc.b[8][0]++;
cov_g6zj6xivc.s[19]++;
playPromise.then(null, function (e) {
cov_g6zj6xivc.f[3]++;
});
} else {
cov_g6zj6xivc.b[8][1]++;
}
} else {
cov_g6zj6xivc.b[7][1]++;
}
cov_g6zj6xivc.s[20]++;
setup(player, player.playlist.autoadvance_.delay);
});
cov_g6zj6xivc.s[21]++;
return player;
};
var cov_ritqk1zyq = function () {
var path = '/Users/poneill/dev/videojs-playlist/src/playlist-maker.js',
hash = 'a100f3413808041b0c891297efe13d954e8c76ca',
Function = function () {}.constructor,
global = new Function('return this')(),
gcv = '__coverage__',
coverageData = {
path: '/Users/poneill/dev/videojs-playlist/src/playlist-maker.js',
statementMap: {
'0': {
start: {
line: 16,
column: 21
},
end: {
line: 18,
column: 1
}
},
'1': {
start: {
line: 17,
column: 2
},
end: {
line: 17,
column: 46
}
},
'2': {
start: {
line: 33,
column: 32
},
end: {
line: 49,
column: 1
}
},
'3': {
start: {
line: 34,
column: 15
},
end: {
line: 34,
column: 17
}
},
'4': {
start: {
line: 37,
column: 2
},
end: {
line: 46,
column: 5
}
},
'5': {
start: {
line: 38,
column: 4
},
end: {
line: 43,
column: 5
}
},
'6': {
start: {
line: 39,
column: 6
},
end: {
line: 39,
column: 30
}
},
'7': {
start: {
line: 40,
column: 6
},
end: {
line: 40,
column: 36
}
},
'8': {
start: {
line: 42,
column: 6
},
end: {
line: 42,
column: 22
}
},
'9': {
start: {
line: 45,
column: 4
},
end: {
line: 45,
column: 24
}
},
'10': {
start: {
line: 48,
column: 2
},
end: {
line: 48,
column: 14
}
},
'11': {
start: {
line: 61,
column: 31
},
end: {
line: 67,
column: 1
}
},
'12': {
start: {
line: 62,
column: 13
},
end: {
line: 62,
column: 14
}
},
'13': {
start: {
line: 64,
column: 2
},
end: {
line: 66,
column: 5
}
},
'14': {
start: {
line: 65,
column: 4
},
end: {
line: 65,
column: 34
}
},
'15': {
start: {
line: 82,
column: 31
},
end: {
line: 90,
column: 1
}
},
'16': {
start: {
line: 83,
column: 2
},
end: {
line: 87,
column: 3
}
},
'17': {
start: {
line: 84,
column: 4
},
end: {
line: 86,
column: 5
}
},
'18': {
start: {
line: 85,
column: 6
},
end: {
line: 85,
column: 15
}
},
'19': {
start: {
line: 89,
column: 2
},
end: {
line: 89,
column: 12
}
},
'20': {
start: {
line: 107,
column: 21
},
end: {
line: 126,
column: 1
}
},
'21': {
start: {
line: 108,
column: 13
},
end: {
line: 108,
column: 20
}
},
'22': {
start: {
line: 109,
column: 13
},
end: {
line: 109,
column: 20
}
},
'23': {
start: {
line: 111,
column: 2
},
end: {
line: 113,
column: 3
}
},
'24': {
start: {
line: 112,
column: 4
},
end: {
line: 112,
column: 23
}
},
'25': {
start: {
line: 114,
column: 2
},
end: {
line: 116,
column: 3
}
},
'26': {
start: {
line: 115,
column: 4
},
end: {
line: 115,
column: 23
}
},
'27': {
start: {
line: 118,
column: 2
},
end: {
line: 120,
column: 3
}
},
'28': {
start: {
line: 119,
column: 4
},
end: {
line: 119,
column: 42
}
},
'29': {
start: {
line: 121,
column: 2
},
end: {
line: 123,
column: 3
}
},
'30': {
start: {
line: 122,
column: 4
},
end: {
line: 122,
column: 42
}
},
'31': {
start: {
line: 125,
column: 2
},
end: {
line: 125,
column: 23
}
},
'32': {
start: {
line: 143,
column: 23
},
end: {
line: 159,
column: 1
}
},
'33': {
start: {
line: 144,
column: 2
},
end: {
line: 156,
column: 3
}
},
'34': {
start: {
line: 145,
column: 20
},
end: {
line: 145,
column: 34
}
},
'35': {
start: {
line: 147,
column: 4
},
end: {
line: 155,
column: 5
}
},
'36': {
start: {
line: 148,
column: 6
},
end: {
line: 154,
column: 7
}
},
'37': {
start: {
line: 149,
column: 23
},
end: {
line: 149,
column: 33
}
},
'38': {
start: {
line: 151,
column: 8
},
end: {
line: 153,
column: 9
}
},
'39': {
start: {
line: 152,
column: 10
},
end: {
line: 152,
column: 19
}
},
'40': {
start: {
line: 158,
column: 2
},
end: {
line: 158,
column: 12
}
},
'41': {
start: {
line: 171,
column: 18
},
end: {
line: 184,
column: 1
}
},
'42': {
start: {
line: 172,
column: 14
},
end: {
line: 172,
column: 16
}
},
'43': {
start: {
line: 173,
column: 20
},
end: {
line: 173,
column: 34
}
},
'44': {
start: {
line: 175,
column: 2
},
end: {
line: 181,
column: 3
}
},
'45': {
start: {
line: 176,
column: 17
},
end: {
line: 176,
column: 76
}
},
'46': {
start: {
line: 177,
column: 18
},
end: {
line: 177,
column: 27
}
},
'47': {
start: {
line: 179,
column: 4
},
end: {
line: 179,
column: 27
}
},
'48': {
start: {
line: 180,
column: 4
},
end: {
line: 180,
column: 23
}
},
'49': {
start: {
line: 183,
column: 2
},
end: {
line: 183,
column: 13
}
},
'50': {
start: {
line: 218,
column: 13
},
end: {
line: 218,
column: 17
}
},
'51': {
start: {
line: 219,
column: 17
},
end: {
line: 219,
column: 22
}
},
'52': {
start: {
line: 239,
column: 19
},
end: {
line: 298,
column: 3
}
},
'53': {
start: {
line: 240,
column: 4
},
end: {
line: 242,
column: 5
}
},
'54': {
start: {
line: 241,
column: 6
},
end: {
line: 241,
column: 73
}
},
'55': {
start: {
line: 244,
column: 4
},
end: {
line: 293,
column: 5
}
},
'56': {
start: {
line: 247,
column: 31
},
end: {
line: 247,
column: 72
}
},
'57': {
start: {
line: 248,
column: 27
},
end: {
line: 248,
column: 42
}
},
'58': {
start: {
line: 250,
column: 6
},
end: {
line: 250,
column: 34
}
},
'59': {
start: {
line: 253,
column: 6
},
end: {
line: 255,
column: 7
}
},
'60': {
start: {
line: 253,
column: 30
},
end: {
line: 253,
column: 48
}
},
'61': {
start: {
line: 254,
column: 8
},
end: {
line: 254,
column: 45
}
},
'62': {
start: {
line: 260,
column: 6
},
end: {
line: 260,
column: 35
}
},
'63': {
start: {
line: 263,
column: 6
},
end: {
line: 263,
column: 22
}
},
'64': {
start: {
line: 265,
column: 6
},
end: {
line: 273,
column: 9
}
},
'65': {
start: {
line: 275,
column: 6
},
end: {
line: 275,
column: 23
}
},
'66': {
start: {
line: 277,
column: 6
},
end: {
line: 279,
column: 7
}
},
'67': {
start: {
line: 278,
column: 8
},
end: {
line: 278,
column: 39
}
},
'68': {
start: {
line: 288,
column: 6
},
end: {
line: 292,
column: 7
}
},
'69': {
start: {
line: 289,
column: 8
},
end: {
line: 291,
column: 14
}
},
'70': {
start: {
line: 290,
column: 10
},
end: {
line: 290,
column: 43
}
},
'71': {
start: {
line: 297,
column: 4
},
end: {
line: 297,
column: 66
}
},
'72': {
start: {
line: 297,
column: 30
},
end: {
line: 297,
column: 56
}
},
'73': {
start: {
line: 301,
column: 2
},
end: {
line: 305,
column: 5
}
},
'74': {
start: {
line: 302,
column: 4
},
end: {
line: 304,
column: 5
}
},
'75': {
start: {
line: 303,
column: 6
},
end: {
line: 303,
column: 32
}
},
'76': {
start: {
line: 307,
column: 2
},
end: {
line: 307,
column: 30
}
},
'77': {
start: {
line: 308,