videojs-contrib-quality-levels
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -9,2 +9,5 @@ CHANGELOG | ||
## 2.0.3 (2017-02-09) | ||
* chore: video.js 5/6 compatibility and travis update (#12) | ||
## 2.0.2 (2016-12-23) | ||
@@ -11,0 +14,0 @@ * Make global a dependency instead of devDependency |
/** | ||
* videojs-contrib-quality-levels | ||
* @version 2.0.2 | ||
* @copyright 2016 Brightcove, Inc. | ||
* @version 2.0.3 | ||
* @copyright 2017 Brightcove, Inc. | ||
* @license Apache-2.0 | ||
@@ -13,4 +13,2 @@ */ | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _video = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); | ||
@@ -22,2 +20,4 @@ | ||
var _document2 = _interopRequireDefault(_document); | ||
var _qualityLevel = require('./quality-level.js'); | ||
@@ -59,2 +59,4 @@ | ||
function QualityLevelList() { | ||
var _ret; | ||
_classCallCheck(this, QualityLevelList); | ||
@@ -64,8 +66,6 @@ | ||
_this.selectedIndex_ = -1; | ||
var list = _this; // eslint-disable-line | ||
if (_video2['default'].browser.IS_IE8) { | ||
list = _document.document.createElement('custom'); | ||
list = _document2['default'].createElement('custom'); | ||
for (var prop in QualityLevelList.prototype) { | ||
@@ -79,13 +79,31 @@ if (prop !== 'constructor') { | ||
list.levels_ = []; | ||
return _this; | ||
} | ||
list.selectedIndex_ = -1; | ||
/** | ||
* Get the index of the currently selected QualityLevel. | ||
* | ||
* @returns {number} The index of the selected QualityLevel. -1 if none selected. | ||
* @readonly | ||
*/ | ||
/** | ||
* Get the index of the currently selected QualityLevel. | ||
* | ||
* @returns {number} The index of the selected QualityLevel. -1 if none selected. | ||
* @readonly | ||
*/ | ||
Object.defineProperty(list, 'selectedIndex', { | ||
get: function get() { | ||
return list.selectedIndex_; | ||
} | ||
}); | ||
/** | ||
* Get the length of the list of QualityLevels. | ||
* | ||
* @returns {number} The length of the list. | ||
* @readonly | ||
*/ | ||
Object.defineProperty(list, 'length', { | ||
get: function get() { | ||
return list.levels_.length; | ||
} | ||
}); | ||
return _ret = list, _possibleConstructorReturn(_this, _ret); | ||
} | ||
/** | ||
@@ -103,2 +121,4 @@ * Adds a quality level to the list. | ||
*/ | ||
QualityLevelList.prototype.addQualityLevel = function addQualityLevel(representation) { | ||
@@ -201,22 +221,2 @@ var qualityLevel = this.getQualityLevelById(representation.id); | ||
_createClass(QualityLevelList, [{ | ||
key: 'selectedIndex', | ||
get: function get() { | ||
return this.selectedIndex_; | ||
} | ||
/** | ||
* Get the length of the list of QualityLevels. | ||
* | ||
* @returns {number} The length of the list. | ||
* @readonly | ||
*/ | ||
}, { | ||
key: 'length', | ||
get: function get() { | ||
return this.levels_.length; | ||
} | ||
}]); | ||
return QualityLevelList; | ||
@@ -246,8 +246,17 @@ }(_video2['default'].EventTarget); | ||
},{"./quality-level.js":2,"global/document":4}],2:[function(require,module,exports){ | ||
"use strict"; | ||
(function (global){ | ||
'use strict'; | ||
exports.__esModule = true; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _video = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); | ||
var _video2 = _interopRequireDefault(_video); | ||
var _document = require('global/document'); | ||
var _document2 = _interopRequireDefault(_document); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -269,39 +278,46 @@ | ||
*/ | ||
var QualityLevel = function () { | ||
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); | ||
/** | ||
* 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); | ||
this.id = representation.id; | ||
this.label = this.id; | ||
this.width = representation.width; | ||
this.height = representation.height; | ||
this.bitrate = representation.bandwidth; | ||
var level = this; // eslint-disable-line | ||
this.enabled_ = representation.enabled; | ||
if (_video2['default'].browser.IS_IE8) { | ||
level = _document2['default'].createElement('custom'); | ||
for (var prop in QualityLevel.prototype) { | ||
if (prop !== 'constructor') { | ||
level[prop] = QualityLevel.prototype[prop]; | ||
} | ||
} | ||
} | ||
/** | ||
* Get whether the QualityLevel is enabled. | ||
* | ||
* @returns {boolean} True if the QualityLevel is enabled. | ||
*/ | ||
level.id = representation.id; | ||
level.label = level.id; | ||
level.width = representation.width; | ||
level.height = representation.height; | ||
level.bitrate = representation.bandwidth; | ||
level.enabled_ = representation.enabled; | ||
_createClass(QualityLevel, [{ | ||
key: "enabled", | ||
Object.defineProperty(level, 'enabled', { | ||
/** | ||
* Get whether the QualityLevel is enabled. | ||
* | ||
* @returns {boolean} True if the QualityLevel is enabled. | ||
*/ | ||
get: function get() { | ||
return this.enabled_(); | ||
} | ||
return level.enabled_(); | ||
}, | ||
/** | ||
@@ -312,13 +328,13 @@ * Enable or disable the QualityLevel. | ||
*/ | ||
, | ||
set: function set(enable) { | ||
this.enabled_(enable); | ||
level.enabled_(enable); | ||
} | ||
}]); | ||
}); | ||
return QualityLevel; | ||
}(); | ||
return level; | ||
}; | ||
exports["default"] = QualityLevel; | ||
},{}],3:[function(require,module,exports){ | ||
exports['default'] = QualityLevel; | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{"global/document":4}],3:[function(require,module,exports){ | ||
@@ -360,2 +376,5 @@ },{}],4:[function(require,module,exports){ | ||
// vjs 5/6 support | ||
var registerPlugin = _video2['default'].registerPlugin || _video2['default'].plugin; | ||
/** | ||
@@ -385,3 +404,3 @@ * Initialization function for the qualityLevels plugin. Sets up the QualityLevelList and | ||
}; | ||
player.qualityLevels.VERSION = '2.0.2'; | ||
player.qualityLevels.VERSION = '2.0.3'; | ||
@@ -407,6 +426,6 @@ return qualityLevelList; | ||
// Register the plugin with video.js. | ||
_video2['default'].plugin('qualityLevels', qualityLevels); | ||
registerPlugin('qualityLevels', qualityLevels); | ||
// Include the version number. | ||
qualityLevels.VERSION = '2.0.2'; | ||
qualityLevels.VERSION = '2.0.3'; | ||
@@ -413,0 +432,0 @@ exports['default'] = qualityLevels; |
@@ -1,1 +0,1 @@ | ||
!function e(t,n,i){function o(l,u){if(!n[l]){if(!t[l]){var f="function"==typeof require&&require;if(!u&&f)return f(l,!0);if(r)return r(l,!0);var s=new Error("Cannot find module '"+l+"'");throw s.code="MODULE_NOT_FOUND",s}var d=n[l]={exports:{}};t[l][0].call(d.exports,function(e){var n=t[l][1][e];return o(n?n:e)},d,d.exports,e,t,n,i)}return n[l].exports}for(var r="function"==typeof require&&require,l=0;l<i.length;l++)o(i[l]);return o}({1:[function(e,t,n){(function(t){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(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}function l(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)}n.__esModule=!0;var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),f="undefined"!=typeof window?window.videojs:"undefined"!=typeof t?t.videojs:null,s=i(f),d=e(4),a=e(2),c=i(a),p=function(e){function t(){o(this,t);var n=r(this,e.call(this));n.selectedIndex_=-1;var i=n;if(s.default.browser.IS_IE8){i=d.document.createElement("custom");for(var l in t.prototype)"constructor"!==l&&(i[l]=t.prototype[l])}return i.levels_=[],n}return l(t,e),t.prototype.addQualityLevel=function(e){var t=this.getQualityLevelById(e.id);if(t)return t;var n=this.levels_.length;return t=new c.default(e),""+n in this||Object.defineProperty(this,n,{get:function(){return this.levels_[n]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t},t.prototype.removeQualityLevel=function(e){for(var t=null,n=0,i=this.length;n<i;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},t.prototype.getQualityLevelById=function(e){for(var t=0,n=this.length;t<n;t++){var i=this[t];if(i.id===e)return i}return null},t.prototype.dispose=function(){this.selectedIndex_=-1,this.levels_.length=0},u(t,[{key:"selectedIndex",get:function(){return this.selectedIndex_}},{key:"length",get:function(){return this.levels_.length}}]),t}(s.default.EventTarget);p.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(var y in p.prototype.allowedEvents_)p.prototype["on"+y]=null;n.default=p}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.__esModule=!0;var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=function(){function e(t){i(this,e),this.id=t.id,this.label=this.id,this.width=t.width,this.height=t.height,this.bitrate=t.bandwidth,this.enabled_=t.enabled}return o(e,[{key:"enabled",get:function(){return this.enabled_()},set:function(e){this.enabled_(e)}}]),e}();n.default=r},{}],3:[function(e,t,n){},{}],4:[function(e,t,n){(function(n){var i="undefined"!=typeof n?n:"undefined"!=typeof window?window:{},o=e(3);if("undefined"!=typeof document)t.exports=document;else{var r=i["__GLOBAL_DOCUMENT_CACHE@4"];r||(r=i["__GLOBAL_DOCUMENT_CACHE@4"]=o),t.exports=r}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(e,t,n){(function(t){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}n.__esModule=!0;var o="undefined"!=typeof window?window.videojs:"undefined"!=typeof t?t.videojs:null,r=i(o),l=e(1),u=i(l),f=function(e,t){var n=e.qualityLevels,i=new u.default,o=function t(){i.dispose(),e.qualityLevels=n,e.off("dispose",t)};return e.on("dispose",o),e.qualityLevels=function(){return i},e.qualityLevels.VERSION="2.0.2",i},s=function(e){return f(this,r.default.mergeOptions({},e))};r.default.plugin("qualityLevels",s),s.VERSION="2.0.2",n.default=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[5]); | ||
!function e(t,n,o){function i(r,u){if(!n[r]){if(!t[r]){var f="function"==typeof require&&require;if(!u&&f)return f(r,!0);if(l)return l(r,!0);var d=new Error("Cannot find module '"+r+"'");throw d.code="MODULE_NOT_FOUND",d}var s=n[r]={exports:{}};t[r][0].call(s.exports,function(e){var n=t[r][1][e];return i(n?n:e)},s,s.exports,e,t,n,o)}return n[r].exports}for(var l="function"==typeof require&&require,r=0;r<o.length;r++)i(o[r]);return i}({1:[function(e,t,n){(function(t){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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}function r(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)}n.__esModule=!0;var u="undefined"!=typeof window?window.videojs:"undefined"!=typeof t?t.videojs:null,f=o(u),d=e(4),s=o(d),a=e(2),c=o(a),p=function(e){function t(){var n;i(this,t);var o=l(this,e.call(this)),r=o;if(f["default"].browser.IS_IE8){r=s["default"].createElement("custom");for(var u in t.prototype)"constructor"!==u&&(r[u]=t.prototype[u])}return r.levels_=[],r.selectedIndex_=-1,Object.defineProperty(r,"selectedIndex",{get:function(){return r.selectedIndex_}}),Object.defineProperty(r,"length",{get:function(){return r.levels_.length}}),n=r,l(o,n)}return r(t,e),t.prototype.addQualityLevel=function(e){var t=this.getQualityLevelById(e.id);if(t)return t;var n=this.levels_.length;return t=new c["default"](e),""+n in this||Object.defineProperty(this,n,{get:function(){return this.levels_[n]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t},t.prototype.removeQualityLevel=function(e){for(var t=null,n=0,o=this.length;n<o;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},t.prototype.getQualityLevelById=function(e){for(var t=0,n=this.length;t<n;t++){var o=this[t];if(o.id===e)return o}return null},t.prototype.dispose=function(){this.selectedIndex_=-1,this.levels_.length=0},t}(f["default"].EventTarget);p.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(var y in p.prototype.allowedEvents_)p.prototype["on"+y]=null;n["default"]=p}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){(function(t){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.__esModule=!0;var l="undefined"!=typeof window?window.videojs:"undefined"!=typeof t?t.videojs:null,r=o(l),u=e(4),f=o(u),d=function s(e){i(this,s);var t=this;if(r["default"].browser.IS_IE8){t=f["default"].createElement("custom");for(var n in s.prototype)"constructor"!==n&&(t[n]=s.prototype[n])}return t.id=e.id,t.label=t.id,t.width=e.width,t.height=e.height,t.bitrate=e.bandwidth,t.enabled_=e.enabled,Object.defineProperty(t,"enabled",{get:function(){return t.enabled_()},set:function(e){t.enabled_(e)}}),t};n["default"]=d}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],3:[function(e,t,n){},{}],4:[function(e,t,n){(function(n){var o="undefined"!=typeof n?n:"undefined"!=typeof window?window:{},i=e(3);if("undefined"!=typeof document)t.exports=document;else{var l=o["__GLOBAL_DOCUMENT_CACHE@4"];l||(l=o["__GLOBAL_DOCUMENT_CACHE@4"]=i),t.exports=l}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(e,t,n){(function(t){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}n.__esModule=!0;var i="undefined"!=typeof window?window.videojs:"undefined"!=typeof t?t.videojs:null,l=o(i),r=e(1),u=o(r),f=l["default"].registerPlugin||l["default"].plugin,d=function(e,t){var n=e.qualityLevels,o=new u["default"],i=function l(){o.dispose(),e.qualityLevels=n,e.off("dispose",l)};return e.on("dispose",i),e.qualityLevels=function(){return o},e.qualityLevels.VERSION="2.0.3",o},s=function(e){return d(this,l["default"].mergeOptions({},e))};f("qualityLevels",s),s.VERSION="2.0.3",n["default"]=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[5]); |
@@ -15,2 +15,5 @@ 'use strict'; | ||
// vjs 5/6 support | ||
var registerPlugin = _video2['default'].registerPlugin || _video2['default'].plugin; | ||
/** | ||
@@ -61,3 +64,3 @@ * Initialization function for the qualityLevels plugin. Sets up the QualityLevelList and | ||
// Register the plugin with video.js. | ||
_video2['default'].plugin('qualityLevels', qualityLevels); | ||
registerPlugin('qualityLevels', qualityLevels); | ||
@@ -64,0 +67,0 @@ // Include the version number. |
@@ -5,4 +5,2 @@ 'use strict'; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _video = require('video.js'); | ||
@@ -14,2 +12,4 @@ | ||
var _document2 = _interopRequireDefault(_document); | ||
var _qualityLevel = require('./quality-level.js'); | ||
@@ -51,2 +51,4 @@ | ||
function QualityLevelList() { | ||
var _ret; | ||
_classCallCheck(this, QualityLevelList); | ||
@@ -56,8 +58,6 @@ | ||
_this.selectedIndex_ = -1; | ||
var list = _this; // eslint-disable-line | ||
if (_video2['default'].browser.IS_IE8) { | ||
list = _document.document.createElement('custom'); | ||
list = _document2['default'].createElement('custom'); | ||
for (var prop in QualityLevelList.prototype) { | ||
@@ -71,13 +71,31 @@ if (prop !== 'constructor') { | ||
list.levels_ = []; | ||
return _this; | ||
} | ||
list.selectedIndex_ = -1; | ||
/** | ||
* Get the index of the currently selected QualityLevel. | ||
* | ||
* @returns {number} The index of the selected QualityLevel. -1 if none selected. | ||
* @readonly | ||
*/ | ||
/** | ||
* Get the index of the currently selected QualityLevel. | ||
* | ||
* @returns {number} The index of the selected QualityLevel. -1 if none selected. | ||
* @readonly | ||
*/ | ||
Object.defineProperty(list, 'selectedIndex', { | ||
get: function get() { | ||
return list.selectedIndex_; | ||
} | ||
}); | ||
/** | ||
* Get the length of the list of QualityLevels. | ||
* | ||
* @returns {number} The length of the list. | ||
* @readonly | ||
*/ | ||
Object.defineProperty(list, 'length', { | ||
get: function get() { | ||
return list.levels_.length; | ||
} | ||
}); | ||
return _ret = list, _possibleConstructorReturn(_this, _ret); | ||
} | ||
/** | ||
@@ -95,2 +113,4 @@ * Adds a quality level to the list. | ||
*/ | ||
QualityLevelList.prototype.addQualityLevel = function addQualityLevel(representation) { | ||
@@ -193,22 +213,2 @@ var qualityLevel = this.getQualityLevelById(representation.id); | ||
_createClass(QualityLevelList, [{ | ||
key: 'selectedIndex', | ||
get: function get() { | ||
return this.selectedIndex_; | ||
} | ||
/** | ||
* Get the length of the list of QualityLevels. | ||
* | ||
* @returns {number} The length of the list. | ||
* @readonly | ||
*/ | ||
}, { | ||
key: 'length', | ||
get: function get() { | ||
return this.levels_.length; | ||
} | ||
}]); | ||
return QualityLevelList; | ||
@@ -215,0 +215,0 @@ }(_video2['default'].EventTarget); |
@@ -1,7 +0,15 @@ | ||
"use strict"; | ||
'use strict'; | ||
exports.__esModule = true; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _video = require('video.js'); | ||
var _video2 = _interopRequireDefault(_video); | ||
var _document = require('global/document'); | ||
var _document2 = _interopRequireDefault(_document); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -23,39 +31,46 @@ | ||
*/ | ||
var QualityLevel = function () { | ||
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); | ||
/** | ||
* 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); | ||
this.id = representation.id; | ||
this.label = this.id; | ||
this.width = representation.width; | ||
this.height = representation.height; | ||
this.bitrate = representation.bandwidth; | ||
var level = this; // eslint-disable-line | ||
this.enabled_ = representation.enabled; | ||
if (_video2['default'].browser.IS_IE8) { | ||
level = _document2['default'].createElement('custom'); | ||
for (var prop in QualityLevel.prototype) { | ||
if (prop !== 'constructor') { | ||
level[prop] = QualityLevel.prototype[prop]; | ||
} | ||
} | ||
} | ||
/** | ||
* Get whether the QualityLevel is enabled. | ||
* | ||
* @returns {boolean} True if the QualityLevel is enabled. | ||
*/ | ||
level.id = representation.id; | ||
level.label = level.id; | ||
level.width = representation.width; | ||
level.height = representation.height; | ||
level.bitrate = representation.bandwidth; | ||
level.enabled_ = representation.enabled; | ||
_createClass(QualityLevel, [{ | ||
key: "enabled", | ||
Object.defineProperty(level, 'enabled', { | ||
/** | ||
* Get whether the QualityLevel is enabled. | ||
* | ||
* @returns {boolean} True if the QualityLevel is enabled. | ||
*/ | ||
get: function get() { | ||
return this.enabled_(); | ||
} | ||
return level.enabled_(); | ||
}, | ||
/** | ||
@@ -66,11 +81,10 @@ * Enable or disable the QualityLevel. | ||
*/ | ||
, | ||
set: function set(enable) { | ||
this.enabled_(enable); | ||
level.enabled_(enable); | ||
} | ||
}]); | ||
}); | ||
return QualityLevel; | ||
}(); | ||
return level; | ||
}; | ||
exports["default"] = QualityLevel; | ||
exports['default'] = QualityLevel; |
{ | ||
"name": "videojs-contrib-quality-levels", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "Exposes a list of quality levels available for the source.", | ||
@@ -19,3 +19,3 @@ "main": "es5/plugin.js", | ||
"build:js:collapse": "bundle-collapser dist/videojs-contrib-quality-levels.js -o dist/videojs-contrib-quality-levels.min.js", | ||
"build:js:uglify": "uglifyjs dist/videojs-contrib-quality-levels.min.js --comments --mangle --compress -o dist/videojs-contrib-quality-levels.min.js", | ||
"build:js:uglify": "uglifyjs dist/videojs-contrib-quality-levels.min.js --support-ie8 --comments --mangle --compress -o dist/videojs-contrib-quality-levels.min.js", | ||
"build:test": "babel-node scripts/build-test.js", | ||
@@ -121,3 +121,3 @@ "change": "chg add", | ||
"uglify-js": "^2.6.1", | ||
"videojs-contrib-hls": "^3.6.7", | ||
"videojs-contrib-hls": "^4.1.0", | ||
"videojs-standard": "^4.0.0" | ||
@@ -124,0 +124,0 @@ }, |
import videojs from 'video.js'; | ||
import QualityLevelList from './quality-level-list.js'; | ||
// vjs 5/6 support | ||
const registerPlugin = videojs.registerPlugin || videojs.plugin; | ||
/** | ||
@@ -47,3 +50,3 @@ * Initialization function for the qualityLevels plugin. Sets up the QualityLevelList and | ||
// Register the plugin with video.js. | ||
videojs.plugin('qualityLevels', qualityLevels); | ||
registerPlugin('qualityLevels', qualityLevels); | ||
@@ -50,0 +53,0 @@ // Include the version number. |
import videojs from 'video.js'; | ||
import { document } from 'global/document'; | ||
import document from 'global/document'; | ||
import QualityLevel from './quality-level.js'; | ||
@@ -29,4 +29,2 @@ | ||
this.selectedIndex_ = -1; | ||
let list = this; // eslint-disable-line | ||
@@ -44,22 +42,29 @@ | ||
list.levels_ = []; | ||
} | ||
list.selectedIndex_ = -1; | ||
/** | ||
* Get the index of the currently selected QualityLevel. | ||
* | ||
* @returns {number} The index of the selected QualityLevel. -1 if none selected. | ||
* @readonly | ||
*/ | ||
get selectedIndex() { | ||
return this.selectedIndex_; | ||
} | ||
/** | ||
* Get the index of the currently selected QualityLevel. | ||
* | ||
* @returns {number} The index of the selected QualityLevel. -1 if none selected. | ||
* @readonly | ||
*/ | ||
Object.defineProperty(list, 'selectedIndex', { | ||
get() { | ||
return list.selectedIndex_; | ||
} | ||
}); | ||
/** | ||
* Get the length of the list of QualityLevels. | ||
* | ||
* @returns {number} The length of the list. | ||
* @readonly | ||
*/ | ||
get length() { | ||
return this.levels_.length; | ||
/** | ||
* Get the length of the list of QualityLevels. | ||
* | ||
* @returns {number} The length of the list. | ||
* @readonly | ||
*/ | ||
Object.defineProperty(list, 'length', { | ||
get() { | ||
return list.levels_.length; | ||
} | ||
}); | ||
return list; | ||
} | ||
@@ -66,0 +71,0 @@ |
@@ -0,1 +1,4 @@ | ||
import videojs from 'video.js'; | ||
import document from 'global/document'; | ||
/** | ||
@@ -28,28 +31,43 @@ * A single QualityLevel. | ||
constructor(representation) { | ||
this.id = representation.id; | ||
this.label = this.id; | ||
this.width = representation.width; | ||
this.height = representation.height; | ||
this.bitrate = representation.bandwidth; | ||
this.enabled_ = representation.enabled; | ||
} | ||
let level = this; // eslint-disable-line | ||
/** | ||
* Get whether the QualityLevel is enabled. | ||
* | ||
* @returns {boolean} True if the QualityLevel is enabled. | ||
*/ | ||
get enabled() { | ||
return this.enabled_(); | ||
} | ||
if (videojs.browser.IS_IE8) { | ||
level = document.createElement('custom'); | ||
for (const prop in QualityLevel.prototype) { | ||
if (prop !== 'constructor') { | ||
level[prop] = QualityLevel.prototype[prop]; | ||
} | ||
} | ||
} | ||
/** | ||
* Enable or disable the QualityLevel. | ||
* | ||
* @param {boolean} enable true to enable QualityLevel, false to disable. | ||
*/ | ||
set enabled(enable) { | ||
this.enabled_(enable); | ||
level.id = representation.id; | ||
level.label = level.id; | ||
level.width = representation.width; | ||
level.height = representation.height; | ||
level.bitrate = representation.bandwidth; | ||
level.enabled_ = representation.enabled; | ||
Object.defineProperty(level, 'enabled', { | ||
/** | ||
* Get whether the QualityLevel is enabled. | ||
* | ||
* @returns {boolean} True if the QualityLevel is enabled. | ||
*/ | ||
get() { | ||
return level.enabled_(); | ||
}, | ||
/** | ||
* Enable or disable the QualityLevel. | ||
* | ||
* @param {boolean} enable true to enable QualityLevel, false to disable. | ||
*/ | ||
set(enable) { | ||
level.enabled_(enable); | ||
} | ||
}); | ||
return level; | ||
} | ||
} |
@@ -38,2 +38,5 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
// vjs 5/6 support | ||
var registerPlugin = _video2['default'].registerPlugin || _video2['default'].plugin; | ||
/** | ||
@@ -63,3 +66,3 @@ * Initialization function for the qualityLevels plugin. Sets up the QualityLevelList and | ||
}; | ||
player.qualityLevels.VERSION = '2.0.2'; | ||
player.qualityLevels.VERSION = '2.0.3'; | ||
@@ -85,6 +88,6 @@ return qualityLevelList; | ||
// Register the plugin with video.js. | ||
_video2['default'].plugin('qualityLevels', qualityLevels); | ||
registerPlugin('qualityLevels', qualityLevels); | ||
// Include the version number. | ||
qualityLevels.VERSION = '2.0.2'; | ||
qualityLevels.VERSION = '2.0.3'; | ||
@@ -100,4 +103,2 @@ exports['default'] = qualityLevels; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _video = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); | ||
@@ -109,2 +110,4 @@ | ||
var _document2 = _interopRequireDefault(_document); | ||
var _qualityLevel = require('./quality-level.js'); | ||
@@ -146,2 +149,4 @@ | ||
function QualityLevelList() { | ||
var _ret; | ||
_classCallCheck(this, QualityLevelList); | ||
@@ -151,8 +156,6 @@ | ||
_this.selectedIndex_ = -1; | ||
var list = _this; // eslint-disable-line | ||
if (_video2['default'].browser.IS_IE8) { | ||
list = _document.document.createElement('custom'); | ||
list = _document2['default'].createElement('custom'); | ||
for (var prop in QualityLevelList.prototype) { | ||
@@ -166,13 +169,31 @@ if (prop !== 'constructor') { | ||
list.levels_ = []; | ||
return _this; | ||
} | ||
list.selectedIndex_ = -1; | ||
/** | ||
* Get the index of the currently selected QualityLevel. | ||
* | ||
* @returns {number} The index of the selected QualityLevel. -1 if none selected. | ||
* @readonly | ||
*/ | ||
/** | ||
* Get the index of the currently selected QualityLevel. | ||
* | ||
* @returns {number} The index of the selected QualityLevel. -1 if none selected. | ||
* @readonly | ||
*/ | ||
Object.defineProperty(list, 'selectedIndex', { | ||
get: function get() { | ||
return list.selectedIndex_; | ||
} | ||
}); | ||
/** | ||
* Get the length of the list of QualityLevels. | ||
* | ||
* @returns {number} The length of the list. | ||
* @readonly | ||
*/ | ||
Object.defineProperty(list, 'length', { | ||
get: function get() { | ||
return list.levels_.length; | ||
} | ||
}); | ||
return _ret = list, _possibleConstructorReturn(_this, _ret); | ||
} | ||
/** | ||
@@ -190,2 +211,4 @@ * Adds a quality level to the list. | ||
*/ | ||
QualityLevelList.prototype.addQualityLevel = function addQualityLevel(representation) { | ||
@@ -288,22 +311,2 @@ var qualityLevel = this.getQualityLevelById(representation.id); | ||
_createClass(QualityLevelList, [{ | ||
key: 'selectedIndex', | ||
get: function get() { | ||
return this.selectedIndex_; | ||
} | ||
/** | ||
* Get the length of the list of QualityLevels. | ||
* | ||
* @returns {number} The length of the list. | ||
* @readonly | ||
*/ | ||
}, { | ||
key: 'length', | ||
get: function get() { | ||
return this.levels_.length; | ||
} | ||
}]); | ||
return QualityLevelList; | ||
@@ -334,8 +337,17 @@ }(_video2['default'].EventTarget); | ||
},{"./quality-level.js":5,"global/document":2}],5:[function(require,module,exports){ | ||
"use strict"; | ||
(function (global){ | ||
'use strict'; | ||
exports.__esModule = true; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _video = (typeof window !== "undefined" ? window['videojs'] : typeof global !== "undefined" ? global['videojs'] : null); | ||
var _video2 = _interopRequireDefault(_video); | ||
var _document = require('global/document'); | ||
var _document2 = _interopRequireDefault(_document); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -357,39 +369,46 @@ | ||
*/ | ||
var QualityLevel = function () { | ||
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); | ||
/** | ||
* 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); | ||
this.id = representation.id; | ||
this.label = this.id; | ||
this.width = representation.width; | ||
this.height = representation.height; | ||
this.bitrate = representation.bandwidth; | ||
var level = this; // eslint-disable-line | ||
this.enabled_ = representation.enabled; | ||
if (_video2['default'].browser.IS_IE8) { | ||
level = _document2['default'].createElement('custom'); | ||
for (var prop in QualityLevel.prototype) { | ||
if (prop !== 'constructor') { | ||
level[prop] = QualityLevel.prototype[prop]; | ||
} | ||
} | ||
} | ||
/** | ||
* Get whether the QualityLevel is enabled. | ||
* | ||
* @returns {boolean} True if the QualityLevel is enabled. | ||
*/ | ||
level.id = representation.id; | ||
level.label = level.id; | ||
level.width = representation.width; | ||
level.height = representation.height; | ||
level.bitrate = representation.bandwidth; | ||
level.enabled_ = representation.enabled; | ||
_createClass(QualityLevel, [{ | ||
key: "enabled", | ||
Object.defineProperty(level, 'enabled', { | ||
/** | ||
* Get whether the QualityLevel is enabled. | ||
* | ||
* @returns {boolean} True if the QualityLevel is enabled. | ||
*/ | ||
get: function get() { | ||
return this.enabled_(); | ||
} | ||
return level.enabled_(); | ||
}, | ||
/** | ||
@@ -400,14 +419,14 @@ * Enable or disable the QualityLevel. | ||
*/ | ||
, | ||
set: function set(enable) { | ||
this.enabled_(enable); | ||
level.enabled_(enable); | ||
} | ||
}]); | ||
}); | ||
return QualityLevel; | ||
}(); | ||
return level; | ||
}; | ||
exports["default"] = QualityLevel; | ||
exports['default'] = QualityLevel; | ||
},{}],6:[function(require,module,exports){ | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{"global/document":2}],6:[function(require,module,exports){ | ||
(function (global){ | ||
@@ -470,3 +489,3 @@ 'use strict'; | ||
_qunit2['default'].test('registers itself with video.js', function (assert) { | ||
assert.strictEqual(Player.prototype.qualityLevels, _plugin2['default'], 'videojs-contrib-quality-levels plugin was registered'); | ||
assert.strictEqual(_typeof(Player.prototype.qualityLevels), 'function', 'videojs-contrib-quality-levels plugin was registered'); | ||
}); | ||
@@ -473,0 +492,0 @@ |
@@ -9,3 +9,3 @@ module.exports = function(config) { | ||
if (process.env.TRAVIS) { | ||
config.browsers = ['Firefox']; | ||
config.browsers = ['Firefox', 'travisChrome']; | ||
} | ||
@@ -30,3 +30,8 @@ | ||
], | ||
customLaunchers: { | ||
travisChrome: { | ||
base: 'Chrome', | ||
flags: ['--no-sandbox'] | ||
} | ||
}, | ||
detectBrowsers: detectBrowsers, | ||
@@ -33,0 +38,0 @@ reporters: ['dots'], |
@@ -40,6 +40,6 @@ import document from 'global/document'; | ||
assert.strictEqual( | ||
Player.prototype.qualityLevels, | ||
plugin, | ||
typeof Player.prototype.qualityLevels, | ||
'function', | ||
'videojs-contrib-quality-levels plugin was registered' | ||
); | ||
}); |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
88783
1837
3