videojs-contrib-quality-levels
Advanced tools
Comparing version 2.0.7 to 2.0.8
@@ -0,1 +1,16 @@ | ||
<a name="2.0.8"></a> | ||
## [2.0.8](https://github.com/videojs/videojs-contrib-quality-levels/compare/v2.0.7...v2.0.8) (2018-09-17) | ||
### Bug Fixes | ||
* Remove the postinstall script to prevent install issues (#54) ([7562cdb](https://github.com/videojs/videojs-contrib-quality-levels/commit/7562cdb)), closes [#54](https://github.com/videojs/videojs-contrib-quality-levels/issues/54) | ||
* report correct version (#57) ([1992300](https://github.com/videojs/videojs-contrib-quality-levels/commit/1992300)), closes [#57](https://github.com/videojs/videojs-contrib-quality-levels/issues/57) | ||
### Chores | ||
* update to generator-videojs-plugin[@7](https://github.com/7).2.0 ([9660214](https://github.com/videojs/videojs-contrib-quality-levels/commit/9660214)) | ||
* **package:** update rollup to version 0.66.0 (#56) ([0467b62](https://github.com/videojs/videojs-contrib-quality-levels/commit/0467b62)), closes [#56](https://github.com/videojs/videojs-contrib-quality-levels/issues/56) | ||
* **package:** update videojs-contrib-hls to version 5.14.1 (#31) ([b1a17fa](https://github.com/videojs/videojs-contrib-quality-levels/commit/b1a17fa)), closes [#31](https://github.com/videojs/videojs-contrib-quality-levels/issues/31) | ||
* **package:** update videojs-generate-rollup-config to version 2.2.0 (#55) ([4ad0a93](https://github.com/videojs/videojs-contrib-quality-levels/commit/4ad0a93)), closes [#55](https://github.com/videojs/videojs-contrib-quality-levels/issues/55) | ||
<a name="2.0.7"></a> | ||
@@ -2,0 +17,0 @@ ## [2.0.7](https://github.com/videojs/videojs-contrib-quality-levels/compare/v2.0.6...v2.0.7) (2018-08-23) |
@@ -1,2 +0,2 @@ | ||
/*! @name videojs-contrib-quality-levels @version 2.0.7 @license Apache-2.0 */ | ||
/*! @name videojs-contrib-quality-levels @version 2.0.8 @license Apache-2.0 */ | ||
'use strict'; | ||
@@ -9,31 +9,15 @@ | ||
var classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
}; | ||
function _inheritsLoose(subClass, superClass) { | ||
subClass.prototype = Object.create(superClass.prototype); | ||
subClass.prototype.constructor = subClass; | ||
subClass.__proto__ = superClass; | ||
} | ||
var inherits = function (subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; | ||
}; | ||
var possibleConstructorReturn = function (self, call) { | ||
if (!self) { | ||
function _assertThisInitialized(self) { | ||
if (self === void 0) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
return call && (typeof call === "object" || typeof call === "function") ? call : self; | ||
}; | ||
return self; | ||
} | ||
@@ -56,3 +40,2 @@ /** | ||
var QualityLevel = | ||
/** | ||
@@ -69,5 +52,2 @@ * Creates a QualityLevel | ||
function QualityLevel(representation) { | ||
classCallCheck(this, QualityLevel); | ||
var level = this; // eslint-disable-line | ||
@@ -77,2 +57,3 @@ | ||
level = document.createElement('custom'); | ||
for (var prop in QualityLevel.prototype) { | ||
@@ -91,3 +72,2 @@ if (prop !== 'constructor') { | ||
level.enabled_ = representation.enabled; | ||
Object.defineProperty(level, 'enabled', { | ||
@@ -99,7 +79,6 @@ /** | ||
*/ | ||
get: function get$$1() { | ||
get: function get() { | ||
return level.enabled_(); | ||
}, | ||
/** | ||
@@ -110,7 +89,6 @@ * Enable or disable the QualityLevel. | ||
*/ | ||
set: function set$$1(enable) { | ||
set: function set(enable) { | ||
level.enabled_(enable); | ||
} | ||
}); | ||
return level; | ||
@@ -140,16 +118,18 @@ }; | ||
var QualityLevelList = function (_videojs$EventTarget) { | ||
inherits(QualityLevelList, _videojs$EventTarget); | ||
var QualityLevelList = | ||
/*#__PURE__*/ | ||
function (_videojs$EventTarget) { | ||
_inheritsLoose(QualityLevelList, _videojs$EventTarget); | ||
function QualityLevelList() { | ||
var _ret; | ||
var _this; | ||
classCallCheck(this, QualityLevelList); | ||
_this = _videojs$EventTarget.call(this) || this; | ||
var _this = possibleConstructorReturn(this, _videojs$EventTarget.call(this)); | ||
var list = _assertThisInitialized(_assertThisInitialized(_this)); // eslint-disable-line | ||
var list = _this; // eslint-disable-line | ||
if (videojs.browser.IS_IE8) { | ||
list = document.createElement('custom'); | ||
for (var prop in QualityLevelList.prototype) { | ||
@@ -164,3 +144,2 @@ if (prop !== 'constructor') { | ||
list.selectedIndex_ = -1; | ||
/** | ||
@@ -172,8 +151,8 @@ * Get the index of the currently selected QualityLevel. | ||
*/ | ||
Object.defineProperty(list, 'selectedIndex', { | ||
get: function get$$1() { | ||
get: function get() { | ||
return list.selectedIndex_; | ||
} | ||
}); | ||
/** | ||
@@ -185,11 +164,10 @@ * Get the length of the list of QualityLevels. | ||
*/ | ||
Object.defineProperty(list, 'length', { | ||
get: function get$$1() { | ||
get: function get() { | ||
return list.levels_.length; | ||
} | ||
}); | ||
return _ret = list, possibleConstructorReturn(_this, _ret); | ||
return list || _assertThisInitialized(_this); | ||
} | ||
/** | ||
@@ -209,6 +187,7 @@ * Adds a quality level to the list. | ||
QualityLevelList.prototype.addQualityLevel = function addQualityLevel(representation) { | ||
var qualityLevel = this.getQualityLevelById(representation.id); | ||
var _proto = QualityLevelList.prototype; | ||
// Do not add duplicate quality levels | ||
_proto.addQualityLevel = function addQualityLevel(representation) { | ||
var qualityLevel = this.getQualityLevelById(representation.id); // Do not add duplicate quality levels | ||
if (qualityLevel) { | ||
@@ -219,3 +198,2 @@ return qualityLevel; | ||
var index = this.levels_.length; | ||
qualityLevel = new QualityLevel(representation); | ||
@@ -225,3 +203,3 @@ | ||
Object.defineProperty(this, index, { | ||
get: function get$$1() { | ||
get: function get() { | ||
return this.levels_[index]; | ||
@@ -233,3 +211,2 @@ } | ||
this.levels_.push(qualityLevel); | ||
this.trigger({ | ||
@@ -239,6 +216,4 @@ qualityLevel: qualityLevel, | ||
}); | ||
return qualityLevel; | ||
}; | ||
/** | ||
@@ -253,3 +228,3 @@ * Removes a quality level from the list. | ||
QualityLevelList.prototype.removeQualityLevel = function removeQualityLevel(qualityLevel) { | ||
_proto.removeQualityLevel = function removeQualityLevel(qualityLevel) { | ||
var removed = null; | ||
@@ -266,2 +241,3 @@ | ||
} | ||
break; | ||
@@ -280,3 +256,2 @@ } | ||
}; | ||
/** | ||
@@ -291,3 +266,3 @@ * Searches for a QualityLevel with the given id. | ||
QualityLevelList.prototype.getQualityLevelById = function getQualityLevelById(id) { | ||
_proto.getQualityLevelById = function getQualityLevelById(id) { | ||
for (var i = 0, l = this.length; i < l; i++) { | ||
@@ -300,5 +275,5 @@ var level = this[i]; | ||
} | ||
return null; | ||
}; | ||
/** | ||
@@ -311,3 +286,3 @@ * Resets the list of QualityLevels to empty | ||
QualityLevelList.prototype.dispose = function dispose() { | ||
_proto.dispose = function dispose() { | ||
this.selectedIndex_ = -1; | ||
@@ -319,3 +294,2 @@ this.levels_.length = 0; | ||
}(videojs.EventTarget); | ||
/** | ||
@@ -332,5 +306,4 @@ * change - The selected QualityLevel has changed. | ||
removequalitylevel: 'removequalitylevel' | ||
}; | ||
}; // emulate attribute EventHandler support to allow for feature detection | ||
// emulate attribute EventHandler support to allow for feature detection | ||
for (var event in QualityLevelList.prototype.allowedEvents_) { | ||
@@ -340,5 +313,5 @@ QualityLevelList.prototype['on' + event] = null; | ||
// vjs 5/6 support | ||
var version = "2.0.8"; | ||
var registerPlugin = videojs.registerPlugin || videojs.plugin; | ||
/** | ||
@@ -352,5 +325,5 @@ * Initialization function for the qualityLevels plugin. Sets up the QualityLevelList and | ||
*/ | ||
var initPlugin = function initPlugin(player, options) { | ||
var originalPluginFn = player.qualityLevels; | ||
var qualityLevelList = new QualityLevelList(); | ||
@@ -369,7 +342,6 @@ | ||
}; | ||
player.qualityLevels.VERSION = '__VERSION__'; | ||
return qualityLevelList; | ||
}; | ||
/** | ||
@@ -386,12 +358,13 @@ * A video.js plugin. | ||
*/ | ||
var qualityLevels = function qualityLevels(options) { | ||
return initPlugin(this, videojs.mergeOptions({}, options)); | ||
}; | ||
}; // Register the plugin with video.js. | ||
// Register the plugin with video.js. | ||
registerPlugin('qualityLevels', qualityLevels); | ||
// Include the version number. | ||
qualityLevels.VERSION = '__VERSION__'; | ||
registerPlugin('qualityLevels', qualityLevels); // Include the version number. | ||
qualityLevels.VERSION = version; | ||
module.exports = qualityLevels; |
@@ -1,34 +0,18 @@ | ||
/*! @name videojs-contrib-quality-levels @version 2.0.7 @license Apache-2.0 */ | ||
/*! @name videojs-contrib-quality-levels @version 2.0.8 @license Apache-2.0 */ | ||
import videojs from 'video.js'; | ||
import document from 'global/document'; | ||
var classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
}; | ||
function _inheritsLoose(subClass, superClass) { | ||
subClass.prototype = Object.create(superClass.prototype); | ||
subClass.prototype.constructor = subClass; | ||
subClass.__proto__ = superClass; | ||
} | ||
var inherits = function (subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; | ||
}; | ||
var possibleConstructorReturn = function (self, call) { | ||
if (!self) { | ||
function _assertThisInitialized(self) { | ||
if (self === void 0) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
return call && (typeof call === "object" || typeof call === "function") ? call : self; | ||
}; | ||
return self; | ||
} | ||
@@ -51,3 +35,2 @@ /** | ||
var QualityLevel = | ||
/** | ||
@@ -64,5 +47,2 @@ * Creates a QualityLevel | ||
function QualityLevel(representation) { | ||
classCallCheck(this, QualityLevel); | ||
var level = this; // eslint-disable-line | ||
@@ -72,2 +52,3 @@ | ||
level = document.createElement('custom'); | ||
for (var prop in QualityLevel.prototype) { | ||
@@ -86,3 +67,2 @@ if (prop !== 'constructor') { | ||
level.enabled_ = representation.enabled; | ||
Object.defineProperty(level, 'enabled', { | ||
@@ -94,7 +74,6 @@ /** | ||
*/ | ||
get: function get$$1() { | ||
get: function get() { | ||
return level.enabled_(); | ||
}, | ||
/** | ||
@@ -105,7 +84,6 @@ * Enable or disable the QualityLevel. | ||
*/ | ||
set: function set$$1(enable) { | ||
set: function set(enable) { | ||
level.enabled_(enable); | ||
} | ||
}); | ||
return level; | ||
@@ -135,16 +113,18 @@ }; | ||
var QualityLevelList = function (_videojs$EventTarget) { | ||
inherits(QualityLevelList, _videojs$EventTarget); | ||
var QualityLevelList = | ||
/*#__PURE__*/ | ||
function (_videojs$EventTarget) { | ||
_inheritsLoose(QualityLevelList, _videojs$EventTarget); | ||
function QualityLevelList() { | ||
var _ret; | ||
var _this; | ||
classCallCheck(this, QualityLevelList); | ||
_this = _videojs$EventTarget.call(this) || this; | ||
var _this = possibleConstructorReturn(this, _videojs$EventTarget.call(this)); | ||
var list = _assertThisInitialized(_assertThisInitialized(_this)); // eslint-disable-line | ||
var list = _this; // eslint-disable-line | ||
if (videojs.browser.IS_IE8) { | ||
list = document.createElement('custom'); | ||
for (var prop in QualityLevelList.prototype) { | ||
@@ -159,3 +139,2 @@ if (prop !== 'constructor') { | ||
list.selectedIndex_ = -1; | ||
/** | ||
@@ -167,8 +146,8 @@ * Get the index of the currently selected QualityLevel. | ||
*/ | ||
Object.defineProperty(list, 'selectedIndex', { | ||
get: function get$$1() { | ||
get: function get() { | ||
return list.selectedIndex_; | ||
} | ||
}); | ||
/** | ||
@@ -180,11 +159,10 @@ * Get the length of the list of QualityLevels. | ||
*/ | ||
Object.defineProperty(list, 'length', { | ||
get: function get$$1() { | ||
get: function get() { | ||
return list.levels_.length; | ||
} | ||
}); | ||
return _ret = list, possibleConstructorReturn(_this, _ret); | ||
return list || _assertThisInitialized(_this); | ||
} | ||
/** | ||
@@ -204,6 +182,7 @@ * Adds a quality level to the list. | ||
QualityLevelList.prototype.addQualityLevel = function addQualityLevel(representation) { | ||
var qualityLevel = this.getQualityLevelById(representation.id); | ||
var _proto = QualityLevelList.prototype; | ||
// Do not add duplicate quality levels | ||
_proto.addQualityLevel = function addQualityLevel(representation) { | ||
var qualityLevel = this.getQualityLevelById(representation.id); // Do not add duplicate quality levels | ||
if (qualityLevel) { | ||
@@ -214,3 +193,2 @@ return qualityLevel; | ||
var index = this.levels_.length; | ||
qualityLevel = new QualityLevel(representation); | ||
@@ -220,3 +198,3 @@ | ||
Object.defineProperty(this, index, { | ||
get: function get$$1() { | ||
get: function get() { | ||
return this.levels_[index]; | ||
@@ -228,3 +206,2 @@ } | ||
this.levels_.push(qualityLevel); | ||
this.trigger({ | ||
@@ -234,6 +211,4 @@ qualityLevel: qualityLevel, | ||
}); | ||
return qualityLevel; | ||
}; | ||
/** | ||
@@ -248,3 +223,3 @@ * Removes a quality level from the list. | ||
QualityLevelList.prototype.removeQualityLevel = function removeQualityLevel(qualityLevel) { | ||
_proto.removeQualityLevel = function removeQualityLevel(qualityLevel) { | ||
var removed = null; | ||
@@ -261,2 +236,3 @@ | ||
} | ||
break; | ||
@@ -275,3 +251,2 @@ } | ||
}; | ||
/** | ||
@@ -286,3 +261,3 @@ * Searches for a QualityLevel with the given id. | ||
QualityLevelList.prototype.getQualityLevelById = function getQualityLevelById(id) { | ||
_proto.getQualityLevelById = function getQualityLevelById(id) { | ||
for (var i = 0, l = this.length; i < l; i++) { | ||
@@ -295,5 +270,5 @@ var level = this[i]; | ||
} | ||
return null; | ||
}; | ||
/** | ||
@@ -306,3 +281,3 @@ * Resets the list of QualityLevels to empty | ||
QualityLevelList.prototype.dispose = function dispose() { | ||
_proto.dispose = function dispose() { | ||
this.selectedIndex_ = -1; | ||
@@ -314,3 +289,2 @@ this.levels_.length = 0; | ||
}(videojs.EventTarget); | ||
/** | ||
@@ -327,5 +301,4 @@ * change - The selected QualityLevel has changed. | ||
removequalitylevel: 'removequalitylevel' | ||
}; | ||
}; // emulate attribute EventHandler support to allow for feature detection | ||
// emulate attribute EventHandler support to allow for feature detection | ||
for (var event in QualityLevelList.prototype.allowedEvents_) { | ||
@@ -335,5 +308,5 @@ QualityLevelList.prototype['on' + event] = null; | ||
// vjs 5/6 support | ||
var version = "2.0.8"; | ||
var registerPlugin = videojs.registerPlugin || videojs.plugin; | ||
/** | ||
@@ -347,5 +320,5 @@ * Initialization function for the qualityLevels plugin. Sets up the QualityLevelList and | ||
*/ | ||
var initPlugin = function initPlugin(player, options) { | ||
var originalPluginFn = player.qualityLevels; | ||
var qualityLevelList = new QualityLevelList(); | ||
@@ -364,7 +337,6 @@ | ||
}; | ||
player.qualityLevels.VERSION = '__VERSION__'; | ||
return qualityLevelList; | ||
}; | ||
/** | ||
@@ -381,12 +353,13 @@ * A video.js plugin. | ||
*/ | ||
var qualityLevels = function qualityLevels(options) { | ||
return initPlugin(this, videojs.mergeOptions({}, options)); | ||
}; | ||
}; // Register the plugin with video.js. | ||
// Register the plugin with video.js. | ||
registerPlugin('qualityLevels', qualityLevels); | ||
// Include the version number. | ||
qualityLevels.VERSION = '__VERSION__'; | ||
registerPlugin('qualityLevels', qualityLevels); // Include the version number. | ||
qualityLevels.VERSION = version; | ||
export default qualityLevels; |
@@ -1,2 +0,2 @@ | ||
/*! @name videojs-contrib-quality-levels @version 2.0.7 @license Apache-2.0 */ | ||
/*! @name videojs-contrib-quality-levels @version 2.0.8 @license Apache-2.0 */ | ||
(function (global, factory) { | ||
@@ -11,31 +11,15 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('video.js'), require('global/document')) : | ||
var classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
}; | ||
function _inheritsLoose(subClass, superClass) { | ||
subClass.prototype = Object.create(superClass.prototype); | ||
subClass.prototype.constructor = subClass; | ||
subClass.__proto__ = superClass; | ||
} | ||
var inherits = function (subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; | ||
}; | ||
var possibleConstructorReturn = function (self, call) { | ||
if (!self) { | ||
function _assertThisInitialized(self) { | ||
if (self === void 0) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
return call && (typeof call === "object" || typeof call === "function") ? call : self; | ||
}; | ||
return self; | ||
} | ||
@@ -58,3 +42,2 @@ /** | ||
var QualityLevel = | ||
/** | ||
@@ -71,5 +54,2 @@ * Creates a QualityLevel | ||
function QualityLevel(representation) { | ||
classCallCheck(this, QualityLevel); | ||
var level = this; // eslint-disable-line | ||
@@ -79,2 +59,3 @@ | ||
level = document.createElement('custom'); | ||
for (var prop in QualityLevel.prototype) { | ||
@@ -93,3 +74,2 @@ if (prop !== 'constructor') { | ||
level.enabled_ = representation.enabled; | ||
Object.defineProperty(level, 'enabled', { | ||
@@ -101,7 +81,6 @@ /** | ||
*/ | ||
get: function get$$1() { | ||
get: function get() { | ||
return level.enabled_(); | ||
}, | ||
/** | ||
@@ -112,7 +91,6 @@ * Enable or disable the QualityLevel. | ||
*/ | ||
set: function set$$1(enable) { | ||
set: function set(enable) { | ||
level.enabled_(enable); | ||
} | ||
}); | ||
return level; | ||
@@ -142,16 +120,18 @@ }; | ||
var QualityLevelList = function (_videojs$EventTarget) { | ||
inherits(QualityLevelList, _videojs$EventTarget); | ||
var QualityLevelList = | ||
/*#__PURE__*/ | ||
function (_videojs$EventTarget) { | ||
_inheritsLoose(QualityLevelList, _videojs$EventTarget); | ||
function QualityLevelList() { | ||
var _ret; | ||
var _this; | ||
classCallCheck(this, QualityLevelList); | ||
_this = _videojs$EventTarget.call(this) || this; | ||
var _this = possibleConstructorReturn(this, _videojs$EventTarget.call(this)); | ||
var list = _assertThisInitialized(_assertThisInitialized(_this)); // eslint-disable-line | ||
var list = _this; // eslint-disable-line | ||
if (videojs.browser.IS_IE8) { | ||
list = document.createElement('custom'); | ||
for (var prop in QualityLevelList.prototype) { | ||
@@ -166,3 +146,2 @@ if (prop !== 'constructor') { | ||
list.selectedIndex_ = -1; | ||
/** | ||
@@ -174,8 +153,8 @@ * Get the index of the currently selected QualityLevel. | ||
*/ | ||
Object.defineProperty(list, 'selectedIndex', { | ||
get: function get$$1() { | ||
get: function get() { | ||
return list.selectedIndex_; | ||
} | ||
}); | ||
/** | ||
@@ -187,11 +166,10 @@ * Get the length of the list of QualityLevels. | ||
*/ | ||
Object.defineProperty(list, 'length', { | ||
get: function get$$1() { | ||
get: function get() { | ||
return list.levels_.length; | ||
} | ||
}); | ||
return _ret = list, possibleConstructorReturn(_this, _ret); | ||
return list || _assertThisInitialized(_this); | ||
} | ||
/** | ||
@@ -211,6 +189,7 @@ * Adds a quality level to the list. | ||
QualityLevelList.prototype.addQualityLevel = function addQualityLevel(representation) { | ||
var qualityLevel = this.getQualityLevelById(representation.id); | ||
var _proto = QualityLevelList.prototype; | ||
// Do not add duplicate quality levels | ||
_proto.addQualityLevel = function addQualityLevel(representation) { | ||
var qualityLevel = this.getQualityLevelById(representation.id); // Do not add duplicate quality levels | ||
if (qualityLevel) { | ||
@@ -221,3 +200,2 @@ return qualityLevel; | ||
var index = this.levels_.length; | ||
qualityLevel = new QualityLevel(representation); | ||
@@ -227,3 +205,3 @@ | ||
Object.defineProperty(this, index, { | ||
get: function get$$1() { | ||
get: function get() { | ||
return this.levels_[index]; | ||
@@ -235,3 +213,2 @@ } | ||
this.levels_.push(qualityLevel); | ||
this.trigger({ | ||
@@ -241,6 +218,4 @@ qualityLevel: qualityLevel, | ||
}); | ||
return qualityLevel; | ||
}; | ||
/** | ||
@@ -255,3 +230,3 @@ * Removes a quality level from the list. | ||
QualityLevelList.prototype.removeQualityLevel = function removeQualityLevel(qualityLevel) { | ||
_proto.removeQualityLevel = function removeQualityLevel(qualityLevel) { | ||
var removed = null; | ||
@@ -268,2 +243,3 @@ | ||
} | ||
break; | ||
@@ -282,3 +258,2 @@ } | ||
}; | ||
/** | ||
@@ -293,3 +268,3 @@ * Searches for a QualityLevel with the given id. | ||
QualityLevelList.prototype.getQualityLevelById = function getQualityLevelById(id) { | ||
_proto.getQualityLevelById = function getQualityLevelById(id) { | ||
for (var i = 0, l = this.length; i < l; i++) { | ||
@@ -302,5 +277,5 @@ var level = this[i]; | ||
} | ||
return null; | ||
}; | ||
/** | ||
@@ -313,3 +288,3 @@ * Resets the list of QualityLevels to empty | ||
QualityLevelList.prototype.dispose = function dispose() { | ||
_proto.dispose = function dispose() { | ||
this.selectedIndex_ = -1; | ||
@@ -321,3 +296,2 @@ this.levels_.length = 0; | ||
}(videojs.EventTarget); | ||
/** | ||
@@ -334,5 +308,4 @@ * change - The selected QualityLevel has changed. | ||
removequalitylevel: 'removequalitylevel' | ||
}; | ||
}; // emulate attribute EventHandler support to allow for feature detection | ||
// emulate attribute EventHandler support to allow for feature detection | ||
for (var event in QualityLevelList.prototype.allowedEvents_) { | ||
@@ -342,5 +315,5 @@ QualityLevelList.prototype['on' + event] = null; | ||
// vjs 5/6 support | ||
var version = "2.0.8"; | ||
var registerPlugin = videojs.registerPlugin || videojs.plugin; | ||
/** | ||
@@ -354,5 +327,5 @@ * Initialization function for the qualityLevels plugin. Sets up the QualityLevelList and | ||
*/ | ||
var initPlugin = function initPlugin(player, options) { | ||
var originalPluginFn = player.qualityLevels; | ||
var qualityLevelList = new QualityLevelList(); | ||
@@ -371,7 +344,6 @@ | ||
}; | ||
player.qualityLevels.VERSION = '__VERSION__'; | ||
return qualityLevelList; | ||
}; | ||
/** | ||
@@ -388,14 +360,15 @@ * A video.js plugin. | ||
*/ | ||
var qualityLevels = function qualityLevels(options) { | ||
return initPlugin(this, videojs.mergeOptions({}, options)); | ||
}; | ||
}; // Register the plugin with video.js. | ||
// Register the plugin with video.js. | ||
registerPlugin('qualityLevels', qualityLevels); | ||
// Include the version number. | ||
qualityLevels.VERSION = '__VERSION__'; | ||
registerPlugin('qualityLevels', qualityLevels); // Include the version number. | ||
qualityLevels.VERSION = version; | ||
return qualityLevels; | ||
}))); |
@@ -1,2 +0,2 @@ | ||
/*! @name videojs-contrib-quality-levels @version 2.0.7 @license Apache-2.0 */ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("video.js"),require("global/document")):"function"==typeof define&&define.amd?define(["video.js","global/document"],t):e.videojsContribQualityLevels=t(e.videojs,e.document)}(this,function(e,t){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e,t=t&&t.hasOwnProperty("default")?t.default:t;var n=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},i=function(i){function o(){n(this,o);var l=r(this,i.call(this)),s=l;if(e.browser.IS_IE8)for(var u in s=t.createElement("custom"),o.prototype)"constructor"!==u&&(s[u]=o.prototype[u]);return s.levels_=[],s.selectedIndex_=-1,Object.defineProperty(s,"selectedIndex",{get:function(){return s.selectedIndex_}}),Object.defineProperty(s,"length",{get:function(){return s.levels_.length}}),r(l,s)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(o,i),o.prototype.addQualityLevel=function(r){var i=this.getQualityLevelById(r.id);if(i)return i;var o=this.levels_.length;return i=new function r(i){n(this,r);var o=this;if(e.browser.IS_IE8)for(var l in o=t.createElement("custom"),r.prototype)"constructor"!==l&&(o[l]=r.prototype[l]);return o.id=i.id,o.label=o.id,o.width=i.width,o.height=i.height,o.bitrate=i.bandwidth,o.enabled_=i.enabled,Object.defineProperty(o,"enabled",{get:function(){return o.enabled_()},set:function(e){o.enabled_(e)}}),o}(r),""+o in this||Object.defineProperty(this,o,{get:function(){return this.levels_[o]}}),this.levels_.push(i),this.trigger({qualityLevel:i,type:"addqualitylevel"}),i},o.prototype.removeQualityLevel=function(e){for(var t=null,n=0,r=this.length;n<r;n++)if(this[n]===e){t=this.levels_.splice(n,1)[0],this.selectedIndex_===n?this.selectedIndex_=-1:this.selectedIndex_>n&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t},o.prototype.getQualityLevelById=function(e){for(var t=0,n=this.length;t<n;t++){var r=this[t];if(r.id===e)return r}return null},o.prototype.dispose=function(){this.selectedIndex_=-1,this.levels_.length=0},o}(e.EventTarget);for(var o in i.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"},i.prototype.allowedEvents_)i.prototype["on"+o]=null;var l=function(t){return n=this,e.mergeOptions({},t),r=n.qualityLevels,o=new i,n.on("dispose",function e(){o.dispose(),n.qualityLevels=r,n.off("dispose",e)}),n.qualityLevels=function(){return o},n.qualityLevels.VERSION="__VERSION__",o;var n,r,o};return(e.registerPlugin||e.plugin)("qualityLevels",l),l.VERSION="__VERSION__",l}); | ||
/*! @name videojs-contrib-quality-levels @version 2.0.8 @license Apache-2.0 */ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("video.js"),require("global/document")):"function"==typeof define&&define.amd?define(["video.js","global/document"],t):e.videojsContribQualityLevels=t(e.videojs,e.document)}(this,function(e,t){"use strict";function n(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}e=e&&e.hasOwnProperty("default")?e.default:e,t=t&&t.hasOwnProperty("default")?t.default:t;var r=function(r){var i,l;function o(){var i,l=n(n(i=r.call(this)||this));if(e.browser.IS_IE8)for(var s in l=t.createElement("custom"),o.prototype)"constructor"!==s&&(l[s]=o.prototype[s]);return l.levels_=[],l.selectedIndex_=-1,Object.defineProperty(l,"selectedIndex",{get:function(){return l.selectedIndex_}}),Object.defineProperty(l,"length",{get:function(){return l.levels_.length}}),l||n(i)}l=r,(i=o).prototype=Object.create(l.prototype),i.prototype.constructor=i,i.__proto__=l;var s=o.prototype;return s.addQualityLevel=function(n){var r=this.getQualityLevelById(n.id);if(r)return r;var i=this.levels_.length;return r=new function n(r){var i=this;if(e.browser.IS_IE8)for(var l in i=t.createElement("custom"),n.prototype)"constructor"!==l&&(i[l]=n.prototype[l]);return i.id=r.id,i.label=i.id,i.width=r.width,i.height=r.height,i.bitrate=r.bandwidth,i.enabled_=r.enabled,Object.defineProperty(i,"enabled",{get:function(){return i.enabled_()},set:function(e){i.enabled_(e)}}),i}(n),""+i in this||Object.defineProperty(this,i,{get:function(){return this.levels_[i]}}),this.levels_.push(r),this.trigger({qualityLevel:r,type:"addqualitylevel"}),r},s.removeQualityLevel=function(e){for(var t=null,n=0,r=this.length;n<r;n++)if(this[n]===e){t=this.levels_.splice(n,1)[0],this.selectedIndex_===n?this.selectedIndex_=-1:this.selectedIndex_>n&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t},s.getQualityLevelById=function(e){for(var t=0,n=this.length;t<n;t++){var r=this[t];if(r.id===e)return r}return null},s.dispose=function(){this.selectedIndex_=-1,this.levels_.length=0},o}(e.EventTarget);for(var i in r.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"},r.prototype.allowedEvents_)r.prototype["on"+i]=null;var l=function(t){return n=this,e.mergeOptions({},t),i=n.qualityLevels,l=new r,n.on("dispose",function e(){l.dispose(),n.qualityLevels=i,n.off("dispose",e)}),n.qualityLevels=function(){return l},n.qualityLevels.VERSION="__VERSION__",l;var n,i,l};return(e.registerPlugin||e.plugin)("qualityLevels",l),l.VERSION="2.0.8",l}); |
{ | ||
"name": "videojs-contrib-quality-levels", | ||
"version": "2.0.7", | ||
"version": "2.0.8", | ||
"description": "Exposes a list of quality levels available for the source.", | ||
@@ -8,3 +8,3 @@ "main": "dist/videojs-contrib-quality-levels.cjs.js", | ||
"generator-videojs-plugin": { | ||
"version": "7.0.2" | ||
"version": "7.3.2" | ||
}, | ||
@@ -19,6 +19,6 @@ "repository": "videojs/videojs-contrib-quality-levels", | ||
"docs": "npm-run-all docs:*", | ||
"docs:api": "jsdoc src -g plugins/markdown -r -c scripts/jsdoc.json -d docs/api", | ||
"docs:api": "jsdoc src -g plugins/markdown -r -d docs/api", | ||
"docs:toc": "doctoc README.md", | ||
"lint": "vjsstandard", | ||
"server": "karma start scripts/karma.conf.js --singleRun=false --auto-watch --no-browsers", | ||
"server": "karma start scripts/karma.conf.js --singleRun=false --auto-watch", | ||
"start": "npm-run-all -p server watch", | ||
@@ -32,4 +32,4 @@ "pretest": "npm-run-all lint build", | ||
"watch:js": "npm run build:js -- -w", | ||
"prepublish": "not-in-install && npm run build || in-install", | ||
"precommit": "lint-staged" | ||
"posttest": "shx cat test/dist/coverage/text.txt", | ||
"prepublishOnly": "npm run build && vjsverify" | ||
}, | ||
@@ -72,4 +72,3 @@ "keywords": [ | ||
"doctoc": "^1.3.1", | ||
"husky": "^0.14.3", | ||
"in-publish": "^2.0.0", | ||
"husky": "^1.0.0-rc.13", | ||
"jsdoc": "https://github.com/BrandonOCasey/jsdoc#feat/plugin-from-cli", | ||
@@ -80,10 +79,13 @@ "karma": "^3.0.0", | ||
"npm-run-all": "^4.1.3", | ||
"rollup": "^0.64.1", | ||
"rollup": "^0.66.0", | ||
"semver": "^5.1.0", | ||
"shx": "^0.3.2", | ||
"sinon": "^6.1.5", | ||
"videojs-contrib-hls": "^4.1.0", | ||
"videojs-generate-karma-config": "~1.0.1", | ||
"videojs-generate-rollup-config": "~1.0.0", | ||
"videojs-standard": "^7.0.1" | ||
"videojs-contrib-hls": "^5.14.1", | ||
"videojs-generate-karma-config": "~3.0.0", | ||
"videojs-generate-rollup-config": "~2.2.0", | ||
"videojs-standard": "~7.1.0", | ||
"pkg-ok": "^2.2.0", | ||
"npm-merge-driver-install": "^1.0.0", | ||
"videojs-generator-verify": "~1.0.3" | ||
}, | ||
@@ -104,3 +106,8 @@ "module": "dist/videojs-contrib-quality-levels.es.js", | ||
] | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
} | ||
} |
const generate = require('videojs-generate-karma-config'); | ||
module.exports = function(config) { | ||
config = generate(config); | ||
// any custom stuff here! | ||
// see https://github.com/videojs/videojs-generate-karma-config | ||
// for options | ||
const options = {}; | ||
config = generate(config, options); | ||
// any other custom stuff not supported by options here! | ||
}; | ||
import videojs from 'video.js'; | ||
import QualityLevelList from './quality-level-list.js'; | ||
import {version as VERSION} from '../package.json'; | ||
@@ -53,4 +54,4 @@ // vjs 5/6 support | ||
// Include the version number. | ||
qualityLevels.VERSION = '__VERSION__'; | ||
qualityLevels.VERSION = VERSION; | ||
export default qualityLevels; |
@@ -1,2 +0,2 @@ | ||
/*! @name videojs-contrib-quality-levels @version 2.0.7 @license Apache-2.0 */ | ||
/*! @name videojs-contrib-quality-levels @version 2.0.8 @license Apache-2.0 */ | ||
(function (videojs,QUnit,sinon) { | ||
@@ -37,219 +37,1443 @@ 'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { | ||
return typeof obj; | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; | ||
}; | ||
function _inheritsLoose(subClass, superClass) { | ||
subClass.prototype = Object.create(superClass.prototype); | ||
subClass.prototype.constructor = subClass; | ||
subClass.__proto__ = superClass; | ||
} | ||
var classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
function _assertThisInitialized(self) { | ||
if (self === void 0) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
}; | ||
var inherits = function (subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | ||
} | ||
return self; | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; | ||
}; | ||
var cov_16u5qaq6ri = function () { | ||
var path = '/Users/bcasey/Projects/videojs-contrib-quality-levels/src/quality-level.js', | ||
hash = '9b098e591aefc43810561c6cec5fcfc475ee7788', | ||
Function = function () {}.constructor, | ||
global = new Function('return this')(), | ||
gcv = '__coverage__', | ||
coverageData = { | ||
path: '/Users/bcasey/Projects/videojs-contrib-quality-levels/src/quality-level.js', | ||
statementMap: { | ||
'0': { | ||
start: { | ||
line: 32, | ||
column: 16 | ||
}, | ||
end: { | ||
line: 32, | ||
column: 20 | ||
} | ||
}, | ||
'1': { | ||
start: { | ||
line: 34, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 41, | ||
column: 5 | ||
} | ||
}, | ||
'2': { | ||
start: { | ||
line: 35, | ||
column: 6 | ||
}, | ||
end: { | ||
line: 35, | ||
column: 47 | ||
} | ||
}, | ||
'3': { | ||
start: { | ||
line: 36, | ||
column: 6 | ||
}, | ||
end: { | ||
line: 40, | ||
column: 7 | ||
} | ||
}, | ||
'4': { | ||
start: { | ||
line: 37, | ||
column: 8 | ||
}, | ||
end: { | ||
line: 39, | ||
column: 9 | ||
} | ||
}, | ||
'5': { | ||
start: { | ||
line: 38, | ||
column: 10 | ||
}, | ||
end: { | ||
line: 38, | ||
column: 53 | ||
} | ||
}, | ||
'6': { | ||
start: { | ||
line: 43, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 43, | ||
column: 33 | ||
} | ||
}, | ||
'7': { | ||
start: { | ||
line: 44, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 44, | ||
column: 27 | ||
} | ||
}, | ||
'8': { | ||
start: { | ||
line: 45, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 45, | ||
column: 39 | ||
} | ||
}, | ||
'9': { | ||
start: { | ||
line: 46, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 46, | ||
column: 41 | ||
} | ||
}, | ||
'10': { | ||
start: { | ||
line: 47, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 47, | ||
column: 45 | ||
} | ||
}, | ||
'11': { | ||
start: { | ||
line: 48, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 48, | ||
column: 44 | ||
} | ||
}, | ||
'12': { | ||
start: { | ||
line: 50, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 68, | ||
column: 7 | ||
} | ||
}, | ||
'13': { | ||
start: { | ||
line: 57, | ||
column: 8 | ||
}, | ||
end: { | ||
line: 57, | ||
column: 32 | ||
} | ||
}, | ||
'14': { | ||
start: { | ||
line: 66, | ||
column: 8 | ||
}, | ||
end: { | ||
line: 66, | ||
column: 31 | ||
} | ||
}, | ||
'15': { | ||
start: { | ||
line: 70, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 70, | ||
column: 17 | ||
} | ||
} | ||
}, | ||
fnMap: { | ||
'0': { | ||
name: '(anonymous_0)', | ||
decl: { | ||
start: { | ||
line: 30, | ||
column: 2 | ||
}, | ||
end: { | ||
line: 30, | ||
column: 3 | ||
} | ||
}, | ||
loc: { | ||
start: { | ||
line: 30, | ||
column: 30 | ||
}, | ||
end: { | ||
line: 71, | ||
column: 3 | ||
} | ||
}, | ||
line: 30 | ||
} | ||
}, | ||
branchMap: { | ||
'0': { | ||
loc: { | ||
start: { | ||
line: 34, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 41, | ||
column: 5 | ||
} | ||
}, | ||
type: 'if', | ||
locations: [{ | ||
start: { | ||
line: 34, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 41, | ||
column: 5 | ||
} | ||
}, { | ||
start: { | ||
line: 34, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 41, | ||
column: 5 | ||
} | ||
}], | ||
line: 34 | ||
}, | ||
'1': { | ||
loc: { | ||
start: { | ||
line: 37, | ||
column: 8 | ||
}, | ||
end: { | ||
line: 39, | ||
column: 9 | ||
} | ||
}, | ||
type: 'if', | ||
locations: [{ | ||
start: { | ||
line: 37, | ||
column: 8 | ||
}, | ||
end: { | ||
line: 39, | ||
column: 9 | ||
} | ||
}, { | ||
start: { | ||
line: 37, | ||
column: 8 | ||
}, | ||
end: { | ||
line: 39, | ||
column: 9 | ||
} | ||
}], | ||
line: 37 | ||
} | ||
}, | ||
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 | ||
}, | ||
f: { | ||
'0': 0 | ||
}, | ||
b: { | ||
'0': [0, 0], | ||
'1': [0, 0] | ||
}, | ||
_coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' | ||
}, | ||
coverage = global[gcv] || (global[gcv] = {}); | ||
var possibleConstructorReturn = function (self, call) { | ||
if (!self) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
if (coverage[path] && coverage[path].hash === hash) { | ||
return coverage[path]; | ||
} | ||
return call && (typeof call === "object" || typeof call === "function") ? call : self; | ||
}; | ||
coverageData.hash = hash; | ||
return coverage[path] = coverageData; | ||
}(); | ||
/** | ||
* A single QualityLevel. | ||
* | ||
* interface QualityLevel { | ||
* readonly attribute DOMString id; | ||
* attribute DOMString label; | ||
* readonly attribute long width; | ||
* readonly attribute long height; | ||
* readonly attribute long bitrate; | ||
* attribute boolean enabled; | ||
* }; | ||
* | ||
* @class QualityLevel | ||
*/ | ||
var QualityLevel = function QualityLevel(representation) { | ||
cov_16u5qaq6ri.f[0]++; | ||
var level = (cov_16u5qaq6ri.s[0]++, this); | ||
cov_16u5qaq6ri.s[1]++; | ||
var QualityLevel = | ||
/** | ||
* Creates a QualityLevel | ||
* | ||
* @param {Representation|Object} representation The representation of the quality level | ||
* @param {string} representation.id Unique id of the QualityLevel | ||
* @param {number=} representation.width Resolution width of the QualityLevel | ||
* @param {number=} representation.height Resolution height of the QualityLevel | ||
* @param {number} representation.bandwidth Bitrate of the QualityLevel | ||
* @param {Function} representation.enabled Callback to enable/disable QualityLevel | ||
*/ | ||
function QualityLevel(representation) { | ||
classCallCheck(this, QualityLevel); | ||
var level = this; // eslint-disable-line | ||
if (videojs.browser.IS_IE8) { | ||
cov_16u5qaq6ri.b[0][0]++; | ||
cov_16u5qaq6ri.s[2]++; | ||
level = document_1.createElement('custom'); | ||
cov_16u5qaq6ri.s[3]++; | ||
for (var prop in QualityLevel.prototype) { | ||
cov_16u5qaq6ri.s[4]++; | ||
if (prop !== 'constructor') { | ||
cov_16u5qaq6ri.b[1][0]++; | ||
cov_16u5qaq6ri.s[5]++; | ||
level[prop] = QualityLevel.prototype[prop]; | ||
} else { | ||
cov_16u5qaq6ri.b[1][1]++; | ||
} | ||
} | ||
} else { | ||
cov_16u5qaq6ri.b[0][1]++; | ||
} | ||
cov_16u5qaq6ri.s[6]++; | ||
level.id = representation.id; | ||
cov_16u5qaq6ri.s[7]++; | ||
level.label = level.id; | ||
cov_16u5qaq6ri.s[8]++; | ||
level.width = representation.width; | ||
cov_16u5qaq6ri.s[9]++; | ||
level.height = representation.height; | ||
cov_16u5qaq6ri.s[10]++; | ||
level.bitrate = representation.bandwidth; | ||
cov_16u5qaq6ri.s[11]++; | ||
level.enabled_ = representation.enabled; | ||
cov_16u5qaq6ri.s[12]++; | ||
Object.defineProperty(level, 'enabled', { | ||
/** | ||
* Get whether the QualityLevel is enabled. | ||
* | ||
* @return {boolean} True if the QualityLevel is enabled. | ||
*/ | ||
get: function get$$1() { | ||
get: function get() { | ||
cov_16u5qaq6ri.s[13]++; | ||
return level.enabled_(); | ||
}, | ||
/** | ||
* Enable or disable the QualityLevel. | ||
* | ||
* @param {boolean} enable true to enable QualityLevel, false to disable. | ||
*/ | ||
set: function set$$1(enable) { | ||
set: function set(enable) { | ||
cov_16u5qaq6ri.s[14]++; | ||
level.enabled_(enable); | ||
} | ||
}); | ||
cov_16u5qaq6ri.s[15]++; | ||
return level; | ||
}; | ||
/** | ||
* A list of QualityLevels. | ||
* | ||
* interface QualityLevelList : EventTarget { | ||
* getter QualityLevel (unsigned long index); | ||
* readonly attribute unsigned long length; | ||
* readonly attribute long selectedIndex; | ||
* | ||
* void addQualityLevel(QualityLevel qualityLevel) | ||
* void removeQualityLevel(QualityLevel remove) | ||
* QualityLevel? getQualityLevelById(DOMString id); | ||
* | ||
* attribute EventHandler onchange; | ||
* attribute EventHandler onaddqualitylevel; | ||
* attribute EventHandler onremovequalitylevel; | ||
* }; | ||
* | ||
* @extends videojs.EventTarget | ||
* @class QualityLevelList | ||
*/ | ||
var cov_wzippijjz = function () { | ||
var path = '/Users/bcasey/Projects/videojs-contrib-quality-levels/src/quality-level-list.js', | ||
hash = '3e15c65be5694067ae665f54753573ed88a39236', | ||
Function = function () {}.constructor, | ||
global = new Function('return this')(), | ||
gcv = '__coverage__', | ||
coverageData = { | ||
path: '/Users/bcasey/Projects/videojs-contrib-quality-levels/src/quality-level-list.js', | ||
statementMap: { | ||
'0': { | ||
start: { | ||
line: 27, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 27, | ||
column: 12 | ||
} | ||
}, | ||
'1': { | ||
start: { | ||
line: 29, | ||
column: 15 | ||
}, | ||
end: { | ||
line: 29, | ||
column: 19 | ||
} | ||
}, | ||
'2': { | ||
start: { | ||
line: 31, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 38, | ||
column: 5 | ||
} | ||
}, | ||
'3': { | ||
start: { | ||
line: 32, | ||
column: 6 | ||
}, | ||
end: { | ||
line: 32, | ||
column: 46 | ||
} | ||
}, | ||
'4': { | ||
start: { | ||
line: 33, | ||
column: 6 | ||
}, | ||
end: { | ||
line: 37, | ||
column: 7 | ||
} | ||
}, | ||
'5': { | ||
start: { | ||
line: 34, | ||
column: 8 | ||
}, | ||
end: { | ||
line: 36, | ||
column: 9 | ||
} | ||
}, | ||
'6': { | ||
start: { | ||
line: 35, | ||
column: 10 | ||
}, | ||
end: { | ||
line: 35, | ||
column: 56 | ||
} | ||
}, | ||
'7': { | ||
start: { | ||
line: 40, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 40, | ||
column: 22 | ||
} | ||
}, | ||
'8': { | ||
start: { | ||
line: 41, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 41, | ||
column: 29 | ||
} | ||
}, | ||
'9': { | ||
start: { | ||
line: 49, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 53, | ||
column: 7 | ||
} | ||
}, | ||
'10': { | ||
start: { | ||
line: 51, | ||
column: 8 | ||
}, | ||
end: { | ||
line: 51, | ||
column: 35 | ||
} | ||
}, | ||
'11': { | ||
start: { | ||
line: 61, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 65, | ||
column: 7 | ||
} | ||
}, | ||
'12': { | ||
start: { | ||
line: 63, | ||
column: 8 | ||
}, | ||
end: { | ||
line: 63, | ||
column: 35 | ||
} | ||
}, | ||
'13': { | ||
start: { | ||
line: 67, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 67, | ||
column: 16 | ||
} | ||
}, | ||
'14': { | ||
start: { | ||
line: 83, | ||
column: 23 | ||
}, | ||
end: { | ||
line: 83, | ||
column: 66 | ||
} | ||
}, | ||
'15': { | ||
start: { | ||
line: 86, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 88, | ||
column: 5 | ||
} | ||
}, | ||
'16': { | ||
start: { | ||
line: 87, | ||
column: 6 | ||
}, | ||
end: { | ||
line: 87, | ||
column: 26 | ||
} | ||
}, | ||
'17': { | ||
start: { | ||
line: 90, | ||
column: 18 | ||
}, | ||
end: { | ||
line: 90, | ||
column: 37 | ||
} | ||
}, | ||
'18': { | ||
start: { | ||
line: 92, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 92, | ||
column: 52 | ||
} | ||
}, | ||
'19': { | ||
start: { | ||
line: 94, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 100, | ||
column: 5 | ||
} | ||
}, | ||
'20': { | ||
start: { | ||
line: 95, | ||
column: 6 | ||
}, | ||
end: { | ||
line: 99, | ||
column: 9 | ||
} | ||
}, | ||
'21': { | ||
start: { | ||
line: 97, | ||
column: 10 | ||
}, | ||
end: { | ||
line: 97, | ||
column: 37 | ||
} | ||
}, | ||
'22': { | ||
start: { | ||
line: 102, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 102, | ||
column: 36 | ||
} | ||
}, | ||
'23': { | ||
start: { | ||
line: 104, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 107, | ||
column: 7 | ||
} | ||
}, | ||
'24': { | ||
start: { | ||
line: 109, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 109, | ||
column: 24 | ||
} | ||
}, | ||
'25': { | ||
start: { | ||
line: 120, | ||
column: 18 | ||
}, | ||
end: { | ||
line: 120, | ||
column: 22 | ||
} | ||
}, | ||
'26': { | ||
start: { | ||
line: 122, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 133, | ||
column: 5 | ||
} | ||
}, | ||
'27': { | ||
start: { | ||
line: 123, | ||
column: 6 | ||
}, | ||
end: { | ||
line: 132, | ||
column: 7 | ||
} | ||
}, | ||
'28': { | ||
start: { | ||
line: 124, | ||
column: 8 | ||
}, | ||
end: { | ||
line: 124, | ||
column: 47 | ||
} | ||
}, | ||
'29': { | ||
start: { | ||
line: 126, | ||
column: 8 | ||
}, | ||
end: { | ||
line: 130, | ||
column: 9 | ||
} | ||
}, | ||
'30': { | ||
start: { | ||
line: 127, | ||
column: 10 | ||
}, | ||
end: { | ||
line: 127, | ||
column: 35 | ||
} | ||
}, | ||
'31': { | ||
start: { | ||
line: 128, | ||
column: 15 | ||
}, | ||
end: { | ||
line: 130, | ||
column: 9 | ||
} | ||
}, | ||
'32': { | ||
start: { | ||
line: 129, | ||
column: 10 | ||
}, | ||
end: { | ||
line: 129, | ||
column: 32 | ||
} | ||
}, | ||
'33': { | ||
start: { | ||
line: 131, | ||
column: 8 | ||
}, | ||
end: { | ||
line: 131, | ||
column: 14 | ||
} | ||
}, | ||
'34': { | ||
start: { | ||
line: 135, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 140, | ||
column: 5 | ||
} | ||
}, | ||
'35': { | ||
start: { | ||
line: 136, | ||
column: 6 | ||
}, | ||
end: { | ||
line: 139, | ||
column: 9 | ||
} | ||
}, | ||
'36': { | ||
start: { | ||
line: 142, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 142, | ||
column: 19 | ||
} | ||
}, | ||
'37': { | ||
start: { | ||
line: 153, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 159, | ||
column: 5 | ||
} | ||
}, | ||
'38': { | ||
start: { | ||
line: 154, | ||
column: 20 | ||
}, | ||
end: { | ||
line: 154, | ||
column: 27 | ||
} | ||
}, | ||
'39': { | ||
start: { | ||
line: 156, | ||
column: 6 | ||
}, | ||
end: { | ||
line: 158, | ||
column: 7 | ||
} | ||
}, | ||
'40': { | ||
start: { | ||
line: 157, | ||
column: 8 | ||
}, | ||
end: { | ||
line: 157, | ||
column: 21 | ||
} | ||
}, | ||
'41': { | ||
start: { | ||
line: 160, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 160, | ||
column: 16 | ||
} | ||
}, | ||
'42': { | ||
start: { | ||
line: 169, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 169, | ||
column: 29 | ||
} | ||
}, | ||
'43': { | ||
start: { | ||
line: 170, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 170, | ||
column: 28 | ||
} | ||
}, | ||
'44': { | ||
start: { | ||
line: 179, | ||
column: 0 | ||
}, | ||
end: { | ||
line: 183, | ||
column: 2 | ||
} | ||
}, | ||
'45': { | ||
start: { | ||
line: 186, | ||
column: 0 | ||
}, | ||
end: { | ||
line: 188, | ||
column: 1 | ||
} | ||
}, | ||
'46': { | ||
start: { | ||
line: 187, | ||
column: 2 | ||
}, | ||
end: { | ||
line: 187, | ||
column: 50 | ||
} | ||
} | ||
}, | ||
fnMap: { | ||
'0': { | ||
name: '(anonymous_0)', | ||
decl: { | ||
start: { | ||
line: 26, | ||
column: 2 | ||
}, | ||
end: { | ||
line: 26, | ||
column: 3 | ||
} | ||
}, | ||
loc: { | ||
start: { | ||
line: 26, | ||
column: 16 | ||
}, | ||
end: { | ||
line: 68, | ||
column: 3 | ||
} | ||
}, | ||
line: 26 | ||
}, | ||
'1': { | ||
name: '(anonymous_1)', | ||
decl: { | ||
start: { | ||
line: 82, | ||
column: 2 | ||
}, | ||
end: { | ||
line: 82, | ||
column: 3 | ||
} | ||
}, | ||
loc: { | ||
start: { | ||
line: 82, | ||
column: 34 | ||
}, | ||
end: { | ||
line: 110, | ||
column: 3 | ||
} | ||
}, | ||
line: 82 | ||
}, | ||
'2': { | ||
name: '(anonymous_2)', | ||
decl: { | ||
start: { | ||
line: 119, | ||
column: 2 | ||
}, | ||
end: { | ||
line: 119, | ||
column: 3 | ||
} | ||
}, | ||
loc: { | ||
start: { | ||
line: 119, | ||
column: 35 | ||
}, | ||
end: { | ||
line: 143, | ||
column: 3 | ||
} | ||
}, | ||
line: 119 | ||
}, | ||
'3': { | ||
name: '(anonymous_3)', | ||
decl: { | ||
start: { | ||
line: 152, | ||
column: 2 | ||
}, | ||
end: { | ||
line: 152, | ||
column: 3 | ||
} | ||
}, | ||
loc: { | ||
start: { | ||
line: 152, | ||
column: 26 | ||
}, | ||
end: { | ||
line: 161, | ||
column: 3 | ||
} | ||
}, | ||
line: 152 | ||
}, | ||
'4': { | ||
name: '(anonymous_4)', | ||
decl: { | ||
start: { | ||
line: 168, | ||
column: 2 | ||
}, | ||
end: { | ||
line: 168, | ||
column: 3 | ||
} | ||
}, | ||
loc: { | ||
start: { | ||
line: 168, | ||
column: 12 | ||
}, | ||
end: { | ||
line: 171, | ||
column: 3 | ||
} | ||
}, | ||
line: 168 | ||
} | ||
}, | ||
branchMap: { | ||
'0': { | ||
loc: { | ||
start: { | ||
line: 31, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 38, | ||
column: 5 | ||
} | ||
}, | ||
type: 'if', | ||
locations: [{ | ||
start: { | ||
line: 31, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 38, | ||
column: 5 | ||
} | ||
}, { | ||
start: { | ||
line: 31, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 38, | ||
column: 5 | ||
} | ||
}], | ||
line: 31 | ||
}, | ||
'1': { | ||
loc: { | ||
start: { | ||
line: 34, | ||
column: 8 | ||
}, | ||
end: { | ||
line: 36, | ||
column: 9 | ||
} | ||
}, | ||
type: 'if', | ||
locations: [{ | ||
start: { | ||
line: 34, | ||
column: 8 | ||
}, | ||
end: { | ||
line: 36, | ||
column: 9 | ||
} | ||
}, { | ||
start: { | ||
line: 34, | ||
column: 8 | ||
}, | ||
end: { | ||
line: 36, | ||
column: 9 | ||
} | ||
}], | ||
line: 34 | ||
}, | ||
'2': { | ||
loc: { | ||
start: { | ||
line: 86, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 88, | ||
column: 5 | ||
} | ||
}, | ||
type: 'if', | ||
locations: [{ | ||
start: { | ||
line: 86, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 88, | ||
column: 5 | ||
} | ||
}, { | ||
start: { | ||
line: 86, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 88, | ||
column: 5 | ||
} | ||
}], | ||
line: 86 | ||
}, | ||
'3': { | ||
loc: { | ||
start: { | ||
line: 94, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 100, | ||
column: 5 | ||
} | ||
}, | ||
type: 'if', | ||
locations: [{ | ||
start: { | ||
line: 94, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 100, | ||
column: 5 | ||
} | ||
}, { | ||
start: { | ||
line: 94, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 100, | ||
column: 5 | ||
} | ||
}], | ||
line: 94 | ||
}, | ||
'4': { | ||
loc: { | ||
start: { | ||
line: 123, | ||
column: 6 | ||
}, | ||
end: { | ||
line: 132, | ||
column: 7 | ||
} | ||
}, | ||
type: 'if', | ||
locations: [{ | ||
start: { | ||
line: 123, | ||
column: 6 | ||
}, | ||
end: { | ||
line: 132, | ||
column: 7 | ||
} | ||
}, { | ||
start: { | ||
line: 123, | ||
column: 6 | ||
}, | ||
end: { | ||
line: 132, | ||
column: 7 | ||
} | ||
}], | ||
line: 123 | ||
}, | ||
'5': { | ||
loc: { | ||
start: { | ||
line: 126, | ||
column: 8 | ||
}, | ||
end: { | ||
line: 130, | ||
column: 9 | ||
} | ||
}, | ||
type: 'if', | ||
locations: [{ | ||
start: { | ||
line: 126, | ||
column: 8 | ||
}, | ||
end: { | ||
line: 130, | ||
column: 9 | ||
} | ||
}, { | ||
start: { | ||
line: 126, | ||
column: 8 | ||
}, | ||
end: { | ||
line: 130, | ||
column: 9 | ||
} | ||
}], | ||
line: 126 | ||
}, | ||
'6': { | ||
loc: { | ||
start: { | ||
line: 128, | ||
column: 15 | ||
}, | ||
end: { | ||
line: 130, | ||
column: 9 | ||
} | ||
}, | ||
type: 'if', | ||
locations: [{ | ||
start: { | ||
line: 128, | ||
column: 15 | ||
}, | ||
end: { | ||
line: 130, | ||
column: 9 | ||
} | ||
}, { | ||
start: { | ||
line: 128, | ||
column: 15 | ||
}, | ||
end: { | ||
line: 130, | ||
column: 9 | ||
} | ||
}], | ||
line: 128 | ||
}, | ||
'7': { | ||
loc: { | ||
start: { | ||
line: 135, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 140, | ||
column: 5 | ||
} | ||
}, | ||
type: 'if', | ||
locations: [{ | ||
start: { | ||
line: 135, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 140, | ||
column: 5 | ||
} | ||
}, { | ||
start: { | ||
line: 135, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 140, | ||
column: 5 | ||
} | ||
}], | ||
line: 135 | ||
}, | ||
'8': { | ||
loc: { | ||
start: { | ||
line: 156, | ||
column: 6 | ||
}, | ||
end: { | ||
line: 158, | ||
column: 7 | ||
} | ||
}, | ||
type: 'if', | ||
locations: [{ | ||
start: { | ||
line: 156, | ||
column: 6 | ||
}, | ||
end: { | ||
line: 158, | ||
column: 7 | ||
} | ||
}, { | ||
start: { | ||
line: 156, | ||
column: 6 | ||
}, | ||
end: { | ||
line: 158, | ||
column: 7 | ||
} | ||
}], | ||
line: 156 | ||
} | ||
}, | ||
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 | ||
}, | ||
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] | ||
}, | ||
_coverageSchema: '332fd63041d2c1bcb487cc26dd0d5f7d97098a6c' | ||
}, | ||
coverage = global[gcv] || (global[gcv] = {}); | ||
var QualityLevelList = function (_videojs$EventTarget) { | ||
inherits(QualityLevelList, _videojs$EventTarget); | ||
if (coverage[path] && coverage[path].hash === hash) { | ||
return coverage[path]; | ||
} | ||
function QualityLevelList() { | ||
var _ret; | ||
coverageData.hash = hash; | ||
return coverage[path] = coverageData; | ||
}(); | ||
classCallCheck(this, QualityLevelList); | ||
var QualityLevelList = | ||
/*#__PURE__*/ | ||
function (_videojs$EventTarget) { | ||
_inheritsLoose(QualityLevelList, _videojs$EventTarget); | ||
var _this = possibleConstructorReturn(this, _videojs$EventTarget.call(this)); | ||
function QualityLevelList() { | ||
var _this; | ||
var list = _this; // eslint-disable-line | ||
cov_wzippijjz.f[0]++; | ||
cov_wzippijjz.s[0]++; | ||
_this = _videojs$EventTarget.call(this) || this; | ||
var list = (cov_wzippijjz.s[1]++, _assertThisInitialized(_assertThisInitialized(_this))); | ||
cov_wzippijjz.s[2]++; | ||
if (videojs.browser.IS_IE8) { | ||
cov_wzippijjz.b[0][0]++; | ||
cov_wzippijjz.s[3]++; | ||
list = document_1.createElement('custom'); | ||
cov_wzippijjz.s[4]++; | ||
for (var prop in QualityLevelList.prototype) { | ||
cov_wzippijjz.s[5]++; | ||
if (prop !== 'constructor') { | ||
cov_wzippijjz.b[1][0]++; | ||
cov_wzippijjz.s[6]++; | ||
list[prop] = QualityLevelList.prototype[prop]; | ||
} else { | ||
cov_wzippijjz.b[1][1]++; | ||
} | ||
} | ||
} else { | ||
cov_wzippijjz.b[0][1]++; | ||
} | ||
cov_wzippijjz.s[7]++; | ||
list.levels_ = []; | ||
cov_wzippijjz.s[8]++; | ||
list.selectedIndex_ = -1; | ||
/** | ||
* Get the index of the currently selected QualityLevel. | ||
* | ||
* @returns {number} The index of the selected QualityLevel. -1 if none selected. | ||
* @readonly | ||
*/ | ||
cov_wzippijjz.s[9]++; | ||
Object.defineProperty(list, 'selectedIndex', { | ||
get: function get$$1() { | ||
get: function get() { | ||
cov_wzippijjz.s[10]++; | ||
return list.selectedIndex_; | ||
} | ||
}); | ||
/** | ||
* Get the length of the list of QualityLevels. | ||
* | ||
* @returns {number} The length of the list. | ||
* @readonly | ||
*/ | ||
cov_wzippijjz.s[11]++; | ||
Object.defineProperty(list, 'length', { | ||
get: function get$$1() { | ||
get: function get() { | ||
cov_wzippijjz.s[12]++; | ||
return list.levels_.length; | ||
} | ||
}); | ||
return _ret = list, possibleConstructorReturn(_this, _ret); | ||
cov_wzippijjz.s[13]++; | ||
return list || _assertThisInitialized(_this); | ||
} | ||
/** | ||
* Adds a quality level to the list. | ||
* | ||
* @param {Representation|Object} representation The representation of the quality level | ||
* @param {string} representation.id Unique id of the QualityLevel | ||
* @param {number=} representation.width Resolution width of the QualityLevel | ||
* @param {number=} representation.height Resolution height of the QualityLevel | ||
* @param {number} representation.bandwidth Bitrate of the QualityLevel | ||
* @param {Function} representation.enabled Callback to enable/disable QualityLevel | ||
* @return {QualityLevel} the QualityLevel added to the list | ||
* @method addQualityLevel | ||
*/ | ||
var _proto = QualityLevelList.prototype; | ||
_proto.addQualityLevel = function addQualityLevel(representation) { | ||
cov_wzippijjz.f[1]++; | ||
var qualityLevel = (cov_wzippijjz.s[14]++, this.getQualityLevelById(representation.id)); | ||
cov_wzippijjz.s[15]++; | ||
QualityLevelList.prototype.addQualityLevel = function addQualityLevel(representation) { | ||
var qualityLevel = this.getQualityLevelById(representation.id); | ||
// Do not add duplicate quality levels | ||
if (qualityLevel) { | ||
cov_wzippijjz.b[2][0]++; | ||
cov_wzippijjz.s[16]++; | ||
return qualityLevel; | ||
} else { | ||
cov_wzippijjz.b[2][1]++; | ||
} | ||
var index = this.levels_.length; | ||
var index = (cov_wzippijjz.s[17]++, this.levels_.length); | ||
cov_wzippijjz.s[18]++; | ||
qualityLevel = new QualityLevel(representation); | ||
cov_wzippijjz.s[19]++; | ||
if (!('' + index in this)) { | ||
cov_wzippijjz.b[3][0]++; | ||
cov_wzippijjz.s[20]++; | ||
Object.defineProperty(this, index, { | ||
get: function get$$1() { | ||
get: function get() { | ||
cov_wzippijjz.s[21]++; | ||
return this.levels_[index]; | ||
} | ||
}); | ||
} else { | ||
cov_wzippijjz.b[3][1]++; | ||
} | ||
cov_wzippijjz.s[22]++; | ||
this.levels_.push(qualityLevel); | ||
cov_wzippijjz.s[23]++; | ||
this.trigger({ | ||
@@ -259,32 +1483,49 @@ qualityLevel: qualityLevel, | ||
}); | ||
cov_wzippijjz.s[24]++; | ||
return qualityLevel; | ||
}; | ||
/** | ||
* Removes a quality level from the list. | ||
* | ||
* @param {QualityLevel} remove QualityLevel to remove to the list. | ||
* @return {QualityLevel|null} the QualityLevel removed or null if nothing removed | ||
* @method removeQualityLevel | ||
*/ | ||
_proto.removeQualityLevel = function removeQualityLevel(qualityLevel) { | ||
cov_wzippijjz.f[2]++; | ||
var removed = (cov_wzippijjz.s[25]++, null); | ||
cov_wzippijjz.s[26]++; | ||
for (var i = 0, l = this.length; i < l; i++) { | ||
cov_wzippijjz.s[27]++; | ||
QualityLevelList.prototype.removeQualityLevel = function removeQualityLevel(qualityLevel) { | ||
var removed = null; | ||
for (var i = 0, l = this.length; i < l; i++) { | ||
if (this[i] === qualityLevel) { | ||
cov_wzippijjz.b[4][0]++; | ||
cov_wzippijjz.s[28]++; | ||
removed = this.levels_.splice(i, 1)[0]; | ||
cov_wzippijjz.s[29]++; | ||
if (this.selectedIndex_ === i) { | ||
cov_wzippijjz.b[5][0]++; | ||
cov_wzippijjz.s[30]++; | ||
this.selectedIndex_ = -1; | ||
} else if (this.selectedIndex_ > i) { | ||
this.selectedIndex_--; | ||
} else { | ||
cov_wzippijjz.b[5][1]++; | ||
cov_wzippijjz.s[31]++; | ||
if (this.selectedIndex_ > i) { | ||
cov_wzippijjz.b[6][0]++; | ||
cov_wzippijjz.s[32]++; | ||
this.selectedIndex_--; | ||
} else { | ||
cov_wzippijjz.b[6][1]++; | ||
} | ||
} | ||
cov_wzippijjz.s[33]++; | ||
break; | ||
} else { | ||
cov_wzippijjz.b[4][1]++; | ||
} | ||
} | ||
cov_wzippijjz.s[34]++; | ||
if (removed) { | ||
cov_wzippijjz.b[7][0]++; | ||
cov_wzippijjz.s[35]++; | ||
this.trigger({ | ||
@@ -294,36 +1535,36 @@ qualityLevel: qualityLevel, | ||
}); | ||
} else { | ||
cov_wzippijjz.b[7][1]++; | ||
} | ||
cov_wzippijjz.s[36]++; | ||
return removed; | ||
}; | ||
/** | ||
* Searches for a QualityLevel with the given id. | ||
* | ||
* @param {string} id The id of the QualityLevel to find. | ||
* @return {QualityLevel|null} The QualityLevel with id, or null if not found. | ||
* @method getQualityLevelById | ||
*/ | ||
_proto.getQualityLevelById = function getQualityLevelById(id) { | ||
cov_wzippijjz.f[3]++; | ||
cov_wzippijjz.s[37]++; | ||
QualityLevelList.prototype.getQualityLevelById = function getQualityLevelById(id) { | ||
for (var i = 0, l = this.length; i < l; i++) { | ||
var level = this[i]; | ||
var level = (cov_wzippijjz.s[38]++, this[i]); | ||
cov_wzippijjz.s[39]++; | ||
if (level.id === id) { | ||
cov_wzippijjz.b[8][0]++; | ||
cov_wzippijjz.s[40]++; | ||
return level; | ||
} else { | ||
cov_wzippijjz.b[8][1]++; | ||
} | ||
} | ||
cov_wzippijjz.s[41]++; | ||
return null; | ||
}; | ||
/** | ||
* Resets the list of QualityLevels to empty | ||
* | ||
* @method dispose | ||
*/ | ||
QualityLevelList.prototype.dispose = function dispose() { | ||
_proto.dispose = function dispose() { | ||
cov_wzippijjz.f[4]++; | ||
cov_wzippijjz.s[42]++; | ||
this.selectedIndex_ = -1; | ||
cov_wzippijjz.s[43]++; | ||
this.levels_.length = 0; | ||
@@ -335,9 +1576,3 @@ }; | ||
/** | ||
* change - The selected QualityLevel has changed. | ||
* addqualitylevel - A QualityLevel has been added to the QualityLevelList. | ||
* removequalitylevel - A QualityLevel has been removed from the QualityLevelList. | ||
*/ | ||
cov_wzippijjz.s[44]++; | ||
QualityLevelList.prototype.allowedEvents_ = { | ||
@@ -348,73 +1583,420 @@ change: 'change', | ||
}; | ||
cov_wzippijjz.s[45]++; | ||
// emulate attribute EventHandler support to allow for feature detection | ||
for (var event in QualityLevelList.prototype.allowedEvents_) { | ||
cov_wzippijjz.s[46]++; | ||
QualityLevelList.prototype['on' + event] = null; | ||
} | ||
// vjs 5/6 support | ||
var registerPlugin = videojs.registerPlugin || videojs.plugin; | ||
var version = "2.0.8"; | ||
/** | ||
* Initialization function for the qualityLevels plugin. Sets up the QualityLevelList and | ||
* event handlers. | ||
* | ||
* @param {Player} player Player object. | ||
* @param {Object} options Plugin options object. | ||
* @function initPlugin | ||
*/ | ||
var cov_vf8hjucyf = function () { | ||
var path = '/Users/bcasey/Projects/videojs-contrib-quality-levels/src/plugin.js', | ||
hash = '0c723bcbf2be74db2f7a4fca63d1d25b8025a2dc', | ||
Function = function () {}.constructor, | ||
global = new Function('return this')(), | ||
gcv = '__coverage__', | ||
coverageData = { | ||
path: '/Users/bcasey/Projects/videojs-contrib-quality-levels/src/plugin.js', | ||
statementMap: { | ||
'0': { | ||
start: { | ||
line: 6, | ||
column: 23 | ||
}, | ||
end: { | ||
line: 6, | ||
column: 63 | ||
} | ||
}, | ||
'1': { | ||
start: { | ||
line: 16, | ||
column: 19 | ||
}, | ||
end: { | ||
line: 33, | ||
column: 1 | ||
} | ||
}, | ||
'2': { | ||
start: { | ||
line: 17, | ||
column: 27 | ||
}, | ||
end: { | ||
line: 17, | ||
column: 47 | ||
} | ||
}, | ||
'3': { | ||
start: { | ||
line: 19, | ||
column: 27 | ||
}, | ||
end: { | ||
line: 19, | ||
column: 49 | ||
} | ||
}, | ||
'4': { | ||
start: { | ||
line: 21, | ||
column: 25 | ||
}, | ||
end: { | ||
line: 25, | ||
column: 3 | ||
} | ||
}, | ||
'5': { | ||
start: { | ||
line: 22, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 22, | ||
column: 31 | ||
} | ||
}, | ||
'6': { | ||
start: { | ||
line: 23, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 23, | ||
column: 44 | ||
} | ||
}, | ||
'7': { | ||
start: { | ||
line: 24, | ||
column: 4 | ||
}, | ||
end: { | ||
line: 24, | ||
column: 42 | ||
} | ||
}, | ||
'8': { | ||
start: { | ||
line: 27, | ||
column: 2 | ||
}, | ||
end: { | ||
line: 27, | ||
column: 39 | ||
} | ||
}, | ||
'9': { | ||
start: { | ||
line: 29, | ||
column: 2 | ||
}, | ||
end: { | ||
line: 29, | ||
column: 48 | ||
} | ||
}, | ||
'10': { | ||
start: { | ||
line: 29, | ||
column: 31 | ||
}, | ||
end: { | ||
line: 29, | ||
column: 47 | ||
} | ||
}, | ||
'11': { | ||
start: { | ||
line: 30, | ||
column: 2 | ||
}, | ||
end: { | ||
line: 30, | ||
column: 47 | ||
} | ||
}, | ||
'12': { | ||
start: { | ||
line: 32, | ||
column: 2 | ||
}, | ||
end: { | ||
line: 32, | ||
column: 26 | ||
} | ||
}, | ||
'13': { | ||
start: { | ||
line: 46, | ||
column: 22 | ||
}, | ||
end: { | ||
line: 48, | ||
column: 1 | ||
} | ||
}, | ||
'14': { | ||
start: { | ||
line: 47, | ||
column: 2 | ||
}, | ||
end: { | ||
line: 47, | ||
column: 61 | ||
} | ||
}, | ||
'15': { | ||
start: { | ||
line: 51, | ||
column: 0 | ||
}, | ||
end: { | ||
line: 51, | ||
column: 47 | ||
} | ||
}, | ||
'16': { | ||
start: { | ||
line: 54, | ||
column: 0 | ||
}, | ||
end: { | ||
line: 54, | ||
column: 32 | ||
} | ||
} | ||
}, | ||
fnMap: { | ||
'0': { | ||
name: '(anonymous_0)', | ||
decl: { | ||
start: { | ||
line: 16, | ||
column: 19 | ||
}, | ||
end: { | ||
line: 16, | ||
column: 20 | ||
} | ||
}, | ||
loc: { | ||
start: { | ||
line: 16, | ||
column: 45 | ||
}, | ||
end: { | ||
line: 33, | ||
column: 1 | ||
} | ||
}, | ||
line: 16 | ||
}, | ||
'1': { | ||
name: '(anonymous_1)', | ||
decl: { | ||
start: { | ||
line: 21, | ||
column: 25 | ||
}, | ||
end: { | ||
line: 21, | ||
column: 26 | ||
} | ||
}, | ||
loc: { | ||
start: { | ||
line: 21, | ||
column: 36 | ||
}, | ||
end: { | ||
line: 25, | ||
column: 3 | ||
} | ||
}, | ||
line: 21 | ||
}, | ||
'2': { | ||
name: '(anonymous_2)', | ||
decl: { | ||
start: { | ||
line: 29, | ||
column: 25 | ||
}, | ||
end: { | ||
line: 29, | ||
column: 26 | ||
} | ||
}, | ||
loc: { | ||
start: { | ||
line: 29, | ||
column: 31 | ||
}, | ||
end: { | ||
line: 29, | ||
column: 47 | ||
} | ||
}, | ||
line: 29 | ||
}, | ||
'3': { | ||
name: '(anonymous_3)', | ||
decl: { | ||
start: { | ||
line: 46, | ||
column: 22 | ||
}, | ||
end: { | ||
line: 46, | ||
column: 23 | ||
} | ||
}, | ||
loc: { | ||
start: { | ||
line: 46, | ||
column: 40 | ||
}, | ||
end: { | ||
line: 48, | ||
column: 1 | ||
} | ||
}, | ||
line: 46 | ||
} | ||
}, | ||
branchMap: { | ||
'0': { | ||
loc: { | ||
start: { | ||
line: 6, | ||
column: 23 | ||
}, | ||
end: { | ||
line: 6, | ||
column: 63 | ||
} | ||
}, | ||
type: 'binary-expr', | ||
locations: [{ | ||
start: { | ||
line: 6, | ||
column: 23 | ||
}, | ||
end: { | ||
line: 6, | ||
column: 45 | ||
} | ||
}, { | ||
start: { | ||
line: 6, | ||
column: 49 | ||
}, | ||
end: { | ||
line: 6, | ||
column: 63 | ||
} | ||
}], | ||
line: 6 | ||
} | ||
}, | ||
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 | ||
}, | ||
f: { | ||
'0': 0, | ||
'1': 0, | ||
'2': 0, | ||
'3': 0 | ||
}, | ||
b: { | ||
'0': [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; | ||
}(); | ||
var registerPlugin = (cov_vf8hjucyf.s[0]++, (cov_vf8hjucyf.b[0][0]++, videojs.registerPlugin) || (cov_vf8hjucyf.b[0][1]++, videojs.plugin)); | ||
cov_vf8hjucyf.s[1]++; | ||
var initPlugin = function initPlugin(player, options) { | ||
var originalPluginFn = player.qualityLevels; | ||
cov_vf8hjucyf.f[0]++; | ||
var originalPluginFn = (cov_vf8hjucyf.s[2]++, player.qualityLevels); | ||
var qualityLevelList = (cov_vf8hjucyf.s[3]++, new QualityLevelList()); | ||
cov_vf8hjucyf.s[4]++; | ||
var qualityLevelList = new QualityLevelList(); | ||
var disposeHandler = function disposeHandler() { | ||
cov_vf8hjucyf.f[1]++; | ||
cov_vf8hjucyf.s[5]++; | ||
qualityLevelList.dispose(); | ||
cov_vf8hjucyf.s[6]++; | ||
player.qualityLevels = originalPluginFn; | ||
cov_vf8hjucyf.s[7]++; | ||
player.off('dispose', disposeHandler); | ||
}; | ||
cov_vf8hjucyf.s[8]++; | ||
player.on('dispose', disposeHandler); | ||
cov_vf8hjucyf.s[9]++; | ||
player.qualityLevels = function () { | ||
cov_vf8hjucyf.f[2]++; | ||
cov_vf8hjucyf.s[10]++; | ||
return qualityLevelList; | ||
}; | ||
cov_vf8hjucyf.s[11]++; | ||
player.qualityLevels.VERSION = '__VERSION__'; | ||
cov_vf8hjucyf.s[12]++; | ||
return qualityLevelList; | ||
}; | ||
/** | ||
* A video.js plugin. | ||
* | ||
* In the plugin function, the value of `this` is a video.js `Player` | ||
* instance. You cannot rely on the player being in a "ready" state here, | ||
* depending on how the plugin is invoked. This may or may not be important | ||
* to you; if not, remove the wait for "ready"! | ||
* | ||
* @param {Object} options Plugin options object | ||
* @function qualityLevels | ||
*/ | ||
cov_vf8hjucyf.s[13]++; | ||
var qualityLevels = function qualityLevels(options) { | ||
cov_vf8hjucyf.f[3]++; | ||
cov_vf8hjucyf.s[14]++; | ||
return initPlugin(this, videojs.mergeOptions({}, options)); | ||
}; | ||
// Register the plugin with video.js. | ||
cov_vf8hjucyf.s[15]++; | ||
registerPlugin('qualityLevels', qualityLevels); | ||
cov_vf8hjucyf.s[16]++; | ||
qualityLevels.VERSION = version; | ||
// Include the version number. | ||
qualityLevels.VERSION = '__VERSION__'; | ||
var Player = videojs.getComponent('Player'); | ||
QUnit.test('the environment is sane', function (assert) { | ||
assert.strictEqual(_typeof(Array.isArray), 'function', 'es5 exists'); | ||
assert.strictEqual(typeof sinon === 'undefined' ? 'undefined' : _typeof(sinon), 'object', 'sinon exists'); | ||
assert.strictEqual(typeof videojs === 'undefined' ? 'undefined' : _typeof(videojs), 'function', 'videojs exists'); | ||
assert.strictEqual(typeof qualityLevels === 'undefined' ? 'undefined' : _typeof(qualityLevels), 'function', 'plugin is a function'); | ||
assert.strictEqual(typeof Array.isArray, 'function', 'es5 exists'); | ||
assert.strictEqual(typeof sinon, 'object', 'sinon exists'); | ||
assert.strictEqual(typeof videojs, 'function', 'videojs exists'); | ||
assert.strictEqual(typeof qualityLevels, 'function', 'plugin is a function'); | ||
}); | ||
QUnit.module('videojs-contrib-quality-levels', { | ||
beforeEach: function beforeEach() { | ||
// Mock the environment's timers because certain things - particularly | ||
@@ -425,3 +2007,2 @@ // player readiness - are asynchronous in video.js 5. This MUST come | ||
this.clock = sinon.useFakeTimers(); | ||
this.fixture = document_1.getElementById('qunit-fixture'); | ||
@@ -437,5 +2018,4 @@ this.video = document_1.createElement('video'); | ||
}); | ||
QUnit.test('registers itself with video.js', function (assert) { | ||
assert.strictEqual(_typeof(Player.prototype.qualityLevels), 'function', 'videojs-contrib-quality-levels plugin was registered'); | ||
assert.strictEqual(typeof Player.prototype.qualityLevels, 'function', 'videojs-contrib-quality-levels plugin was registered'); | ||
}); | ||
@@ -483,24 +2063,16 @@ | ||
}); | ||
QUnit.test('Properly adds QualityLevels to the QualityLevelList', function (assert) { | ||
var addCount = 0; | ||
this.qualityLevels.on('addqualitylevel', function (event) { | ||
addCount++; | ||
}); | ||
var expected0 = this.qualityLevels.addQualityLevel(this.levels[0]); | ||
assert.equal(this.qualityLevels.length, 1, 'added quality level'); | ||
assert.equal(addCount, 1, 'emmitted addqualitylevel event'); | ||
assert.strictEqual(this.qualityLevels[0], expected0, 'can access quality level with index'); | ||
var expected1 = this.qualityLevels.addQualityLevel(this.levels[1]); | ||
assert.equal(this.qualityLevels.length, 2, 'added quality level'); | ||
assert.equal(addCount, 2, 'emmitted addqualitylevel event'); | ||
assert.strictEqual(this.qualityLevels[1], expected1, 'can access quality level with index'); | ||
var expectedDuplicate = this.qualityLevels.addQualityLevel(this.levels[0]); | ||
assert.equal(this.qualityLevels.length, 2, 'does not add duplicate quality level'); | ||
@@ -513,3 +2085,2 @@ assert.equal(addCount, 2, 'no event emitted on dulicate'); | ||
}); | ||
QUnit.test('Properly removes QualityLevels from the QualityLevelList', function (assert) { | ||
@@ -520,18 +2091,12 @@ var _this = this; | ||
var expected = []; | ||
this.levels.forEach(function (qualityLevel) { | ||
expected.push(_this.qualityLevels.addQualityLevel(qualityLevel)); | ||
}); | ||
this.qualityLevels.on('removequalitylevel', function (event) { | ||
removeCount++; | ||
}); | ||
}); // Mock an initial selected quality level | ||
// Mock an initial selected quality level | ||
this.qualityLevels.selectedIndex_ = 2; | ||
assert.equal(this.qualityLevels.length, 4, '4 initial quality levels'); | ||
var removed = this.qualityLevels.removeQualityLevel(expected[3]); | ||
assert.equal(this.qualityLevels.length, 3, 'removed quality level'); | ||
@@ -541,5 +2106,3 @@ assert.equal(removeCount, 1, 'emitted removequalitylevel event'); | ||
assert.notStrictEqual(this.qualityLevels[3], expected[3], 'nothing at index'); | ||
removed = this.qualityLevels.removeQualityLevel(expected[1]); | ||
assert.equal(this.qualityLevels.length, 2, 'removed quality level'); | ||
@@ -550,11 +2113,7 @@ assert.equal(removeCount, 2, 'emitted removequalitylevel event'); | ||
assert.strictEqual(this.qualityLevels[this.qualityLevels.selectedIndex], expected[2], 'selected index properly adjusted on quality level removal'); | ||
removed = this.qualityLevels.removeQualityLevel(expected[3]); | ||
assert.equal(this.qualityLevels.length, 2, 'no quality level removed if not found'); | ||
assert.equal(removed, null, 'returned null when nothing removed'); | ||
assert.equal(removeCount, 2, 'no event emitted when quality level not found'); | ||
removed = this.qualityLevels.removeQualityLevel(expected[2]); | ||
assert.equal(this.qualityLevels.length, 1, 'quality level removed'); | ||
@@ -565,3 +2124,2 @@ assert.equal(removeCount, 3, 'emitted removequalitylevel event'); | ||
}); | ||
QUnit.test('can get quality level by id', function (assert) { | ||
@@ -571,7 +2129,5 @@ var _this2 = this; | ||
var expected = []; | ||
this.levels.forEach(function (qualityLevel) { | ||
expected.push(_this2.qualityLevels.addQualityLevel(qualityLevel)); | ||
}); | ||
assert.strictEqual(this.qualityLevels.getQualityLevelById('0'), expected[0], 'found quality level with id "0"'); | ||
@@ -578,0 +2134,0 @@ assert.strictEqual(this.qualityLevels.getQualityLevelById('1'), expected[1], 'found quality level with id "1"'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1168757
3956
20