diff --git a/bower.json b/bower.json index 8dda11a3f..e81e27e09 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "clappr", "description": "An extensible media player for the web", - "version": "0.2.66", + "version": "0.2.67", "homepage": "https://github.com/clappr/clappr", "authors": [ "Globo.com" @@ -21,22 +21,23 @@ ], "devDependencies": { "babel-core": "^6.18.2", - "babel-loader": "^6.4.1", + "babel-loader": "^7.0.0", "babel-plugin-add-module-exports": "^0.2.0", "babel-plugin-transform-es2015-classes": "^6.6.4", + "babel-plugin-transform-runtime": "^6.23.0", "babel-preset-es2015": "^6.5.0", "chai": "^3.2.0", "check-dependencies": "^1.0.1", "clappr-zepto": "0.0.7", "clean-webpack-plugin": "^0.1.14", - "coveralls": "^2.11.4", - "css-loader": "^0.28.0", + "coveralls": "^2.13.1", + "css-loader": "^0.28.1", "directory-named-webpack-plugin": "^2.1.0", "dotenv": "^4.0.0", "eslint": "^3.1.0", "file-loader": "^0.11.1", "gulp": "^3.8.1", - "hls.js": "^0.7.5", + "hls.js": "^0.7.9", "html-loader": "^0.4.3", "isparta": "^4.0.0", "istanbul": "^0.4.2", @@ -46,7 +47,7 @@ "karma": "^1.1.1", "karma-chai": "^0.1.0", "karma-chai-sinon": "^0.1.5", - "karma-chrome-launcher": "^2.0.0", + "karma-chrome-launcher": "^2.1.0", "karma-cli": "^1.0.0", "karma-coverage": "^1.1.1", "karma-firefox-launcher": "^1.0.0", @@ -54,29 +55,24 @@ "karma-sinon": "^1.0.4", "karma-sinon-chai": "^1.1.0", "karma-webpack": "^2.0.1", - "lodash.isequal": "^4.2.0", - "lodash.isplainobject": "^4.0.4", - "lodash.merge": "^4.4.0", - "lodash.once": "^4.0.0", "lodash.result": "^4.3.0", - "lodash.uniqby": "^4.3.0", "lolex": "^1.5.2", "mkdirp": "^0.5.1", - "mocha": "^3.1.2", + "mocha": "^3.3.0", "node-bourbon": "^4.2.8", "node-sass": "^4.3.0", "s3": "^4.1.1", "sass-loader": "^6.0.2", - "sinon": "^2.0.0", - "sinon-chai": "^2.8.0", + "sinon": "^2.2.0", + "sinon-chai": "^2.10.0", "sshpk": "^1.6.2", "svg-inline-loader": "^0.7.1", "sync-pkg": "^0.7.1", - "uglify-js": "^2.8.22", + "uglify-js": "^3.0.5", "url-loader": "^0.5.6", - "webpack": "^2.4.1", - "webpack-dev-server": "^2.4.2", - "yargs": "^7.1.0" + "webpack": "^2.5.0", + "webpack-dev-server": "^2.4.5", + "yargs": "^8.0.1" }, "keywords": [ "clappr" diff --git a/dist/clappr.js b/dist/clappr.js index eb23c192c..2ed069db3 100644 --- a/dist/clappr.js +++ b/dist/clappr.js @@ -73,7 +73,7 @@ return /******/ (function(modules) { // webpackBootstrap /******/ __webpack_require__.p = "<%=baseUrl%>/"; /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 47); +/******/ return __webpack_require__(__webpack_require__.s = 95); /******/ }) /************************************************************************/ /******/ ([ @@ -83,27 +83,143 @@ return /******/ (function(modules) { // webpackBootstrap "use strict"; +exports.__esModule = true; + +exports.default = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +}; + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; + +var _setPrototypeOf = __webpack_require__(130); + +var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf); + +var _create = __webpack_require__(71); + +var _create2 = _interopRequireDefault(_create); + +var _typeof2 = __webpack_require__(36); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = function (subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : (0, _typeof3.default)(superClass))); + } + + subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass; +}; + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; + +var _typeof2 = __webpack_require__(36); + +var _typeof3 = _interopRequireDefault(_typeof2); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = function (self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self; +}; + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; + +var _defineProperty = __webpack_require__(72); + +var _defineProperty2 = _interopRequireDefault(_defineProperty); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = 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; + (0, _defineProperty2.default)(target, descriptor.key, descriptor); + } + } + + return function (Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + Object.defineProperty(exports, "__esModule", { value: true }); -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; }; // Copyright 2014 Globo.com Player authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. +var _keys = __webpack_require__(35); -var _log = __webpack_require__(19); +var _keys2 = _interopRequireDefault(_keys); -var _log2 = _interopRequireDefault(_log); +var _classCallCheck2 = __webpack_require__(0); -var _utils = __webpack_require__(1); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); -var _lodash = __webpack_require__(106); +var _typeof2 = __webpack_require__(36); -var _lodash2 = _interopRequireDefault(_lodash); +var _typeof3 = _interopRequireDefault(_typeof2); + +var _log = __webpack_require__(40); + +var _log2 = _interopRequireDefault(_log); + +var _utils = __webpack_require__(5); 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"); } } +// Copyright 2014 Globo.com Player authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. var slice = Array.prototype.slice; @@ -115,7 +231,7 @@ var eventsApi = function eventsApi(obj, action, name, rest) { } // Handle event maps. - if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') { + if ((typeof name === 'undefined' ? 'undefined' : (0, _typeof3.default)(name)) === 'object') { for (var key in name) { obj[action].apply(obj, [key, name[key]].concat(rest)); } @@ -182,7 +298,7 @@ var triggerEvents = function triggerEvents(events, args, klass, name) { var Events = function () { function Events() { - _classCallCheck(this, Events); + (0, _classCallCheck3.default)(this, Events); } /** @@ -212,14 +328,16 @@ var Events = function () { Events.prototype.once = function once(name, callback, context) { + var _this = this, + _arguments = arguments; + if (!eventsApi(this, 'once', name, [callback, context]) || !callback) { return this; } - var self = this; - var once = (0, _lodash2.default)(function () { - self.off(name, once); - callback.apply(this, arguments); - }); + var once = function once() { + _this.off(name, once); + callback.apply(context || _this, _arguments); + }; once._callback = callback; return this.on(name, once, context); }; @@ -249,7 +367,7 @@ var Events = function () { this._events = void 0; return this; } - names = name ? [name] : Object.keys(this._events); + names = name ? [name] : (0, _keys2.default)(this._events); // jshint maxdepth:5 for (i = 0, l = names.length; i < l; i++) { name = names[i]; @@ -315,7 +433,7 @@ var Events = function () { return this; } var remove = !name && !callback; - if (!callback && (typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') { + if (!callback && (typeof name === 'undefined' ? 'undefined' : (0, _typeof3.default)(name)) === 'object') { callback = this; } if (obj) { @@ -324,7 +442,7 @@ var Events = function () { for (var id in listeningTo) { obj = listeningTo[id]; obj.off(name, callback, this); - if (remove || Object.keys(obj._events).length === 0) { + if (remove || (0, _keys2.default)(obj._events).length === 0) { delete this._listeningTo[id]; } } @@ -363,12 +481,12 @@ var Events = function () { exports.default = Events; var listenMethods = { listenTo: 'on', listenToOnce: 'once' }; -Object.keys(listenMethods).forEach(function (method) { +(0, _keys2.default)(listenMethods).forEach(function (method) { Events.prototype[method] = function (obj, name, callback) { var listeningTo = this._listeningTo || (this._listeningTo = {}); var id = obj._listenId || (obj._listenId = (0, _utils.uniqueId)('l')); listeningTo[id] = obj; - if (!callback && (typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') { + if (!callback && (typeof name === 'undefined' ? 'undefined' : (0, _typeof3.default)(name)) === 'object') { callback = this; } obj[listenMethods[method]](name, callback, this); @@ -455,6 +573,9 @@ Events.PLAYER_TIMEUPDATE = 'timeupdate'; */ Events.PLAYER_VOLUMEUPDATE = 'volumeupdate'; +// TODO doc +Events.PLAYER_TEXTTRACKLOADED = 'texttrackloaded'; + // Playback Events /** * Fired when the playback is downloading the media @@ -648,7 +769,16 @@ Events.PLAYBACK_STATS_ADD = 'playback:stats:add'; Events.PLAYBACK_FRAGMENT_LOADED = 'playback:fragment:loaded'; // TODO doc Events.PLAYBACK_LEVEL_SWITCH = 'playback:level:switch'; +// TODO doc +Events.PLAYBACK_SUBTITLE_LOADED = 'playback:subtitle:loaded'; +// Core Events +/** + * Fired when the containers are created + * + * @event CORE_CONTAINERS_CREATED + */ +Events.CORE_CONTAINERS_CREATED = 'core:containers:created'; /** * Fired when the options were changed for the core * @@ -664,10 +794,23 @@ Events.CORE_READY = 'core:ready'; /** * Fired when the fullscreen state change * + * @event CORE_FULLSCREEN * @param {Boolean} whether or not the player is on fullscreen mode - * @event CORE_READY */ Events.CORE_FULLSCREEN = 'core:fullscreen'; +/** + * Fired when the screen orientation has changed. + * This event is trigger only for mobile devices. + * + * @event CORE_SCREEN_ORIENTATION_CHANGED + * @param {Object} screen An object with screen orientation + * screen object + * @param {Object} [screen.event] + * window resize event object + * @param {String} [screen.orientation] + * screen orientation (ie: 'landscape' or 'portrait') + */ +Events.CORE_SCREEN_ORIENTATION_CHANGED = 'core:screen:orientation:changed'; // Container Events /** @@ -718,6 +861,14 @@ Events.CONTAINER_ERROR = 'container:error'; * extra meta data */ Events.CONTAINER_LOADEDMETADATA = 'container:loadedmetadata'; + +/** + * Fired when a text track is loaded and available on container for display + * + * @event CONTAINER_LOADEDTEXTTRACK + */ +Events.CONTAINER_LOADEDTEXTTRACK = 'container:loadedtexttrack'; + /** * Fired when the time is updated on container * @@ -866,13 +1017,10 @@ Events.MEDIACONTROL_NOTPLAYING = 'mediacontrol:notplaying'; * @event MEDIACONTROL_CONTAINERCHANGED */ Events.MEDIACONTROL_CONTAINERCHANGED = 'mediacontrol:containerchanged'; - -// Core Events -Events.CORE_CONTAINERS_CREATED = 'core:containers:created'; module.exports = exports['default']; /***/ }), -/* 1 */ +/* 5 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -883,7 +1031,29 @@ Object.defineProperty(exports, "__esModule", { }); exports.DomRecycler = exports.cancelAnimationFrame = exports.requestAnimationFrame = exports.QueryString = exports.Config = exports.Fullscreen = undefined; -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 _createClass2 = __webpack_require__(3); + +var _createClass3 = _interopRequireDefault(_createClass2); + +var _classCallCheck2 = __webpack_require__(0); + +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + +var _possibleConstructorReturn2 = __webpack_require__(2); + +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + +var _inherits2 = __webpack_require__(1); + +var _inherits3 = _interopRequireDefault(_inherits2); + +var _defineProperty = __webpack_require__(72); + +var _defineProperty2 = _interopRequireDefault(_defineProperty); + +var _getOwnPropertyDescriptor = __webpack_require__(129); + +var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor); exports.extend = extend; exports.formatTime = formatTime; @@ -895,21 +1065,17 @@ exports.getBrowserLanguage = getBrowserLanguage; exports.now = now; exports.removeArrayItem = removeArrayItem; -var _browser = __webpack_require__(7); +var _browser = __webpack_require__(13); var _browser2 = _interopRequireDefault(_browser); -var _clapprZepto = __webpack_require__(3); +var _clapprZepto = __webpack_require__(6); var _clapprZepto2 = _interopRequireDefault(_clapprZepto); 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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(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; } // Copyright 2014 Globo.com Player authors. All rights reserved. +// Copyright 2014 Globo.com Player authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. /*jshint -W079 */ @@ -917,8 +1083,8 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" function assign(obj, source) { if (source) { for (var prop in source) { - var propDescriptor = Object.getOwnPropertyDescriptor(source, prop); - propDescriptor ? Object.defineProperty(obj, prop, propDescriptor) : obj[prop] = source[prop]; + var propDescriptor = (0, _getOwnPropertyDescriptor2.default)(source, prop); + propDescriptor ? (0, _defineProperty2.default)(obj, prop, propDescriptor) : obj[prop] = source[prop]; } } return obj; @@ -926,16 +1092,16 @@ function assign(obj, source) { function extend(parent, properties) { var Surrogate = function (_parent) { - _inherits(Surrogate, _parent); + (0, _inherits3.default)(Surrogate, _parent); function Surrogate() { - _classCallCheck(this, Surrogate); + (0, _classCallCheck3.default)(this, Surrogate); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } - var _this = _possibleConstructorReturn(this, _parent.call.apply(_parent, [this].concat(args))); + var _this = (0, _possibleConstructorReturn3.default)(this, _parent.call.apply(_parent, [this].concat(args))); if (properties.initialize) { properties.initialize.apply(_this, args); @@ -992,19 +1158,23 @@ var Fullscreen = exports.Fullscreen = { el.msRequestFullscreen(); } else if (el.querySelector && el.querySelector('video') && el.querySelector('video').webkitEnterFullScreen) { el.querySelector('video').webkitEnterFullScreen(); + } else if (el.webkitEnterFullScreen) { + el.webkitEnterFullScreen(); } }, cancelFullscreen: function cancelFullscreen() { - if (document.exitFullscreen) { - document.exitFullscreen(); - } else if (document.webkitCancelFullScreen) { - document.webkitCancelFullScreen(); - } else if (document.webkitExitFullscreen) { - document.webkitExitFullscreen(); - } else if (document.mozCancelFullScreen) { - document.mozCancelFullScreen(); - } else if (document.msExitFullscreen) { - document.msExitFullscreen(); + var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; + + if (el.exitFullscreen) { + el.exitFullscreen(); + } else if (el.webkitCancelFullScreen) { + el.webkitCancelFullScreen(); + } else if (el.webkitExitFullscreen) { + el.webkitExitFullscreen(); + } else if (el.mozCancelFullScreen) { + el.mozCancelFullScreen(); + } else if (el.msExitFullscreen) { + el.msExitFullscreen(); } }, fullscreenEnabled: function fullscreenEnabled() { @@ -1014,7 +1184,7 @@ var Fullscreen = exports.Fullscreen = { var Config = exports.Config = function () { function Config() { - _classCallCheck(this, Config); + (0, _classCallCheck3.default)(this, Config); } Config._defaultConfig = function _defaultConfig() { @@ -1061,7 +1231,7 @@ var Config = exports.Config = function () { var QueryString = exports.QueryString = function () { function QueryString() { - _classCallCheck(this, QueryString); + (0, _classCallCheck3.default)(this, QueryString); } QueryString.parse = function parse(paramsString) { @@ -1080,7 +1250,7 @@ var QueryString = exports.QueryString = function () { return params; }; - _createClass(QueryString, null, [{ + (0, _createClass3.default)(QueryString, null, [{ key: 'params', get: function get() { var query = window.location.search.substring(1); @@ -1101,7 +1271,6 @@ var QueryString = exports.QueryString = function () { return this._hashParams; } }]); - return QueryString; }(); @@ -1175,7 +1344,7 @@ var videoStack = []; var DomRecycler = exports.DomRecycler = function () { function DomRecycler() { - _classCallCheck(this, DomRecycler); + (0, _classCallCheck3.default)(this, DomRecycler); } DomRecycler.configure = function configure(options) { @@ -1220,787 +1389,469 @@ exports.default = { }; /***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +/* 6 */ +/***/ (function(module, exports) { +/* Zepto v1.2.0 - zepto ajax callbacks deferred event ie selector - zeptojs.com/license */ -Object.defineProperty(exports, "__esModule", { - value: 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 Zepto = (function() { + var undefined, key, $, classList, emptyArray = [], concat = emptyArray.concat, filter = emptyArray.filter, slice = emptyArray.slice, + document = window.document, + elementDisplay = {}, classCache = {}, + cssNumber = { 'column-count': 1, 'columns': 1, 'font-weight': 1, 'line-height': 1,'opacity': 1, 'z-index': 1, 'zoom': 1 }, + fragmentRE = /^\s*<(\w+|!)[^>]*>/, + singleTagRE = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, + tagExpanderRE = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, + rootNodeRE = /^(?:body|html)$/i, + capitalRE = /([A-Z])/g, -var _utils = __webpack_require__(1); + // special attributes that should be get/set via method calls + methodAttributes = ['val', 'css', 'html', 'text', 'data', 'width', 'height', 'offset'], -var _ui_object = __webpack_require__(9); + adjacencyOperators = [ 'after', 'prepend', 'before', 'append' ], + table = document.createElement('table'), + tableRow = document.createElement('tr'), + containers = { + 'tr': document.createElement('tbody'), + 'tbody': table, 'thead': table, 'tfoot': table, + 'td': tableRow, 'th': tableRow, + '*': document.createElement('div') + }, + readyRE = /complete|loaded|interactive/, + simpleSelectorRE = /^[\w-]*$/, + class2type = {}, + toString = class2type.toString, + zepto = {}, + camelize, uniq, + tempParent = document.createElement('div'), + propMap = { + 'tabindex': 'tabIndex', + 'readonly': 'readOnly', + 'for': 'htmlFor', + 'class': 'className', + 'maxlength': 'maxLength', + 'cellspacing': 'cellSpacing', + 'cellpadding': 'cellPadding', + 'rowspan': 'rowSpan', + 'colspan': 'colSpan', + 'usemap': 'useMap', + 'frameborder': 'frameBorder', + 'contenteditable': 'contentEditable' + }, + isArray = Array.isArray || + function(object){ return object instanceof Array } -var _ui_object2 = _interopRequireDefault(_ui_object); + zepto.matches = function(element, selector) { + if (!selector || !element || element.nodeType !== 1) return false + var matchesSelector = element.matches || element.webkitMatchesSelector || + element.mozMatchesSelector || element.oMatchesSelector || + element.matchesSelector + if (matchesSelector) return matchesSelector.call(element, selector) + // fall back to performing a selector: + var match, parent = element.parentNode, temp = !parent + if (temp) (parent = tempParent).appendChild(element) + match = ~zepto.qsa(parent, selector).indexOf(element) + temp && tempParent.removeChild(element) + return match + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + function type(obj) { + return obj == null ? String(obj) : + class2type[toString.call(obj)] || "object" + } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + function isFunction(value) { return type(value) == "function" } + function isWindow(obj) { return obj != null && obj == obj.window } + function isDocument(obj) { return obj != null && obj.nodeType == obj.DOCUMENT_NODE } + function isObject(obj) { return type(obj) == "object" } + function isPlainObject(obj) { + return isObject(obj) && !isWindow(obj) && Object.getPrototypeOf(obj) == Object.prototype + } -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + function likeArray(obj) { + var length = !!obj && 'length' in obj && obj.length, + type = $.type(obj) -function _inherits(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; } + return 'function' != type && !isWindow(obj) && ( + 'array' == type || length === 0 || + (typeof length == 'number' && length > 0 && (length - 1) in obj) + ) + } -/** - * An abstraction to represent a generic playback, it's like an interface to be implemented by subclasses. - * @class Playback - * @constructor - * @extends UIObject - * @module base - */ -var Playback = function (_UIObject) { - _inherits(Playback, _UIObject); + function compact(array) { return filter.call(array, function(item){ return item != null }) } + function flatten(array) { return array.length > 0 ? $.fn.concat.apply([], array) : array } + camelize = function(str){ return str.replace(/-+(.)?/g, function(match, chr){ return chr ? chr.toUpperCase() : '' }) } + function dasherize(str) { + return str.replace(/::/g, '/') + .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2') + .replace(/([a-z\d])([A-Z])/g, '$1_$2') + .replace(/_/g, '-') + .toLowerCase() + } + uniq = function(array){ return filter.call(array, function(item, idx){ return array.indexOf(item) == idx }) } - _createClass(Playback, [{ - key: 'isAudioOnly', + function classRE(name) { + return name in classCache ? + classCache[name] : (classCache[name] = new RegExp('(^|\\s)' + name + '(\\s|$)')) + } - /** - * Determine if the playback does not contain video/has video but video should be ignored. - * @property isAudioOnly - * @type Boolean - */ - get: function get() { - return false; - } + function maybeAddPx(name, value) { + return (typeof value == "number" && !cssNumber[dasherize(name)]) ? value + "px" : value + } - /** - * Determine if the playback has ended. - * @property ended - * @type Boolean - */ - - }, { - key: 'ended', - get: function get() { - return false; - } - - /** - * The internationalization plugin. - * @property i18n - * @type {Strings} - */ - - }, { - key: 'i18n', - get: function get() { - return this._i18n; - } - - /** - * Determine if the playback is having to buffer in order for - * playback to be smooth. - * (i.e if a live stream is playing smoothly, this will be false) - * @property buffering - * @type Boolean - */ - - }, { - key: 'buffering', - get: function get() { - return false; + function defaultDisplay(nodeName) { + var element, display + if (!elementDisplay[nodeName]) { + element = document.createElement(nodeName) + document.body.appendChild(element) + display = getComputedStyle(element, '').getPropertyValue("display") + element.parentNode.removeChild(element) + display == "none" && (display = "block") + elementDisplay[nodeName] = display } + return elementDisplay[nodeName] + } - /** - * @method constructor - * @param {Object} options the options object - * @param {Strings} i18n the internationalization component - */ - - }]); - - function Playback(options, i18n) { - _classCallCheck(this, Playback); - - var _this = _possibleConstructorReturn(this, _UIObject.call(this, options)); + function children(element) { + return 'children' in element ? + slice.call(element.children) : + $.map(element.childNodes, function(node){ if (node.nodeType == 1) return node }) + } - _this.settings = {}; - _this._i18n = i18n; - return _this; + function Z(dom, selector) { + var i, len = dom ? dom.length : 0 + for (i = 0; i < len; i++) this[i] = dom[i] + this.length = len + this.selector = selector || '' } - /** - * Gives user consent to playback (mobile devices). - * @method consent - */ + // `$.zepto.fragment` takes a html string and an optional tag name + // to generate DOM nodes from the given html string. + // The generated DOM nodes are returned as an array. + // This function can be overridden in plugins for example to make + // it compatible with browsers that don't support the DOM fully. + zepto.fragment = function(html, name, properties) { + var dom, nodes, container + // A special case optimization for a single tag + if (singleTagRE.test(html)) dom = $(document.createElement(RegExp.$1)) - Playback.prototype.consent = function consent() {}; + if (!dom) { + if (html.replace) html = html.replace(tagExpanderRE, "<$1>") + if (name === undefined) name = fragmentRE.test(html) && RegExp.$1 + if (!(name in containers)) name = '*' - /** - * plays the playback. - * @method play - */ + container = containers[name] + container.innerHTML = '' + html + dom = $.each(slice.call(container.childNodes), function(){ + container.removeChild(this) + }) + } + if (isPlainObject(properties)) { + nodes = $(dom) + $.each(properties, function(key, value) { + if (methodAttributes.indexOf(key) > -1) nodes[key](value) + else nodes.attr(key, value) + }) + } - Playback.prototype.play = function play() {}; + return dom + } - /** - * pauses the playback. - * @method pause - */ + // `$.zepto.Z` swaps out the prototype of the given `dom` array + // of nodes with `$.fn` and thus supplying all the Zepto functions + // to the array. This method can be overridden in plugins. + zepto.Z = function(dom, selector) { + return new Z(dom, selector) + } + // `$.zepto.isZ` should return `true` if the given object is a Zepto + // collection. This method can be overridden in plugins. + zepto.isZ = function(object) { + return object instanceof zepto.Z + } - Playback.prototype.pause = function pause() {}; + // `$.zepto.init` is Zepto's counterpart to jQuery's `$.fn.init` and + // takes a CSS selector and an optional context (and handles various + // special cases). + // This method can be overridden in plugins. + zepto.init = function(selector, context) { + var dom + // If nothing given, return an empty Zepto collection + if (!selector) return zepto.Z() + // Optimize for string selectors + else if (typeof selector == 'string') { + selector = selector.trim() + // If it's a html fragment, create nodes from it + // Note: In both Chrome 21 and Firefox 15, DOM error 12 + // is thrown if the fragment doesn't begin with < + if (selector[0] == '<' && fragmentRE.test(selector)) + dom = zepto.fragment(selector, RegExp.$1, context), selector = null + // If there's a context, create a collection on that context first, and select + // nodes from there + else if (context !== undefined) return $(context).find(selector) + // If it's a CSS selector, use it to select nodes. + else dom = zepto.qsa(document, selector) + } + // If a function is given, call it when the DOM is ready + else if (isFunction(selector)) return $(document).ready(selector) + // If a Zepto collection is given, just return it + else if (zepto.isZ(selector)) return selector + else { + // normalize array if an array of nodes is given + if (isArray(selector)) dom = compact(selector) + // Wrap DOM nodes. + else if (isObject(selector)) + dom = [selector], selector = null + // If it's a html fragment, create nodes from it + else if (fragmentRE.test(selector)) + dom = zepto.fragment(selector.trim(), RegExp.$1, context), selector = null + // If there's a context, create a collection on that context first, and select + // nodes from there + else if (context !== undefined) return $(context).find(selector) + // And last but no least, if it's a CSS selector, use it to select nodes. + else dom = zepto.qsa(document, selector) + } + // create a new Zepto collection from the nodes found + return zepto.Z(dom, selector) + } - /** - * stops the playback. - * @method stop - */ + // `$` will be the base `Zepto` object. When calling this + // function just call `$.zepto.init, which makes the implementation + // details of selecting nodes and creating Zepto collections + // patchable in plugins. + $ = function(selector, context){ + return zepto.init(selector, context) + } + function extend(target, source, deep) { + for (key in source) + if (deep && (isPlainObject(source[key]) || isArray(source[key]))) { + if (isPlainObject(source[key]) && !isPlainObject(target[key])) + target[key] = {} + if (isArray(source[key]) && !isArray(target[key])) + target[key] = [] + extend(target[key], source[key], deep) + } + else if (source[key] !== undefined) target[key] = source[key] + } - Playback.prototype.stop = function stop() {}; + // Copy all but undefined properties from one or more + // objects to the `target` object. + $.extend = function(target){ + var deep, args = slice.call(arguments, 1) + if (typeof target == 'boolean') { + deep = target + target = args.shift() + } + args.forEach(function(arg){ extend(target, arg, deep) }) + return target + } - /** - * seeks the playback to a given `time` in seconds - * @method seek - * @param {Number} time should be a number between 0 and the video duration - */ + // `$.zepto.qsa` is Zepto's CSS selector implementation which + // uses `document.querySelectorAll` and optimizes for some special cases, like `#id`. + // This method can be overridden in plugins. + zepto.qsa = function(element, selector){ + var found, + maybeID = selector[0] == '#', + maybeClass = !maybeID && selector[0] == '.', + nameOnly = maybeID || maybeClass ? selector.slice(1) : selector, // Ensure that a 1 char tag name still gets checked + isSimple = simpleSelectorRE.test(nameOnly) + return (element.getElementById && isSimple && maybeID) ? // Safari DocumentFragment doesn't have getElementById + ( (found = element.getElementById(nameOnly)) ? [found] : [] ) : + (element.nodeType !== 1 && element.nodeType !== 9 && element.nodeType !== 11) ? [] : + slice.call( + isSimple && !maybeID && element.getElementsByClassName ? // DocumentFragment doesn't have getElementsByClassName/TagName + maybeClass ? element.getElementsByClassName(nameOnly) : // If it's simple, it could be a class + element.getElementsByTagName(selector) : // Or a tag + element.querySelectorAll(selector) // Or it's not simple, and we need to query all + ) + } + function filtered(nodes, selector) { + return selector == null ? $(nodes) : $(nodes).filter(selector) + } - Playback.prototype.seek = function seek(time) {}; // eslint-disable-line no-unused-vars + $.contains = document.documentElement.contains ? + function(parent, node) { + return parent !== node && parent.contains(node) + } : + function(parent, node) { + while (node && (node = node.parentNode)) + if (node === parent) return true + return false + } - /** - * seeks the playback to a given `percentage` in percentage - * @method seekPercentage - * @param {Number} time should be a number between 0 and 100 - */ + function funcArg(context, arg, idx, payload) { + return isFunction(arg) ? arg.call(context, idx, payload) : arg + } + function setAttribute(node, name, value) { + value == null ? node.removeAttribute(name) : node.setAttribute(name, value) + } - Playback.prototype.seekPercentage = function seekPercentage(percentage) {}; // eslint-disable-line no-unused-vars + // access className property while respecting SVGAnimatedString + function className(node, value){ + var klass = node.className || '', + svg = klass && klass.baseVal !== undefined + if (value === undefined) return svg ? klass.baseVal : klass + svg ? (klass.baseVal = value) : (node.className = value) + } - /** - * The time that "0" now represents relative to when playback started. - * For a stream with a sliding window this will increase as content is - * removed from the beginning. - * @method getStartTimeOffset - * @return {Number} time (in seconds) that time "0" represents. - */ - - - Playback.prototype.getStartTimeOffset = function getStartTimeOffset() { - return 0; - }; - - /** - * gets the duration in seconds - * @method getDuration - * @return {Number} duration (in seconds) of the current source - */ - - - Playback.prototype.getDuration = function getDuration() { - return 0; - }; - - /** - * checks if the playback is playing. - * @method isPlaying - * @return {Boolean} `true` if the current playback is playing, otherwise `false` - */ - - - Playback.prototype.isPlaying = function isPlaying() { - return false; - }; - - /** - * checks if the playback is ready. - * @property isReady - * @type {Boolean} `true` if the current playback is ready, otherwise `false` - */ - - - /** - * gets the playback type (`'vod', 'live', 'aod'`) - * @method getPlaybackType - * @return {String} you should write the playback type otherwise it'll assume `'no_op'` - * @example - * ```javascript - * html5VideoPlayback.getPlaybackType() //vod - * html5AudioPlayback.getPlaybackType() //aod - * html5VideoPlayback.getPlaybackType() //live - * flashHlsPlayback.getPlaybackType() //live - * ``` - */ - Playback.prototype.getPlaybackType = function getPlaybackType() { - return Playback.NO_OP; - }; - - /** - * checks if the playback is in HD. - * @method isHighDefinitionInUse - * @return {Boolean} `true` if the playback is playing in HD, otherwise `false` - */ - + // "true" => true + // "false" => false + // "null" => null + // "42" => 42 + // "42.5" => 42.5 + // "08" => "08" + // JSON => parse if valid + // String => self + function deserializeValue(value) { + try { + return value ? + value == "true" || + ( value == "false" ? false : + value == "null" ? null : + +value + "" == value ? +value : + /^[\[\{]/.test(value) ? $.parseJSON(value) : + value ) + : value + } catch(e) { + return value + } + } - Playback.prototype.isHighDefinitionInUse = function isHighDefinitionInUse() { - return false; - }; + $.type = type + $.isFunction = isFunction + $.isWindow = isWindow + $.isArray = isArray + $.isPlainObject = isPlainObject - /** - * sets the volume for the playback - * @method volume - * @param {Number} value a number between 0 (`muted`) to 100 (`max`) - */ + $.isEmptyObject = function(obj) { + var name + for (name in obj) return false + return true + } + $.isNumeric = function(val) { + var num = Number(val), type = typeof val + return val != null && type != 'boolean' && + (type != 'string' || val.length) && + !isNaN(num) && isFinite(num) || false + } - Playback.prototype.volume = function volume(value) {}; // eslint-disable-line no-unused-vars + $.inArray = function(elem, array, i){ + return emptyArray.indexOf.call(array, elem, i) + } - /** - * destroys the playback, removing it from DOM - * @method destroy - */ + $.camelCase = camelize + $.trim = function(str) { + return str == null ? "" : String.prototype.trim.call(str) + } + // plugin compatibility + $.uuid = 0 + $.support = { } + $.expr = { } + $.noop = function() {} - Playback.prototype.destroy = function destroy() { - this.$el.remove(); - }; + $.map = function(elements, callback){ + var value, values = [], i, key + if (likeArray(elements)) + for (i = 0; i < elements.length; i++) { + value = callback(elements[i], i) + if (value != null) values.push(value) + } + else + for (key in elements) { + value = callback(elements[key], key) + if (value != null) values.push(value) + } + return flatten(values) + } - _createClass(Playback, [{ - key: 'isReady', - get: function get() { - return false; + $.each = function(elements, callback){ + var i, key + if (likeArray(elements)) { + for (i = 0; i < elements.length; i++) + if (callback.call(elements[i], i, elements[i]) === false) return elements + } else { + for (key in elements) + if (callback.call(elements[key], key, elements[key]) === false) return elements } - }]); - return Playback; -}(_ui_object2.default); + return elements + } -exports.default = Playback; + $.grep = function(elements, callback){ + return filter.call(elements, callback) + } + if (window.JSON) $.parseJSON = JSON.parse -Playback.extend = function (properties) { - return (0, _utils.extend)(Playback, properties); -}; + // Populate the class2type map + $.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { + class2type[ "[object " + name + "]" ] = name.toLowerCase() + }) -/** - * checks if the playback can play a given `source` - * If a mimeType is provided then this will be used instead of inferring the mimetype - * from the source extension. - * @method canPlay - * @static - * @param {String} source the given source ex: `http://example.com/play.mp4` - * @param {String} [mimeType] the given mime type, ex: `'application/vnd.apple.mpegurl'` - * @return {Boolean} `true` if the playback is playable, otherwise `false` - */ -Playback.canPlay = function (source, mimeType) { - // eslint-disable-line no-unused-vars - return false; -}; + // Define methods that will be available on all + // Zepto collections + $.fn = { + constructor: zepto.Z, + length: 0, -/** - * a playback type for video on demand - * - * @property VOD - * @static - * @type String - */ -Playback.VOD = 'vod'; -/** - * a playback type for audio on demand - * - * @property AOD - * @static - * @type String - */ -Playback.AOD = 'aod'; -/** - * a playback type for live video - * - * @property LIVE - * @static - * @type String - */ -Playback.LIVE = 'live'; -/** - * a default playback type - * - * @property NO_OP - * @static - * @type String - */ -Playback.NO_OP = 'no_op'; -/** - * the plugin type - * - * @property type - * @static - * @type String - */ -Playback.type = 'playback'; -module.exports = exports['default']; + // Because a collection acts like an array + // copy over these useful array functions. + forEach: emptyArray.forEach, + reduce: emptyArray.reduce, + push: emptyArray.push, + sort: emptyArray.sort, + splice: emptyArray.splice, + indexOf: emptyArray.indexOf, + concat: function(){ + var i, value, args = [] + for (i = 0; i < arguments.length; i++) { + value = arguments[i] + args[i] = zepto.isZ(value) ? value.toArray() : value + } + return concat.apply(zepto.isZ(this) ? this.toArray() : this, args) + }, -/***/ }), -/* 3 */ -/***/ (function(module, exports) { + // `map` and `slice` in the jQuery API work differently + // from their array counterparts + map: function(fn){ + return $($.map(this, function(el, i){ return fn.call(el, i, el) })) + }, + slice: function(){ + return $(slice.apply(this, arguments)) + }, -/* Zepto v1.2.0 - zepto ajax callbacks deferred event ie selector - zeptojs.com/license */ - - -var Zepto = (function() { - var undefined, key, $, classList, emptyArray = [], concat = emptyArray.concat, filter = emptyArray.filter, slice = emptyArray.slice, - document = window.document, - elementDisplay = {}, classCache = {}, - cssNumber = { 'column-count': 1, 'columns': 1, 'font-weight': 1, 'line-height': 1,'opacity': 1, 'z-index': 1, 'zoom': 1 }, - fragmentRE = /^\s*<(\w+|!)[^>]*>/, - singleTagRE = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, - tagExpanderRE = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, - rootNodeRE = /^(?:body|html)$/i, - capitalRE = /([A-Z])/g, - - // special attributes that should be get/set via method calls - methodAttributes = ['val', 'css', 'html', 'text', 'data', 'width', 'height', 'offset'], - - adjacencyOperators = [ 'after', 'prepend', 'before', 'append' ], - table = document.createElement('table'), - tableRow = document.createElement('tr'), - containers = { - 'tr': document.createElement('tbody'), - 'tbody': table, 'thead': table, 'tfoot': table, - 'td': tableRow, 'th': tableRow, - '*': document.createElement('div') + ready: function(callback){ + // need to check if document.body exists for IE as that browser reports + // document ready when it hasn't yet created the body element + if (readyRE.test(document.readyState) && document.body) callback($) + else document.addEventListener('DOMContentLoaded', function(){ callback($) }, false) + return this }, - readyRE = /complete|loaded|interactive/, - simpleSelectorRE = /^[\w-]*$/, - class2type = {}, - toString = class2type.toString, - zepto = {}, - camelize, uniq, - tempParent = document.createElement('div'), - propMap = { - 'tabindex': 'tabIndex', - 'readonly': 'readOnly', - 'for': 'htmlFor', - 'class': 'className', - 'maxlength': 'maxLength', - 'cellspacing': 'cellSpacing', - 'cellpadding': 'cellPadding', - 'rowspan': 'rowSpan', - 'colspan': 'colSpan', - 'usemap': 'useMap', - 'frameborder': 'frameBorder', - 'contenteditable': 'contentEditable' + get: function(idx){ + return idx === undefined ? slice.call(this) : this[idx >= 0 ? idx : idx + this.length] }, - isArray = Array.isArray || - function(object){ return object instanceof Array } - - zepto.matches = function(element, selector) { - if (!selector || !element || element.nodeType !== 1) return false - var matchesSelector = element.matches || element.webkitMatchesSelector || - element.mozMatchesSelector || element.oMatchesSelector || - element.matchesSelector - if (matchesSelector) return matchesSelector.call(element, selector) - // fall back to performing a selector: - var match, parent = element.parentNode, temp = !parent - if (temp) (parent = tempParent).appendChild(element) - match = ~zepto.qsa(parent, selector).indexOf(element) - temp && tempParent.removeChild(element) - return match - } - - function type(obj) { - return obj == null ? String(obj) : - class2type[toString.call(obj)] || "object" - } - - function isFunction(value) { return type(value) == "function" } - function isWindow(obj) { return obj != null && obj == obj.window } - function isDocument(obj) { return obj != null && obj.nodeType == obj.DOCUMENT_NODE } - function isObject(obj) { return type(obj) == "object" } - function isPlainObject(obj) { - return isObject(obj) && !isWindow(obj) && Object.getPrototypeOf(obj) == Object.prototype - } - - function likeArray(obj) { - var length = !!obj && 'length' in obj && obj.length, - type = $.type(obj) - - return 'function' != type && !isWindow(obj) && ( - 'array' == type || length === 0 || - (typeof length == 'number' && length > 0 && (length - 1) in obj) - ) - } - - function compact(array) { return filter.call(array, function(item){ return item != null }) } - function flatten(array) { return array.length > 0 ? $.fn.concat.apply([], array) : array } - camelize = function(str){ return str.replace(/-+(.)?/g, function(match, chr){ return chr ? chr.toUpperCase() : '' }) } - function dasherize(str) { - return str.replace(/::/g, '/') - .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2') - .replace(/([a-z\d])([A-Z])/g, '$1_$2') - .replace(/_/g, '-') - .toLowerCase() - } - uniq = function(array){ return filter.call(array, function(item, idx){ return array.indexOf(item) == idx }) } - - function classRE(name) { - return name in classCache ? - classCache[name] : (classCache[name] = new RegExp('(^|\\s)' + name + '(\\s|$)')) - } - - function maybeAddPx(name, value) { - return (typeof value == "number" && !cssNumber[dasherize(name)]) ? value + "px" : value - } - - function defaultDisplay(nodeName) { - var element, display - if (!elementDisplay[nodeName]) { - element = document.createElement(nodeName) - document.body.appendChild(element) - display = getComputedStyle(element, '').getPropertyValue("display") - element.parentNode.removeChild(element) - display == "none" && (display = "block") - elementDisplay[nodeName] = display - } - return elementDisplay[nodeName] - } - - function children(element) { - return 'children' in element ? - slice.call(element.children) : - $.map(element.childNodes, function(node){ if (node.nodeType == 1) return node }) - } - - function Z(dom, selector) { - var i, len = dom ? dom.length : 0 - for (i = 0; i < len; i++) this[i] = dom[i] - this.length = len - this.selector = selector || '' - } - - // `$.zepto.fragment` takes a html string and an optional tag name - // to generate DOM nodes from the given html string. - // The generated DOM nodes are returned as an array. - // This function can be overridden in plugins for example to make - // it compatible with browsers that don't support the DOM fully. - zepto.fragment = function(html, name, properties) { - var dom, nodes, container - - // A special case optimization for a single tag - if (singleTagRE.test(html)) dom = $(document.createElement(RegExp.$1)) - - if (!dom) { - if (html.replace) html = html.replace(tagExpanderRE, "<$1>") - if (name === undefined) name = fragmentRE.test(html) && RegExp.$1 - if (!(name in containers)) name = '*' - - container = containers[name] - container.innerHTML = '' + html - dom = $.each(slice.call(container.childNodes), function(){ - container.removeChild(this) + toArray: function(){ return this.get() }, + size: function(){ + return this.length + }, + remove: function(){ + return this.each(function(){ + if (this.parentNode != null) + this.parentNode.removeChild(this) }) - } - - if (isPlainObject(properties)) { - nodes = $(dom) - $.each(properties, function(key, value) { - if (methodAttributes.indexOf(key) > -1) nodes[key](value) - else nodes.attr(key, value) - }) - } - - return dom - } - - // `$.zepto.Z` swaps out the prototype of the given `dom` array - // of nodes with `$.fn` and thus supplying all the Zepto functions - // to the array. This method can be overridden in plugins. - zepto.Z = function(dom, selector) { - return new Z(dom, selector) - } - - // `$.zepto.isZ` should return `true` if the given object is a Zepto - // collection. This method can be overridden in plugins. - zepto.isZ = function(object) { - return object instanceof zepto.Z - } - - // `$.zepto.init` is Zepto's counterpart to jQuery's `$.fn.init` and - // takes a CSS selector and an optional context (and handles various - // special cases). - // This method can be overridden in plugins. - zepto.init = function(selector, context) { - var dom - // If nothing given, return an empty Zepto collection - if (!selector) return zepto.Z() - // Optimize for string selectors - else if (typeof selector == 'string') { - selector = selector.trim() - // If it's a html fragment, create nodes from it - // Note: In both Chrome 21 and Firefox 15, DOM error 12 - // is thrown if the fragment doesn't begin with < - if (selector[0] == '<' && fragmentRE.test(selector)) - dom = zepto.fragment(selector, RegExp.$1, context), selector = null - // If there's a context, create a collection on that context first, and select - // nodes from there - else if (context !== undefined) return $(context).find(selector) - // If it's a CSS selector, use it to select nodes. - else dom = zepto.qsa(document, selector) - } - // If a function is given, call it when the DOM is ready - else if (isFunction(selector)) return $(document).ready(selector) - // If a Zepto collection is given, just return it - else if (zepto.isZ(selector)) return selector - else { - // normalize array if an array of nodes is given - if (isArray(selector)) dom = compact(selector) - // Wrap DOM nodes. - else if (isObject(selector)) - dom = [selector], selector = null - // If it's a html fragment, create nodes from it - else if (fragmentRE.test(selector)) - dom = zepto.fragment(selector.trim(), RegExp.$1, context), selector = null - // If there's a context, create a collection on that context first, and select - // nodes from there - else if (context !== undefined) return $(context).find(selector) - // And last but no least, if it's a CSS selector, use it to select nodes. - else dom = zepto.qsa(document, selector) - } - // create a new Zepto collection from the nodes found - return zepto.Z(dom, selector) - } - - // `$` will be the base `Zepto` object. When calling this - // function just call `$.zepto.init, which makes the implementation - // details of selecting nodes and creating Zepto collections - // patchable in plugins. - $ = function(selector, context){ - return zepto.init(selector, context) - } - - function extend(target, source, deep) { - for (key in source) - if (deep && (isPlainObject(source[key]) || isArray(source[key]))) { - if (isPlainObject(source[key]) && !isPlainObject(target[key])) - target[key] = {} - if (isArray(source[key]) && !isArray(target[key])) - target[key] = [] - extend(target[key], source[key], deep) - } - else if (source[key] !== undefined) target[key] = source[key] - } - - // Copy all but undefined properties from one or more - // objects to the `target` object. - $.extend = function(target){ - var deep, args = slice.call(arguments, 1) - if (typeof target == 'boolean') { - deep = target - target = args.shift() - } - args.forEach(function(arg){ extend(target, arg, deep) }) - return target - } - - // `$.zepto.qsa` is Zepto's CSS selector implementation which - // uses `document.querySelectorAll` and optimizes for some special cases, like `#id`. - // This method can be overridden in plugins. - zepto.qsa = function(element, selector){ - var found, - maybeID = selector[0] == '#', - maybeClass = !maybeID && selector[0] == '.', - nameOnly = maybeID || maybeClass ? selector.slice(1) : selector, // Ensure that a 1 char tag name still gets checked - isSimple = simpleSelectorRE.test(nameOnly) - return (element.getElementById && isSimple && maybeID) ? // Safari DocumentFragment doesn't have getElementById - ( (found = element.getElementById(nameOnly)) ? [found] : [] ) : - (element.nodeType !== 1 && element.nodeType !== 9 && element.nodeType !== 11) ? [] : - slice.call( - isSimple && !maybeID && element.getElementsByClassName ? // DocumentFragment doesn't have getElementsByClassName/TagName - maybeClass ? element.getElementsByClassName(nameOnly) : // If it's simple, it could be a class - element.getElementsByTagName(selector) : // Or a tag - element.querySelectorAll(selector) // Or it's not simple, and we need to query all - ) - } - - function filtered(nodes, selector) { - return selector == null ? $(nodes) : $(nodes).filter(selector) - } - - $.contains = document.documentElement.contains ? - function(parent, node) { - return parent !== node && parent.contains(node) - } : - function(parent, node) { - while (node && (node = node.parentNode)) - if (node === parent) return true - return false - } - - function funcArg(context, arg, idx, payload) { - return isFunction(arg) ? arg.call(context, idx, payload) : arg - } - - function setAttribute(node, name, value) { - value == null ? node.removeAttribute(name) : node.setAttribute(name, value) - } - - // access className property while respecting SVGAnimatedString - function className(node, value){ - var klass = node.className || '', - svg = klass && klass.baseVal !== undefined - - if (value === undefined) return svg ? klass.baseVal : klass - svg ? (klass.baseVal = value) : (node.className = value) - } - - // "true" => true - // "false" => false - // "null" => null - // "42" => 42 - // "42.5" => 42.5 - // "08" => "08" - // JSON => parse if valid - // String => self - function deserializeValue(value) { - try { - return value ? - value == "true" || - ( value == "false" ? false : - value == "null" ? null : - +value + "" == value ? +value : - /^[\[\{]/.test(value) ? $.parseJSON(value) : - value ) - : value - } catch(e) { - return value - } - } - - $.type = type - $.isFunction = isFunction - $.isWindow = isWindow - $.isArray = isArray - $.isPlainObject = isPlainObject - - $.isEmptyObject = function(obj) { - var name - for (name in obj) return false - return true - } - - $.isNumeric = function(val) { - var num = Number(val), type = typeof val - return val != null && type != 'boolean' && - (type != 'string' || val.length) && - !isNaN(num) && isFinite(num) || false - } - - $.inArray = function(elem, array, i){ - return emptyArray.indexOf.call(array, elem, i) - } - - $.camelCase = camelize - $.trim = function(str) { - return str == null ? "" : String.prototype.trim.call(str) - } - - // plugin compatibility - $.uuid = 0 - $.support = { } - $.expr = { } - $.noop = function() {} - - $.map = function(elements, callback){ - var value, values = [], i, key - if (likeArray(elements)) - for (i = 0; i < elements.length; i++) { - value = callback(elements[i], i) - if (value != null) values.push(value) - } - else - for (key in elements) { - value = callback(elements[key], key) - if (value != null) values.push(value) - } - return flatten(values) - } - - $.each = function(elements, callback){ - var i, key - if (likeArray(elements)) { - for (i = 0; i < elements.length; i++) - if (callback.call(elements[i], i, elements[i]) === false) return elements - } else { - for (key in elements) - if (callback.call(elements[key], key, elements[key]) === false) return elements - } - - return elements - } - - $.grep = function(elements, callback){ - return filter.call(elements, callback) - } - - if (window.JSON) $.parseJSON = JSON.parse - - // Populate the class2type map - $.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase() - }) - - // Define methods that will be available on all - // Zepto collections - $.fn = { - constructor: zepto.Z, - length: 0, - - // Because a collection acts like an array - // copy over these useful array functions. - forEach: emptyArray.forEach, - reduce: emptyArray.reduce, - push: emptyArray.push, - sort: emptyArray.sort, - splice: emptyArray.splice, - indexOf: emptyArray.indexOf, - concat: function(){ - var i, value, args = [] - for (i = 0; i < arguments.length; i++) { - value = arguments[i] - args[i] = zepto.isZ(value) ? value.toArray() : value - } - return concat.apply(zepto.isZ(this) ? this.toArray() : this, args) - }, - - // `map` and `slice` in the jQuery API work differently - // from their array counterparts - map: function(fn){ - return $($.map(this, function(el, i){ return fn.call(el, i, el) })) - }, - slice: function(){ - return $(slice.apply(this, arguments)) - }, - - ready: function(callback){ - // need to check if document.body exists for IE as that browser reports - // document ready when it hasn't yet created the body element - if (readyRE.test(document.readyState) && document.body) callback($) - else document.addEventListener('DOMContentLoaded', function(){ callback($) }, false) - return this - }, - get: function(idx){ - return idx === undefined ? slice.call(this) : this[idx >= 0 ? idx : idx + this.length] - }, - toArray: function(){ return this.get() }, - size: function(){ - return this.length - }, - remove: function(){ - return this.each(function(){ - if (this.parentNode != null) - this.parentNode.removeChild(this) - }) - }, - each: function(callback){ - emptyArray.every.call(this, function(el, idx){ - return callback.call(el, idx, el) !== false + }, + each: function(callback){ + emptyArray.every.call(this, function(el, idx){ + return callback.call(el, idx, el) !== false }) return this }, @@ -3466,7 +3317,7 @@ module.exports = Zepto /***/ }), -/* 4 */ +/* 7 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3476,403 +3327,321 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _clapprZepto = __webpack_require__(3); - -var _clapprZepto2 = _interopRequireDefault(_clapprZepto); +var _classCallCheck2 = __webpack_require__(0); -var _template = __webpack_require__(5); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); -var _template2 = _interopRequireDefault(_template); +var _possibleConstructorReturn2 = __webpack_require__(2); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); -// Copyright 2014 Globo.com Player authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. +var _createClass2 = __webpack_require__(3); -var Styler = { - getStyleFor: function getStyleFor(style) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { baseUrl: '' }; +var _createClass3 = _interopRequireDefault(_createClass2); - return (0, _clapprZepto2.default)('').html((0, _template2.default)(style.toString())(options)); - } -}; +var _inherits2 = __webpack_require__(1); -exports.default = Styler; -module.exports = exports['default']; +var _inherits3 = _interopRequireDefault(_inherits2); -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { +var _utils = __webpack_require__(5); -"use strict"; +var _ui_object = __webpack_require__(18); +var _ui_object2 = _interopRequireDefault(_ui_object); -/* eslint-disable no-var */ -// Simple JavaScript Templating -// Paul Miller (http://paulmillr.com) -// http://underscorejs.org -// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -// By default, Underscore uses ERB-style template delimiters, change the -// following template settings to use alternative delimiters. -var settings = { - evaluate: /<%([\s\S]+?)%>/g, - interpolate: /<%=([\s\S]+?)%>/g, - escape: /<%-([\s\S]+?)%>/g -}; +/** + * An abstraction to represent a generic playback, it's like an interface to be implemented by subclasses. + * @class Playback + * @constructor + * @extends UIObject + * @module base + */ +var Playback = function (_UIObject) { + (0, _inherits3.default)(Playback, _UIObject); + (0, _createClass3.default)(Playback, [{ + key: 'isAudioOnly', -// When customizing `templateSettings`, if you don't want to define an -// interpolation, evaluation or escaping regex, we need one that is -// guaranteed not to match. -var noMatch = /(.)^/; + /** + * Determine if the playback does not contain video/has video but video should be ignored. + * @property isAudioOnly + * @type Boolean + */ + get: function get() { + return false; + } -// Certain characters need to be escaped so that they can be put into a -// string literal. -var escapes = { - '\'': '\'', - '\\': '\\', - '\r': 'r', - '\n': 'n', - '\t': 't', - '\u2028': 'u2028', - '\u2029': 'u2029' -}; + /** + * Determine if the playback has ended. + * @property ended + * @type Boolean + */ -var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g; + }, { + key: 'ended', + get: function get() { + return false; + } -// List of HTML entities for escaping. -var htmlEntities = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - '\'': ''' -}; + /** + * The internationalization plugin. + * @property i18n + * @type {Strings} + */ -var entityRe = new RegExp('[&<>"\']', 'g'); + }, { + key: 'i18n', + get: function get() { + return this._i18n; + } -var escapeExpr = function escapeExpr(string) { - if (string === null) { - return ''; - } - return ('' + string).replace(entityRe, function (match) { - return htmlEntities[match]; - }); -}; + /** + * Determine if the playback is having to buffer in order for + * playback to be smooth. + * (i.e if a live stream is playing smoothly, this will be false) + * @property buffering + * @type Boolean + */ -var counter = 0; + }, { + key: 'buffering', + get: function get() { + return false; + } -// JavaScript micro-templating, similar to John Resig's implementation. -// Underscore templating handles arbitrary delimiters, preserves whitespace, -// and correctly escapes quotes within interpolated code. -var tmpl = function tmpl(text, data) { - var render; + /** + * @method constructor + * @param {Object} options the options object + * @param {Strings} i18n the internationalization component + */ - // Combine delimiters into one regular expression via alternation. - var matcher = new RegExp([(settings.escape || noMatch).source, (settings.interpolate || noMatch).source, (settings.evaluate || noMatch).source].join('|') + '|$', 'g'); + }]); - // Compile the template source, escaping string literals appropriately. - var index = 0; - var source = '__p+=\''; - text.replace(matcher, function (match, escape, interpolate, evaluate, offset) { - source += text.slice(index, offset).replace(escaper, function (match) { - return '\\' + escapes[match]; - }); + function Playback(options, i18n) { + (0, _classCallCheck3.default)(this, Playback); - if (escape) { - source += '\'+\n((__t=(' + escape + '))==null?\'\':escapeExpr(__t))+\n\''; - } - if (interpolate) { - source += '\'+\n((__t=(' + interpolate + '))==null?\'\':__t)+\n\''; - } - if (evaluate) { - source += '\';\n' + evaluate + '\n__p+=\''; - } - index = offset + match.length; - return match; - }); - source += '\';\n'; + var _this = (0, _possibleConstructorReturn3.default)(this, _UIObject.call(this, options)); - // If a variable is not specified, place data values in local scope. - if (!settings.variable) { - source = 'with(obj||{}){\n' + source + '}\n'; + _this.settings = {}; + _this._i18n = i18n; + return _this; } - source = 'var __t,__p=\'\',__j=Array.prototype.join,' + 'print=function(){__p+=__j.call(arguments,\'\');};\n' + source + 'return __p;\n//# sourceURL=/microtemplates/source[' + counter++ + ']'; + /** + * Gives user consent to playback (mobile devices). + * @method consent + */ - try { - /*jshint -W054 */ - // TODO: find a way to avoid eval - render = new Function(settings.variable || 'obj', 'escapeExpr', source); - } catch (e) { - e.source = source; - throw e; - } - if (data) { - return render(data, escapeExpr); - } - var template = function template(data) { - return render.call(this, data, escapeExpr); - }; + Playback.prototype.consent = function consent() {}; - // Provide the compiled function source as a convenience for precompilation. - template.source = 'function(' + (settings.variable || 'obj') + '){\n' + source + '}'; + /** + * plays the playback. + * @method play + */ - return template; -}; -tmpl.settings = settings; -module.exports = tmpl; + Playback.prototype.play = function play() {}; -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * pauses the playback. + * @method pause + */ -/* WEBPACK VAR INJECTION */(function(Buffer) {/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -// css base code, injected by the css-loader -module.exports = function(useSourceMap) { - var list = []; - // return the list of modules as css string - list.toString = function toString() { - return this.map(function (item) { - var content = cssWithMappingToString(item, useSourceMap); - if(item[2]) { - return "@media " + item[2] + "{" + content + "}"; - } else { - return content; - } - }).join(""); - }; + Playback.prototype.pause = function pause() {}; - // import a list of modules into the list - list.i = function(modules, mediaQuery) { - if(typeof modules === "string") - modules = [[null, modules, ""]]; - var alreadyImportedModules = {}; - for(var i = 0; i < this.length; i++) { - var id = this[i][0]; - if(typeof id === "number") - alreadyImportedModules[id] = true; - } - for(i = 0; i < modules.length; i++) { - var item = modules[i]; - // skip already imported module - // this implementation is not 100% perfect for weird media query combinations - // when a module is imported multiple times with different media queries. - // I hope this will never occur (Hey this way we have smaller bundles) - if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { - if(mediaQuery && !item[2]) { - item[2] = mediaQuery; - } else if(mediaQuery) { - item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; - } - list.push(item); - } - } - }; - return list; -}; + /** + * stops the playback. + * @method stop + */ -function cssWithMappingToString(item, useSourceMap) { - var content = item[1] || ''; - var cssMapping = item[3]; - if (!cssMapping) { - return content; - } - if (useSourceMap) { - var sourceMapping = toComment(cssMapping); - var sourceURLs = cssMapping.sources.map(function (source) { - return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */' - }); + Playback.prototype.stop = function stop() {}; - return [content].concat(sourceURLs).concat([sourceMapping]).join('\n'); - } + /** + * seeks the playback to a given `time` in seconds + * @method seek + * @param {Number} time should be a number between 0 and the video duration + */ - return [content].join('\n'); -} -// Adapted from convert-source-map (MIT) -function toComment(sourceMap) { - var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64'); - var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64; + Playback.prototype.seek = function seek(time) {}; // eslint-disable-line no-unused-vars - return '/*# ' + data + ' */'; -} + /** + * seeks the playback to a given `percentage` in percentage + * @method seekPercentage + * @param {Number} time should be a number between 0 and 100 + */ -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(80).Buffer)) -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { + Playback.prototype.seekPercentage = function seekPercentage(percentage) {}; // eslint-disable-line no-unused-vars -"use strict"; + /** + * The time that "0" now represents relative to when playback started. + * For a stream with a sliding window this will increase as content is + * removed from the beginning. + * @method getStartTimeOffset + * @return {Number} time (in seconds) that time "0" represents. + */ -Object.defineProperty(exports, "__esModule", { - value: true -}); -// Copyright 2014 Globo.com Player authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -var Browser = {}; - -var hasLocalstorage = function hasLocalstorage() { - try { - localStorage.setItem('clappr', 'clappr'); - localStorage.removeItem('clappr'); - return true; - } catch (e) { - return false; - } -}; - -var hasFlash = function hasFlash() { - try { - var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); - return !!fo; - } catch (e) { - return !!(navigator.mimeTypes && navigator.mimeTypes['application/x-shockwave-flash'] !== undefined && navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin); - } -}; - -var getBrowserInfo = function getBrowserInfo() { - var ua = navigator.userAgent; - var parts = ua.match(/\b(playstation 4|nx|opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [], - extra = void 0; - if (/trident/i.test(parts[1])) { - extra = /\brv[ :]+(\d+)/g.exec(ua) || []; - return { name: 'IE', version: parseInt(extra[1] || '') }; - } else if (parts[1] === 'Chrome') { - extra = ua.match(/\bOPR\/(\d+)/); - if (extra != null) { - return { name: 'Opera', version: parseInt(extra[1]) }; - } - } - parts = parts[2] ? [parts[1], parts[2]] : [navigator.appName, navigator.appVersion, '-?']; - if (extra = ua.match(/version\/(\d+)/i)) { - parts.splice(1, 1, extra[1]); - } - return { name: parts[0], version: parseInt(parts[1]) }; -}; + Playback.prototype.getStartTimeOffset = function getStartTimeOffset() { + return 0; + }; -var browserInfo = getBrowserInfo(); + /** + * gets the duration in seconds + * @method getDuration + * @return {Number} duration (in seconds) of the current source + */ -Browser.isSafari = /safari/i.test(navigator.userAgent) && navigator.userAgent.indexOf('Chrome') === -1; -Browser.isChrome = /chrome/i.test(navigator.userAgent) || /CriOS/i.test(navigator.userAgent); -Browser.isFirefox = /firefox/i.test(navigator.userAgent); -Browser.isLegacyIE = !!window.ActiveXObject; -Browser.isIE = Browser.isLegacyIE || /trident.*rv:1\d/i.test(navigator.userAgent); -Browser.isIE11 = /trident.*rv:11/i.test(navigator.userAgent); -Browser.isChromecast = Browser.isChrome && /CrKey/i.test(navigator.userAgent); -Browser.isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone|IEMobile|Opera Mini/i.test(navigator.userAgent); -Browser.isiOS = /iPad|iPhone|iPod/i.test(navigator.userAgent); -Browser.isAndroid = /Android/i.test(navigator.userAgent); -Browser.isWindowsPhone = /Windows Phone/i.test(navigator.userAgent); -Browser.isWin8App = /MSAppHost/i.test(navigator.userAgent); -Browser.isWiiU = /WiiU/i.test(navigator.userAgent); -Browser.isPS4 = /PlayStation 4/i.test(navigator.userAgent); -Browser.hasLocalstorage = hasLocalstorage(); -Browser.hasFlash = hasFlash(); -Browser.name = browserInfo.name; -Browser.version = browserInfo.version; + Playback.prototype.getDuration = function getDuration() { + return 0; + }; -exports.default = Browser; -module.exports = exports['default']; + /** + * checks if the playback is playing. + * @method isPlaying + * @return {Boolean} `true` if the current playback is playing, otherwise `false` + */ -/***/ }), -/* 8 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + Playback.prototype.isPlaying = function isPlaying() { + return false; + }; + /** + * checks if the playback is ready. + * @property isReady + * @type {Boolean} `true` if the current playback is ready, otherwise `false` + */ -Object.defineProperty(exports, "__esModule", { - value: 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; }; }(); + /** + * gets the playback type (`'vod', 'live', 'aod'`) + * @method getPlaybackType + * @return {String} you should write the playback type otherwise it'll assume `'no_op'` + * @example + * ```javascript + * html5VideoPlayback.getPlaybackType() //vod + * html5AudioPlayback.getPlaybackType() //aod + * html5VideoPlayback.getPlaybackType() //live + * flashHlsPlayback.getPlaybackType() //live + * ``` + */ + Playback.prototype.getPlaybackType = function getPlaybackType() { + return Playback.NO_OP; + }; -var _utils = __webpack_require__(1); + /** + * checks if the playback is in HD. + * @method isHighDefinitionInUse + * @return {Boolean} `true` if the playback is playing in HD, otherwise `false` + */ -var _events = __webpack_require__(0); -var _events2 = _interopRequireDefault(_events); + Playback.prototype.isHighDefinitionInUse = function isHighDefinitionInUse() { + return false; + }; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + /** + * sets the volume for the playback + * @method volume + * @param {Number} value a number between 0 (`muted`) to 100 (`max`) + */ -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + Playback.prototype.volume = function volume(value) {}; // eslint-disable-line no-unused-vars -function _inherits(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; } // Copyright 2014 Globo.com Player authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. + /** + * destroys the playback, removing it from DOM + * @method destroy + */ -/** - * @class BaseObject - * @constructor - * @extends Events - * @module base - */ -var BaseObject = function (_Events) { - _inherits(BaseObject, _Events); - _createClass(BaseObject, [{ - key: 'options', + Playback.prototype.destroy = function destroy() { + this.$el.remove(); + }; - /** - * returns the object options - * @property options - * @type Object - */ + (0, _createClass3.default)(Playback, [{ + key: 'isReady', get: function get() { - return this._options; + return false; } - - /** - * @method constructor - * @param {Object} options - */ - }]); + return Playback; +}(_ui_object2.default); - function BaseObject() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - - _classCallCheck(this, BaseObject); - - var _this = _possibleConstructorReturn(this, _Events.call(this, options)); +exports.default = Playback; - _this._options = options; - _this.uniqueId = (0, _utils.uniqueId)('o'); - return _this; - } - /** - * a unique id prefixed with `'o'`, `o1, o232` - * - * @property uniqueId - * @type String - */ +Playback.extend = function (properties) { + return (0, _utils.extend)(Playback, properties); +}; - return BaseObject; -}(_events2.default); +/** + * checks if the playback can play a given `source` + * If a mimeType is provided then this will be used instead of inferring the mimetype + * from the source extension. + * @method canPlay + * @static + * @param {String} source the given source ex: `http://example.com/play.mp4` + * @param {String} [mimeType] the given mime type, ex: `'application/vnd.apple.mpegurl'` + * @return {Boolean} `true` if the playback is playable, otherwise `false` + */ +Playback.canPlay = function (source, mimeType) { + // eslint-disable-line no-unused-vars + return false; +}; -exports.default = BaseObject; +/** + * a playback type for video on demand + * + * @property VOD + * @static + * @type String + */ +Playback.VOD = 'vod'; +/** + * a playback type for audio on demand + * + * @property AOD + * @static + * @type String + */ +Playback.AOD = 'aod'; +/** + * a playback type for live video + * + * @property LIVE + * @static + * @type String + */ +Playback.LIVE = 'live'; +/** + * a default playback type + * + * @property NO_OP + * @static + * @type String + */ +Playback.NO_OP = 'no_op'; +/** + * the plugin type + * + * @property type + * @static + * @type String + */ +Playback.type = 'playback'; module.exports = exports['default']; /***/ }), -/* 9 */ +/* 8 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -3882,353 +3651,353 @@ Object.defineProperty(exports, "__esModule", { value: 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 _utils = __webpack_require__(1); - -var _clapprZepto = __webpack_require__(3); +var _clapprZepto = __webpack_require__(6); var _clapprZepto2 = _interopRequireDefault(_clapprZepto); -var _lodash = __webpack_require__(107); - -var _lodash2 = _interopRequireDefault(_lodash); - -var _base_object = __webpack_require__(8); +var _template = __webpack_require__(9); -var _base_object2 = _interopRequireDefault(_base_object); +var _template2 = _interopRequireDefault(_template); 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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(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; } // Copyright 2014 Globo.com Player authors. All rights reserved. +// Copyright 2014 Globo.com Player authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -var delegateEventSplitter = /^(\S+)\s*(.*)$/; +var Styler = { + getStyleFor: function getStyleFor(style) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { baseUrl: '' }; -/** - * A base class to create ui object. - * @class UIObject - * @constructor - * @extends BaseObject - * @module base - */ + return (0, _clapprZepto2.default)('').html((0, _template2.default)(style.toString())(options)); + } +}; -var UIObject = function (_BaseObject) { - _inherits(UIObject, _BaseObject); +exports.default = Styler; +module.exports = exports['default']; - _createClass(UIObject, [{ - key: 'tagName', +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * a unique id prefixed with `'c'`, `c1, c232` - * - * @property cid - * @type String - */ - /** - * the dom element itself - * - * @property el - * @type HTMLElement - */ - /** - * the dom element wrapped by `$` - * - * @property $el - * @type HTMLElement - */ +"use strict"; - /** - * gets the tag name for the ui component - * @method tagName - * @default div - * @return {String} tag's name - */ - get: function get() { - return 'div'; - } - /** - * a literal object mapping element's events to methods - * @property events - * @type Object - * @example - * - *```javascript - * - * class MyButton extends UIObject { - * constructor(options) { - * super(options) - * this.myId = 0 - * } - * get events() { return { 'click': 'myClick' } } - * myClick(){ this.myId = 42 } - * } - * - * // when you click on MyButton the method `myClick` will be called - *``` - */ - }, { - key: 'events', - get: function get() { - return {}; - } - /** - * a literal object mapping attributes and values to the element - * element's attribute name and the value the attribute value - * @property attributes - * @type Object - * @example - * - *```javascript - * - * class MyButton extends UIObject { - * constructor(options) { super(options) } - * get attributes() { return { class: 'my-button'} } - * } - * - * // MyButton.el.className will be 'my-button' - * ``` - */ +Object.defineProperty(exports, "__esModule", { + value: true +}); +/* eslint-disable no-var */ +// Simple JavaScript Templating +// Paul Miller (http://paulmillr.com) +// http://underscorejs.org +// (c) 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - }, { - key: 'attributes', - get: function get() { - return {}; - } +// By default, Underscore uses ERB-style template delimiters, change the +// following template settings to use alternative delimiters. +var settings = { + evaluate: /<%([\s\S]+?)%>/g, + interpolate: /<%=([\s\S]+?)%>/g, + escape: /<%-([\s\S]+?)%>/g +}; - /** - * it builds an ui component by: - * * creating an id for the component `cid` - * * making sure the element is created `$el` - * * delegating all `events` to the element - * @method constructor - * @param {Object} options the options object - */ +// When customizing `templateSettings`, if you don't want to define an +// interpolation, evaluation or escaping regex, we need one that is +// guaranteed not to match. +var noMatch = /(.)^/; - }]); +// Certain characters need to be escaped so that they can be put into a +// string literal. +var escapes = { + '\'': '\'', + '\\': '\\', + '\r': 'r', + '\n': 'n', + '\t': 't', + '\u2028': 'u2028', + '\u2029': 'u2029' +}; - function UIObject(options) { - _classCallCheck(this, UIObject); +var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g; - var _this = _possibleConstructorReturn(this, _BaseObject.call(this, options)); +// List of HTML entities for escaping. +var htmlEntities = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + '\'': ''' +}; - _this.cid = (0, _utils.uniqueId)('c'); - _this._ensureElement(); - _this.delegateEvents(); - return _this; +var entityRe = new RegExp('[&<>"\']', 'g'); + +var escapeExpr = function escapeExpr(string) { + if (string === null) { + return ''; } + return ('' + string).replace(entityRe, function (match) { + return htmlEntities[match]; + }); +}; - /** - * selects within the component. - * @method $ - * @param {String} selector a selector to find within the component. - * @return {HTMLElement} an element, if it exists. - * @example - * ```javascript - * fullScreenBarUIComponent.$('.button-full') //will return only `.button-full` within the component - * ``` - */ +var counter = 0; +// JavaScript micro-templating, similar to John Resig's implementation. +// Underscore templating handles arbitrary delimiters, preserves whitespace, +// and correctly escapes quotes within interpolated code. +var tmpl = function tmpl(text, data) { + var render; - UIObject.prototype.$ = function $(selector) { - return this.$el.find(selector); - }; + // Combine delimiters into one regular expression via alternation. + var matcher = new RegExp([(settings.escape || noMatch).source, (settings.interpolate || noMatch).source, (settings.evaluate || noMatch).source].join('|') + '|$', 'g'); - /** - * render the component, usually attach it to a real existent `element` - * @method render - * @return {UIObject} itself - */ + // Compile the template source, escaping string literals appropriately. + var index = 0; + var source = '__p+=\''; + text.replace(matcher, function (match, escape, interpolate, evaluate, offset) { + source += text.slice(index, offset).replace(escaper, function (match) { + return '\\' + escapes[match]; + }); + if (escape) { + source += '\'+\n((__t=(' + escape + '))==null?\'\':escapeExpr(__t))+\n\''; + } + if (interpolate) { + source += '\'+\n((__t=(' + interpolate + '))==null?\'\':__t)+\n\''; + } + if (evaluate) { + source += '\';\n' + evaluate + '\n__p+=\''; + } + index = offset + match.length; + return match; + }); + source += '\';\n'; - UIObject.prototype.render = function render() { - return this; - }; + // If a variable is not specified, place data values in local scope. + if (!settings.variable) { + source = 'with(obj||{}){\n' + source + '}\n'; + } - /** - * removes the ui component from DOM - * @method remove - * @return {UIObject} itself - */ + source = 'var __t,__p=\'\',__j=Array.prototype.join,' + 'print=function(){__p+=__j.call(arguments,\'\');};\n' + source + 'return __p;\n//# sourceURL=/microtemplates/source[' + counter++ + ']'; + try { + /*jshint -W054 */ + // TODO: find a way to avoid eval + render = new Function(settings.variable || 'obj', 'escapeExpr', source); + } catch (e) { + e.source = source; + throw e; + } - UIObject.prototype.remove = function remove() { - this.$el.remove(); - this.stopListening(); - this.undelegateEvents(); - return this; + if (data) { + return render(data, escapeExpr); + } + var template = function template(data) { + return render.call(this, data, escapeExpr); }; - /** - * set element to `el` and `$el` - * @method setElement - * @param {HTMLElement} element - * @param {Boolean} delegate whether is delegate or not - * @return {UIObject} itself - */ + // Provide the compiled function source as a convenience for precompilation. + template.source = 'function(' + (settings.variable || 'obj') + '){\n' + source + '}'; + return template; +}; +tmpl.settings = settings; - UIObject.prototype.setElement = function setElement(element, delegate) { - if (this.$el) { - this.undelegateEvents(); - } - this.$el = element instanceof _clapprZepto2.default ? element : (0, _clapprZepto2.default)(element); - this.el = this.$el[0]; - if (delegate !== false) { - this.delegateEvents(); - } - return this; - }; +exports.default = tmpl; +module.exports = exports['default']; - /** - * delegates all the original `events` on `element` to its callbacks - * @method delegateEvents - * @param {Object} events - * @return {UIObject} itself - */ +/***/ }), +/* 10 */ +/***/ (function(module, exports) { +var core = module.exports = {version: '2.4.0'}; +if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef - UIObject.prototype.delegateEvents = function delegateEvents(events) { - if (!(events || (events = (0, _lodash2.default)(this, 'events')))) { - return this; - } - this.undelegateEvents(); - for (var key in events) { - var method = events[key]; - if (method && method.constructor !== Function) { - method = this[events[key]]; - } - if (!method) { - continue; - } +/***/ }), +/* 11 */ +/***/ (function(module, exports) { - var match = key.match(delegateEventSplitter); - var eventName = match[1], - selector = match[2]; - //method = _.bind(method, this) - eventName += '.delegateEvents' + this.cid; - if (selector === '') { - this.$el.on(eventName, method.bind(this)); - } else { - this.$el.on(eventName, selector, method.bind(this)); - } - } - return this; - }; +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +// css base code, injected by the css-loader +module.exports = function(useSourceMap) { + var list = []; - /** - * undelegats all the `events` - * @method undelegateEvents - * @return {UIObject} itself - */ + // return the list of modules as css string + list.toString = function toString() { + return this.map(function (item) { + var content = cssWithMappingToString(item, useSourceMap); + if(item[2]) { + return "@media " + item[2] + "{" + content + "}"; + } else { + return content; + } + }).join(""); + }; + + // import a list of modules into the list + list.i = function(modules, mediaQuery) { + if(typeof modules === "string") + modules = [[null, modules, ""]]; + var alreadyImportedModules = {}; + for(var i = 0; i < this.length; i++) { + var id = this[i][0]; + if(typeof id === "number") + alreadyImportedModules[id] = true; + } + for(i = 0; i < modules.length; i++) { + var item = modules[i]; + // skip already imported module + // this implementation is not 100% perfect for weird media query combinations + // when a module is imported multiple times with different media queries. + // I hope this will never occur (Hey this way we have smaller bundles) + if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { + if(mediaQuery && !item[2]) { + item[2] = mediaQuery; + } else if(mediaQuery) { + item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; + } + list.push(item); + } + } + }; + return list; +}; +function cssWithMappingToString(item, useSourceMap) { + var content = item[1] || ''; + var cssMapping = item[3]; + if (!cssMapping) { + return content; + } - UIObject.prototype.undelegateEvents = function undelegateEvents() { - this.$el.off('.delegateEvents' + this.cid); - return this; - }; + if (useSourceMap && typeof btoa === 'function') { + var sourceMapping = toComment(cssMapping); + var sourceURLs = cssMapping.sources.map(function (source) { + return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */' + }); - /** - * ensures the creation of this ui component - * @method _ensureElement - * @private - */ + return [content].concat(sourceURLs).concat([sourceMapping]).join('\n'); + } + return [content].join('\n'); +} - UIObject.prototype._ensureElement = function _ensureElement() { - if (!this.el) { - var attrs = _clapprZepto2.default.extend({}, (0, _lodash2.default)(this, 'attributes')); - if (this.id) { - attrs.id = (0, _lodash2.default)(this, 'id'); - } - if (this.className) { - attrs['class'] = (0, _lodash2.default)(this, 'className'); - } - var $el = _utils.DomRecycler.create((0, _lodash2.default)(this, 'tagName')).attr(attrs); - this.setElement($el, false); - } else { - this.setElement((0, _lodash2.default)(this, 'el'), false); - } - }; +// Adapted from convert-source-map (MIT) +function toComment(sourceMap) { + // eslint-disable-next-line no-undef + var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))); + var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64; - return UIObject; -}(_base_object2.default); + return '/*# ' + data + ' */'; +} -exports.default = UIObject; -module.exports = exports['default']; /***/ }), -/* 10 */ +/* 12 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +var store = __webpack_require__(52)('wks') + , uid = __webpack_require__(37) + , Symbol = __webpack_require__(15).Symbol + , USE_SYMBOL = typeof Symbol == 'function'; +var $exports = module.exports = function(name){ + return store[name] || (store[name] = + USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); +}; -Object.defineProperty(exports, "__esModule", { - value: true -}); +$exports.store = store; -var _events = __webpack_require__(0); +/***/ }), +/* 13 */ +/***/ (function(module, exports, __webpack_require__) { -var _events2 = _interopRequireDefault(_events); +"use strict"; -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"); } } // Copyright 2014 Globo.com Player authors. All rights reserved. +Object.defineProperty(exports, "__esModule", { + value: true +}); +// Copyright 2014 Globo.com Player authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -/** - * The mediator is a singleton for handling global events. - */ - -var events = new _events2.default(); +var Browser = {}; -var Mediator = function Mediator() { - _classCallCheck(this, Mediator); +var hasLocalstorage = function hasLocalstorage() { + try { + localStorage.setItem('clappr', 'clappr'); + localStorage.removeItem('clappr'); + return true; + } catch (e) { + return false; + } }; -exports.default = Mediator; - - -Mediator.on = function (name, callback, context) { - events.on(name, callback, context); - return; +var hasFlash = function hasFlash() { + try { + var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); + return !!fo; + } catch (e) { + return !!(navigator.mimeTypes && navigator.mimeTypes['application/x-shockwave-flash'] !== undefined && navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin); + } }; -Mediator.once = function (name, callback, context) { - events.once(name, callback, context); - return; -}; +var getBrowserInfo = function getBrowserInfo() { + var ua = navigator.userAgent; + var parts = ua.match(/\b(playstation 4|nx|opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [], + extra = void 0; + if (/trident/i.test(parts[1])) { + extra = /\brv[ :]+(\d+)/g.exec(ua) || []; + return { name: 'IE', version: parseInt(extra[1] || '') }; + } else if (parts[1] === 'Chrome') { + extra = ua.match(/\bOPR\/(\d+)/); + if (extra != null) { + return { name: 'Opera', version: parseInt(extra[1]) }; + } + extra = ua.match(/\bEdge\/(\d+)/); + if (extra != null) { + return { name: 'Edge', version: parseInt(extra[1]) }; + } + } + parts = parts[2] ? [parts[1], parts[2]] : [navigator.appName, navigator.appVersion, '-?']; -Mediator.off = function (name, callback, context) { - events.off(name, callback, context); - return; + if (extra = ua.match(/version\/(\d+)/i)) { + parts.splice(1, 1, extra[1]); + } + return { name: parts[0], version: parseInt(parts[1]) }; }; -Mediator.trigger = function (name) { - for (var _len = arguments.length, opts = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - opts[_key - 1] = arguments[_key]; - } +var browserInfo = getBrowserInfo(); - events.trigger.apply(events, [name].concat(opts)); - return; -}; +Browser.isEdge = /edge/i.test(navigator.userAgent); +Browser.isChrome = /chrome|CriOS/i.test(navigator.userAgent) && !Browser.isEdge; +Browser.isSafari = /safari/i.test(navigator.userAgent) && !Browser.isChrome; +Browser.isFirefox = /firefox/i.test(navigator.userAgent); +Browser.isLegacyIE = !!window.ActiveXObject; +Browser.isIE = Browser.isLegacyIE || /trident.*rv:1\d/i.test(navigator.userAgent); +Browser.isIE11 = /trident.*rv:11/i.test(navigator.userAgent); +Browser.isChromecast = Browser.isChrome && /CrKey/i.test(navigator.userAgent); +Browser.isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone|IEMobile|Mobile Safari|Opera Mini/i.test(navigator.userAgent); +Browser.isiOS = /iPad|iPhone|iPod/i.test(navigator.userAgent); +Browser.isAndroid = /Android/i.test(navigator.userAgent); +Browser.isWindowsPhone = /Windows Phone/i.test(navigator.userAgent); +Browser.isWin8App = /MSAppHost/i.test(navigator.userAgent); +Browser.isWiiU = /WiiU/i.test(navigator.userAgent); +Browser.isPS4 = /PlayStation 4/i.test(navigator.userAgent); +Browser.hasLocalstorage = hasLocalstorage(); +Browser.hasFlash = hasFlash(); -Mediator.stopListening = function (obj, name, callback) { - events.stopListening(obj, name, callback); - return; -}; +Browser.name = browserInfo.name; +Browser.version = browserInfo.version; + +exports.default = Browser; module.exports = exports['default']; /***/ }), -/* 11 */ +/* 14 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4238,100 +4007,128 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _utils = __webpack_require__(1); +var _classCallCheck2 = __webpack_require__(0); -var _base_object = __webpack_require__(8); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); -var _base_object2 = _interopRequireDefault(_base_object); +var _possibleConstructorReturn2 = __webpack_require__(2); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +var _createClass2 = __webpack_require__(3); -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } +var _createClass3 = _interopRequireDefault(_createClass2); -function _inherits(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 _inherits2 = __webpack_require__(1); -var CorePlugin = function (_BaseObject) { - _inherits(CorePlugin, _BaseObject); +var _inherits3 = _interopRequireDefault(_inherits2); - function CorePlugin(core) { - _classCallCheck(this, CorePlugin); +var _utils = __webpack_require__(5); - var _this = _possibleConstructorReturn(this, _BaseObject.call(this, core.options)); +var _events = __webpack_require__(4); - _this.core = core; - _this.enabled = true; - _this.bindEvents(); - return _this; - } +var _events2 = _interopRequireDefault(_events); - CorePlugin.prototype.bindEvents = function bindEvents() {}; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - CorePlugin.prototype.enable = function enable() { - if (!this.enabled) { - this.bindEvents(); - this.enabled = true; - } - }; +/** + * @class BaseObject + * @constructor + * @extends Events + * @module base + */ +// Copyright 2014 Globo.com Player authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. - CorePlugin.prototype.disable = function disable() { - if (this.enabled) { - this.stopListening(); - this.enabled = false; +var BaseObject = function (_Events) { + (0, _inherits3.default)(BaseObject, _Events); + (0, _createClass3.default)(BaseObject, [{ + key: 'options', + + /** + * returns the object options + * @property options + * @type Object + */ + get: function get() { + return this._options; } - }; - CorePlugin.prototype.getExternalInterface = function getExternalInterface() { - return {}; - }; + /** + * @method constructor + * @param {Object} options + */ - CorePlugin.prototype.destroy = function destroy() { - this.stopListening(); - }; + }]); - return CorePlugin; -}(_base_object2.default); + function BaseObject() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + (0, _classCallCheck3.default)(this, BaseObject); -exports.default = CorePlugin; + var _this = (0, _possibleConstructorReturn3.default)(this, _Events.call(this, options)); + + _this._options = options; + _this.uniqueId = (0, _utils.uniqueId)('o'); + return _this; + } + /** + * a unique id prefixed with `'o'`, `o1, o232` + * + * @property uniqueId + * @type String + */ -CorePlugin.extend = function (properties) { - return (0, _utils.extend)(CorePlugin, properties); -}; + return BaseObject; +}(_events2.default); -CorePlugin.type = 'core'; +exports.default = BaseObject; module.exports = exports['default']; /***/ }), -/* 12 */ +/* 15 */ /***/ (function(module, exports) { -var g; - -// This works in non-strict mode -g = (function() { - return this; -})(); - -try { - // This works if eval is allowed (see CSP) - g = g || Function("return this")() || (1,eval)("this"); -} catch(e) { - // This works if the window reference is available - if(typeof window === "object") - g = window; -} - -// g can still be undefined, but nothing to do about it... -// We return undefined, instead of nothing here, so it's -// easier to handle this case. if(!global) { ...} - -module.exports = g; +// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 +var global = module.exports = typeof window != 'undefined' && window.Math == Math + ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); +if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { +var anObject = __webpack_require__(23) + , IE8_DOM_DEFINE = __webpack_require__(75) + , toPrimitive = __webpack_require__(55) + , dP = Object.defineProperty; + +exports.f = __webpack_require__(19) ? Object.defineProperty : function defineProperty(O, P, Attributes){ + anObject(O); + P = toPrimitive(P, true); + anObject(Attributes); + if(IE8_DOM_DEFINE)try { + return dP(O, P, Attributes); + } catch(e){ /* empty */ } + if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!'); + if('value' in Attributes)O[P] = Attributes.value; + return O; +}; /***/ }), -/* 13 */ +/* 17 */ +/***/ (function(module, exports, __webpack_require__) { + +// to indexed object, toObject with fallback for non-array-like ES3 strings +var IObject = __webpack_require__(149) + , defined = __webpack_require__(44); +module.exports = function(it){ + return IObject(defined(it)); +}; + +/***/ }), +/* 18 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4341,157 +4138,376 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _base_object = __webpack_require__(8); +var _classCallCheck2 = __webpack_require__(0); -var _base_object2 = _interopRequireDefault(_base_object); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); -var _utils = __webpack_require__(1); +var _possibleConstructorReturn2 = __webpack_require__(2); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +var _createClass2 = __webpack_require__(3); -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } +var _createClass3 = _interopRequireDefault(_createClass2); -function _inherits(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 _inherits2 = __webpack_require__(1); + +var _inherits3 = _interopRequireDefault(_inherits2); + +var _clapprZepto = __webpack_require__(6); + +var _clapprZepto2 = _interopRequireDefault(_clapprZepto); + +var _utils = __webpack_require__(5); + +var _base_object = __webpack_require__(14); + +var _base_object2 = _interopRequireDefault(_base_object); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var delegateEventSplitter = /^(\S+)\s*(.*)$/; /** - * The base class for a container plugin - * @class ContainerPlugin + * A base class to create ui object. + * @class UIObject * @constructor - * @extends UIObject + * @extends BaseObject * @module base */ -var ContainerPlugin = function (_BaseObject) { - _inherits(ContainerPlugin, _BaseObject); - - function ContainerPlugin(container) { - _classCallCheck(this, ContainerPlugin); +// Copyright 2014 Globo.com Player authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. - var _this = _possibleConstructorReturn(this, _BaseObject.call(this, container.options)); +var UIObject = function (_BaseObject) { + (0, _inherits3.default)(UIObject, _BaseObject); + (0, _createClass3.default)(UIObject, [{ + key: 'tagName', - _this.container = container; - _this.enabled = true; - _this.bindEvents(); - return _this; - } + /** + * a unique id prefixed with `'c'`, `c1, c232` + * + * @property cid + * @type String + */ + /** + * the dom element itself + * + * @property el + * @type HTMLElement + */ + /** + * the dom element wrapped by `$` + * + * @property $el + * @type HTMLElement + */ - ContainerPlugin.prototype.enable = function enable() { - if (!this.enabled) { - this.bindEvents(); - this.enabled = true; + /** + * gets the tag name for the ui component + * @method tagName + * @default div + * @return {String} tag's name + */ + get: function get() { + return 'div'; } - }; + /** + * a literal object mapping element's events to methods + * @property events + * @type Object + * @example + * + *```javascript + * + * class MyButton extends UIObject { + * constructor(options) { + * super(options) + * this.myId = 0 + * } + * get events() { return { 'click': 'myClick' } } + * myClick(){ this.myId = 42 } + * } + * + * // when you click on MyButton the method `myClick` will be called + *``` + */ - ContainerPlugin.prototype.disable = function disable() { - if (this.enabled) { - this.stopListening(); - this.enabled = false; + }, { + key: 'events', + get: function get() { + return {}; } - }; - - ContainerPlugin.prototype.bindEvents = function bindEvents() {}; - - ContainerPlugin.prototype.destroy = function destroy() { - this.stopListening(); - }; + /** + * a literal object mapping attributes and values to the element + * element's attribute name and the value the attribute value + * @property attributes + * @type Object + * @example + * + *```javascript + * + * class MyButton extends UIObject { + * constructor(options) { super(options) } + * get attributes() { return { class: 'my-button'} } + * } + * + * // MyButton.el.className will be 'my-button' + * ``` + */ - return ContainerPlugin; -}(_base_object2.default); + }, { + key: 'attributes', + get: function get() { + return {}; + } -exports.default = ContainerPlugin; + /** + * it builds an ui component by: + * * creating an id for the component `cid` + * * making sure the element is created `$el` + * * delegating all `events` to the element + * @method constructor + * @param {Object} options the options object + */ + }]); -ContainerPlugin.extend = function (properties) { - return (0, _utils.extend)(ContainerPlugin, properties); -}; + function UIObject(options) { + (0, _classCallCheck3.default)(this, UIObject); -ContainerPlugin.type = 'container'; -module.exports = exports['default']; + var _this = (0, _possibleConstructorReturn3.default)(this, _BaseObject.call(this, options)); -/***/ }), -/* 14 */ -/***/ (function(module, exports, __webpack_require__) { + _this.cid = (0, _utils.uniqueId)('c'); + _this._ensureElement(); + _this.delegateEvents(); + return _this; + } -"use strict"; + /** + * selects within the component. + * @method $ + * @param {String} selector a selector to find within the component. + * @return {HTMLElement} an element, if it exists. + * @example + * ```javascript + * fullScreenBarUIComponent.$('.button-full') //will return only `.button-full` within the component + * ``` + */ -Object.defineProperty(exports, "__esModule", { - value: true -}); + UIObject.prototype.$ = function $(selector) { + return this.$el.find(selector); + }; -var _utils = __webpack_require__(1); + /** + * render the component, usually attach it to a real existent `element` + * @method render + * @return {UIObject} itself + */ -var _ui_object = __webpack_require__(9); -var _ui_object2 = _interopRequireDefault(_ui_object); + UIObject.prototype.render = function render() { + return this; + }; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + /** + * removes the ui component from DOM + * @method remove + * @return {UIObject} itself + */ -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + UIObject.prototype.remove = function remove() { + this.$el.remove(); + this.stopListening(); + this.undelegateEvents(); + return this; + }; -function _inherits(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; } // Copyright 2014 Globo.com Player authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. + /** + * set element to `el` and `$el` + * @method setElement + * @param {HTMLElement} element + * @param {Boolean} delegate whether is delegate or not + * @return {UIObject} itself + */ -/** - * The base class for an ui container plugin - * @class UIContainerPlugin - * @constructor - * @extends UIObject - * @module base - */ -var UIContainerPlugin = function (_UIObject) { - _inherits(UIContainerPlugin, _UIObject); - function UIContainerPlugin(container) { - _classCallCheck(this, UIContainerPlugin); + UIObject.prototype.setElement = function setElement(element, delegate) { + if (this.$el) { + this.undelegateEvents(); + } + this.$el = element instanceof _clapprZepto2.default ? element : (0, _clapprZepto2.default)(element); + this.el = this.$el[0]; + if (delegate !== false) { + this.delegateEvents(); + } + return this; + }; + + /** + * delegates all the original `events` on `element` to its callbacks + * @method delegateEvents + * @param {Object} events + * @return {UIObject} itself + */ - var _this = _possibleConstructorReturn(this, _UIObject.call(this, container.options)); - _this.container = container; - _this.enabled = true; - _this.bindEvents(); - return _this; - } + UIObject.prototype.delegateEvents = function delegateEvents(events) { + if (!(events || (events = this.events))) { + return this; + } + this.undelegateEvents(); + for (var key in events) { + var method = events[key]; + if (method && method.constructor !== Function) { + method = this[events[key]]; + } + if (!method) { + continue; + } - UIContainerPlugin.prototype.enable = function enable() { - if (!this.enabled) { - this.bindEvents(); - this.$el.show(); - this.enabled = true; + var match = key.match(delegateEventSplitter); + var eventName = match[1], + selector = match[2]; + eventName += '.delegateEvents' + this.cid; + if (selector === '') { + this.$el.on(eventName, method.bind(this)); + } else { + this.$el.on(eventName, selector, method.bind(this)); + } } + return this; }; - UIContainerPlugin.prototype.disable = function disable() { - this.stopListening(); - this.$el.hide(); - this.enabled = false; + /** + * undelegats all the `events` + * @method undelegateEvents + * @return {UIObject} itself + */ + + + UIObject.prototype.undelegateEvents = function undelegateEvents() { + this.$el.off('.delegateEvents' + this.cid); + return this; }; - UIContainerPlugin.prototype.bindEvents = function bindEvents() {}; + /** + * ensures the creation of this ui component + * @method _ensureElement + * @private + */ - UIContainerPlugin.prototype.destroy = function destroy() { - this.remove(); + + UIObject.prototype._ensureElement = function _ensureElement() { + if (!this.el) { + var attrs = _clapprZepto2.default.extend({}, this.attributes); + if (this.id) { + attrs.id = this.id; + } + if (this.className) { + attrs['class'] = this.className; + } + var $el = _utils.DomRecycler.create(this.tagName).attr(attrs); + this.setElement($el, false); + } else { + this.setElement(this.el, false); + } }; - return UIContainerPlugin; -}(_ui_object2.default); + return UIObject; +}(_base_object2.default); -exports.default = UIContainerPlugin; +exports.default = UIObject; +module.exports = exports['default']; +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { -UIContainerPlugin.extend = function (properties) { - return (0, _utils.extend)(UIContainerPlugin, properties); +// Thank's IE8 for his funny defineProperty +module.exports = !__webpack_require__(26)(function(){ + return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; +}); + +/***/ }), +/* 20 */ +/***/ (function(module, exports, __webpack_require__) { + +var global = __webpack_require__(15) + , core = __webpack_require__(10) + , ctx = __webpack_require__(43) + , hide = __webpack_require__(24) + , PROTOTYPE = 'prototype'; + +var $export = function(type, name, source){ + var IS_FORCED = type & $export.F + , IS_GLOBAL = type & $export.G + , IS_STATIC = type & $export.S + , IS_PROTO = type & $export.P + , IS_BIND = type & $export.B + , IS_WRAP = type & $export.W + , exports = IS_GLOBAL ? core : core[name] || (core[name] = {}) + , expProto = exports[PROTOTYPE] + , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE] + , key, own, out; + if(IS_GLOBAL)source = name; + for(key in source){ + // contains in native + own = !IS_FORCED && target && target[key] !== undefined; + if(own && key in exports)continue; + // export native or passed + out = own ? target[key] : source[key]; + // prevent global pollution for namespaces + exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] + // bind timers to global for call from export context + : IS_BIND && own ? ctx(out, global) + // wrap global constructors for prevent change them in library + : IS_WRAP && target[key] == out ? (function(C){ + var F = function(a, b, c){ + if(this instanceof C){ + switch(arguments.length){ + case 0: return new C; + case 1: return new C(a); + case 2: return new C(a, b); + } return new C(a, b, c); + } return C.apply(this, arguments); + }; + F[PROTOTYPE] = C[PROTOTYPE]; + return F; + // make static versions for prototype methods + })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; + // export proto methods to core.%CONSTRUCTOR%.methods.%NAME% + if(IS_PROTO){ + (exports.virtual || (exports.virtual = {}))[key] = out; + // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME% + if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out); + } + } }; +// type bitmap +$export.F = 1; // forced +$export.G = 2; // global +$export.S = 4; // static +$export.P = 8; // proto +$export.B = 16; // bind +$export.W = 32; // wrap +$export.U = 64; // safe +$export.R = 128; // real proto method for `library` +module.exports = $export; -UIContainerPlugin.type = 'container'; -module.exports = exports['default']; +/***/ }), +/* 21 */ +/***/ (function(module, exports) { + +var hasOwnProperty = {}.hasOwnProperty; +module.exports = function(it, key){ + return hasOwnProperty.call(it, key); +}; /***/ }), -/* 15 */ +/* 22 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4501,40 +4517,86 @@ Object.defineProperty(exports, "__esModule", { value: true }); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +var _classCallCheck2 = __webpack_require__(0); -// Copyright 2014 Globo.com Player authors. All rights reserved. +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + +var _events = __webpack_require__(4); + +var _events2 = _interopRequireDefault(_events); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var events = new _events2.default(); // Copyright 2014 Globo.com Player authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -var PlayerInfo = function PlayerInfo() { - _classCallCheck(this, PlayerInfo); +/** + * The mediator is a singleton for handling global events. + */ - this.options = {}; - this.playbackPlugins = []; - this.currentSize = { width: 0, height: 0 }; +var Mediator = function Mediator() { + (0, _classCallCheck3.default)(this, Mediator); }; -PlayerInfo._players = {}; +exports.default = Mediator; -PlayerInfo.getInstance = function (playerId) { - return PlayerInfo._players[playerId] || (PlayerInfo._players[playerId] = new PlayerInfo()); + +Mediator.on = function (name, callback, context) { + events.on(name, callback, context); + return; }; -exports.default = PlayerInfo; -module.exports = exports["default"]; +Mediator.once = function (name, callback, context) { + events.once(name, callback, context); + return; +}; + +Mediator.off = function (name, callback, context) { + events.off(name, callback, context); + return; +}; + +Mediator.trigger = function (name) { + for (var _len = arguments.length, opts = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + opts[_key - 1] = arguments[_key]; + } + + events.trigger.apply(events, [name].concat(opts)); + return; +}; + +Mediator.stopListening = function (obj, name, callback) { + events.stopListening(obj, name, callback); + return; +}; +module.exports = exports['default']; /***/ }), -/* 16 */ +/* 23 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +var isObject = __webpack_require__(27); +module.exports = function(it){ + if(!isObject(it))throw TypeError(it + ' is not an object!'); + return it; +}; +/***/ }), +/* 24 */ +/***/ (function(module, exports, __webpack_require__) { -module.exports = __webpack_require__(54); +var dP = __webpack_require__(16) + , createDesc = __webpack_require__(30); +module.exports = __webpack_require__(19) ? function(object, key, value){ + return dP.f(object, key, createDesc(1, value)); +} : function(object, key, value){ + object[key] = value; + return object; +}; /***/ }), -/* 17 */ +/* 25 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4544,100 +4606,130 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _utils = __webpack_require__(1); +var _classCallCheck2 = __webpack_require__(0); -var _ui_object = __webpack_require__(9); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); -var _ui_object2 = _interopRequireDefault(_ui_object); +var _possibleConstructorReturn2 = __webpack_require__(2); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +var _inherits2 = __webpack_require__(1); -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } +var _inherits3 = _interopRequireDefault(_inherits2); -function _inherits(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 _utils = __webpack_require__(5); -var UICorePlugin = function (_UIObject) { - _inherits(UICorePlugin, _UIObject); +var _base_object = __webpack_require__(14); - function UICorePlugin(core) { - _classCallCheck(this, UICorePlugin); +var _base_object2 = _interopRequireDefault(_base_object); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var CorePlugin = function (_BaseObject) { + (0, _inherits3.default)(CorePlugin, _BaseObject); + + function CorePlugin(core) { + (0, _classCallCheck3.default)(this, CorePlugin); - var _this = _possibleConstructorReturn(this, _UIObject.call(this, core.options)); + var _this = (0, _possibleConstructorReturn3.default)(this, _BaseObject.call(this, core.options)); _this.core = core; _this.enabled = true; _this.bindEvents(); - _this.render(); return _this; } - UICorePlugin.prototype.bindEvents = function bindEvents() {}; - - UICorePlugin.prototype.getExternalInterface = function getExternalInterface() { - return {}; - }; + CorePlugin.prototype.bindEvents = function bindEvents() {}; - UICorePlugin.prototype.enable = function enable() { + CorePlugin.prototype.enable = function enable() { if (!this.enabled) { this.bindEvents(); - this.$el.show(); this.enabled = true; } }; - UICorePlugin.prototype.disable = function disable() { - this.stopListening(); - this.$el.hide(); - this.enabled = false; + CorePlugin.prototype.disable = function disable() { + if (this.enabled) { + this.stopListening(); + this.enabled = false; + } }; - UICorePlugin.prototype.destroy = function destroy() { - this.remove(); + CorePlugin.prototype.getExternalInterface = function getExternalInterface() { + return {}; }; - UICorePlugin.prototype.render = function render() { - return this; + CorePlugin.prototype.destroy = function destroy() { + this.stopListening(); }; - return UICorePlugin; -}(_ui_object2.default); + return CorePlugin; +}(_base_object2.default); -exports.default = UICorePlugin; +exports.default = CorePlugin; -UICorePlugin.extend = function (properties) { - return (0, _utils.extend)(UICorePlugin, properties); +CorePlugin.extend = function (properties) { + return (0, _utils.extend)(CorePlugin, properties); }; -UICorePlugin.type = 'core'; +CorePlugin.type = 'core'; module.exports = exports['default']; /***/ }), -/* 18 */ -/***/ (function(module, exports, __webpack_require__) { +/* 26 */ +/***/ (function(module, exports) { -"use strict"; +module.exports = function(exec){ + try { + return !!exec(); + } catch(e){ + return true; + } +}; +/***/ }), +/* 27 */ +/***/ (function(module, exports) { -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = __webpack_require__(48); -module.exports = exports['default']; +module.exports = function(it){ + return typeof it === 'object' ? it !== null : typeof it === 'function'; +}; /***/ }), -/* 19 */ +/* 28 */ +/***/ (function(module, exports) { + +module.exports = {}; + +/***/ }), +/* 29 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +// 19.1.2.14 / 15.2.3.14 Object.keys(O) +var $keys = __webpack_require__(79) + , enumBugKeys = __webpack_require__(45); + +module.exports = Object.keys || function keys(O){ + return $keys(O, enumBugKeys); +}; +/***/ }), +/* 30 */ +/***/ (function(module, exports) { -module.exports = __webpack_require__(66); +module.exports = function(bitmap, value){ + return { + enumerable : !(bitmap & 1), + configurable: !(bitmap & 2), + writable : !(bitmap & 4), + value : value + }; +}; /***/ }), -/* 20 */ +/* 31 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -4647,324 +4739,206 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _kibo = __webpack_require__(78); - -var _kibo2 = _interopRequireDefault(_kibo); +var _classCallCheck2 = __webpack_require__(0); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); -exports.default = { Kibo: _kibo2.default }; -module.exports = exports['default']; +var _possibleConstructorReturn2 = __webpack_require__(2); -/***/ }), -/* 21 */ -/***/ (function(module, exports) { +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); -// shim for using process in browser -var process = module.exports = {}; +var _inherits2 = __webpack_require__(1); -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. +var _inherits3 = _interopRequireDefault(_inherits2); -var cachedSetTimeout; -var cachedClearTimeout; +var _base_object = __webpack_require__(14); -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); -} -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } +var _base_object2 = _interopRequireDefault(_base_object); +var _utils = __webpack_require__(5); -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/** + * The base class for a container plugin + * @class ContainerPlugin + * @constructor + * @extends UIObject + * @module base + */ +var ContainerPlugin = function (_BaseObject) { + (0, _inherits3.default)(ContainerPlugin, _BaseObject); + function ContainerPlugin(container) { + (0, _classCallCheck3.default)(this, ContainerPlugin); -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; + var _this = (0, _possibleConstructorReturn3.default)(this, _BaseObject.call(this, container.options)); -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} + _this.container = container; + _this.enabled = true; + _this.bindEvents(); + return _this; + } -function drainQueue() { - if (draining) { - return; + ContainerPlugin.prototype.enable = function enable() { + if (!this.enabled) { + this.bindEvents(); + this.enabled = true; } - var timeout = runTimeout(cleanUpNextTick); - draining = true; + }; - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; + ContainerPlugin.prototype.disable = function disable() { + if (this.enabled) { + this.stopListening(); + this.enabled = false; } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} + }; -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; + ContainerPlugin.prototype.bindEvents = function bindEvents() {}; -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; + ContainerPlugin.prototype.destroy = function destroy() { + this.stopListening(); + }; -function noop() {} + return ContainerPlugin; +}(_base_object2.default); -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; +exports.default = ContainerPlugin; -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); +ContainerPlugin.extend = function (properties) { + return (0, _utils.extend)(ContainerPlugin, properties); }; -process.umask = function() { return 0; }; - - -/***/ }), -/* 22 */ -/***/ (function(module, exports) { - -module.exports = "" - -/***/ }), -/* 23 */ -/***/ (function(module, exports) { - -module.exports = function(module) { - if(!module.webpackPolyfill) { - module.deprecate = function() {}; - module.paths = []; - // module.parent = undefined by default - if(!module.children) module.children = []; - Object.defineProperty(module, "loaded", { - enumerable: true, - get: function() { - return module.l; - } - }); - Object.defineProperty(module, "id", { - enumerable: true, - get: function() { - return module.i; - } - }); - module.webpackPolyfill = 1; - } - return module; -}; +ContainerPlugin.type = 'container'; +module.exports = exports['default']; /***/ }), -/* 24 */ +/* 32 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -module.exports = __webpack_require__(39); +Object.defineProperty(exports, "__esModule", { + value: true +}); -/***/ }), -/* 25 */ -/***/ (function(module, exports, __webpack_require__) { +var _classCallCheck2 = __webpack_require__(0); -"use strict"; +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +var _possibleConstructorReturn2 = __webpack_require__(2); -module.exports = __webpack_require__(42); +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); -/***/ }), -/* 26 */ -/***/ (function(module, exports, __webpack_require__) { +var _inherits2 = __webpack_require__(1); -"use strict"; +var _inherits3 = _interopRequireDefault(_inherits2); +var _utils = __webpack_require__(5); -module.exports = __webpack_require__(45); +var _ui_object = __webpack_require__(18); -/***/ }), -/* 27 */ -/***/ (function(module, exports, __webpack_require__) { +var _ui_object2 = _interopRequireDefault(_ui_object); -"use strict"; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +/** + * The base class for an ui container plugin + * @class UIContainerPlugin + * @constructor + * @extends UIObject + * @module base + */ +// Copyright 2014 Globo.com Player authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. -module.exports = __webpack_require__(46); +var UIContainerPlugin = function (_UIObject) { + (0, _inherits3.default)(UIContainerPlugin, _UIObject); -/***/ }), -/* 28 */ -/***/ (function(module, exports, __webpack_require__) { + function UIContainerPlugin(container) { + (0, _classCallCheck3.default)(this, UIContainerPlugin); -"use strict"; + var _this = (0, _possibleConstructorReturn3.default)(this, _UIObject.call(this, container.options)); + _this.container = container; + _this.enabled = true; + _this.bindEvents(); + return _this; + } -module.exports = __webpack_require__(49); + UIContainerPlugin.prototype.enable = function enable() { + if (!this.enabled) { + this.bindEvents(); + this.$el.show(); + this.enabled = true; + } + }; -/***/ }), -/* 29 */ -/***/ (function(module, exports, __webpack_require__) { + UIContainerPlugin.prototype.disable = function disable() { + this.stopListening(); + this.$el.hide(); + this.enabled = false; + }; -"use strict"; + UIContainerPlugin.prototype.bindEvents = function bindEvents() {}; + UIContainerPlugin.prototype.destroy = function destroy() { + this.remove(); + }; -module.exports = __webpack_require__(50); + return UIContainerPlugin; +}(_ui_object2.default); -/***/ }), -/* 30 */ -/***/ (function(module, exports, __webpack_require__) { +exports.default = UIContainerPlugin; -"use strict"; +UIContainerPlugin.extend = function (properties) { + return (0, _utils.extend)(UIContainerPlugin, properties); +}; -module.exports = __webpack_require__(52); +UIContainerPlugin.type = 'container'; +module.exports = exports['default']; /***/ }), -/* 31 */ +/* 33 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -module.exports = __webpack_require__(53); +Object.defineProperty(exports, "__esModule", { + value: true +}); -/***/ }), -/* 32 */ -/***/ (function(module, exports, __webpack_require__) { +var _classCallCheck2 = __webpack_require__(0); -"use strict"; +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -module.exports = __webpack_require__(55); +// Copyright 2014 Globo.com Player authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. -/***/ }), -/* 33 */ -/***/ (function(module, exports, __webpack_require__) { +var PlayerInfo = function PlayerInfo() { + (0, _classCallCheck3.default)(this, PlayerInfo); -"use strict"; + this.options = {}; + this.playbackPlugins = []; + this.currentSize = { width: 0, height: 0 }; +}; + +PlayerInfo._players = {}; +PlayerInfo.getInstance = function (playerId) { + return PlayerInfo._players[playerId] || (PlayerInfo._players[playerId] = new PlayerInfo()); +}; -module.exports = __webpack_require__(56); +exports.default = PlayerInfo; +module.exports = exports["default"]; /***/ }), /* 34 */ @@ -4973,2236 +4947,741 @@ module.exports = __webpack_require__(56); "use strict"; -module.exports = __webpack_require__(67); +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _html5_video = __webpack_require__(102); + +var _html5_video2 = _interopRequireDefault(_html5_video); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _html5_video2.default; +module.exports = exports['default']; /***/ }), /* 35 */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(global, module) {/** - * lodash (Custom Build) - * Build: `lodash modularize exports="npm" -o ./` - * Copyright jQuery Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ +module.exports = { "default": __webpack_require__(138), __esModule: true }; -/** Used as the size to enable large array optimizations. */ -var LARGE_ARRAY_SIZE = 200; - -/** Used to stand-in for `undefined` hash values. */ -var HASH_UNDEFINED = '__lodash_hash_undefined__'; - -/** Used as references for various `Number` constants. */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/** `Object#toString` result references. */ -var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - errorTag = '[object Error]', - funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - mapTag = '[object Map]', - numberTag = '[object Number]', - objectTag = '[object Object]', - promiseTag = '[object Promise]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - symbolTag = '[object Symbol]', - weakMapTag = '[object WeakMap]'; - -var arrayBufferTag = '[object ArrayBuffer]', - dataViewTag = '[object DataView]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; +/***/ }), +/* 36 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). - */ -var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - -/** Used to match `RegExp` flags from their coerced string values. */ -var reFlags = /\w*$/; - -/** Used to detect host constructors (Safari). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - -/** Used to detect unsigned integer values. */ -var reIsUint = /^(?:0|[1-9]\d*)$/; - -/** Used to identify `toStringTag` values of typed arrays. */ -var typedArrayTags = {}; -typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = -typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = -typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = -typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = -typedArrayTags[uint32Tag] = true; -typedArrayTags[argsTag] = typedArrayTags[arrayTag] = -typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = -typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = -typedArrayTags[errorTag] = typedArrayTags[funcTag] = -typedArrayTags[mapTag] = typedArrayTags[numberTag] = -typedArrayTags[objectTag] = typedArrayTags[regexpTag] = -typedArrayTags[setTag] = typedArrayTags[stringTag] = -typedArrayTags[weakMapTag] = false; - -/** Used to identify `toStringTag` values supported by `_.clone`. */ -var cloneableTags = {}; -cloneableTags[argsTag] = cloneableTags[arrayTag] = -cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = -cloneableTags[boolTag] = cloneableTags[dateTag] = -cloneableTags[float32Tag] = cloneableTags[float64Tag] = -cloneableTags[int8Tag] = cloneableTags[int16Tag] = -cloneableTags[int32Tag] = cloneableTags[mapTag] = -cloneableTags[numberTag] = cloneableTags[objectTag] = -cloneableTags[regexpTag] = cloneableTags[setTag] = -cloneableTags[stringTag] = cloneableTags[symbolTag] = -cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = -cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; -cloneableTags[errorTag] = cloneableTags[funcTag] = -cloneableTags[weakMapTag] = false; - -/** Detect free variable `global` from Node.js. */ -var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - -/** Detect free variable `self`. */ -var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - -/** Used as a reference to the global object. */ -var root = freeGlobal || freeSelf || Function('return this')(); - -/** Detect free variable `exports`. */ -var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; - -/** Detect free variable `module`. */ -var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; - -/** Detect the popular CommonJS extension `module.exports`. */ -var moduleExports = freeModule && freeModule.exports === freeExports; - -/** Detect free variable `process` from Node.js. */ -var freeProcess = moduleExports && freeGlobal.process; - -/** Used to access faster Node.js helpers. */ -var nodeUtil = (function() { - try { - return freeProcess && freeProcess.binding('util'); - } catch (e) {} -}()); +"use strict"; -/* Node.js helper references. */ -var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; -/** - * Adds the key-value `pair` to `map`. - * - * @private - * @param {Object} map The map to modify. - * @param {Array} pair The key-value pair to add. - * @returns {Object} Returns `map`. - */ -function addMapEntry(map, pair) { - // Don't return `map.set` because it's not chainable in IE 11. - map.set(pair[0], pair[1]); - return map; -} +exports.__esModule = true; -/** - * Adds `value` to `set`. - * - * @private - * @param {Object} set The set to modify. - * @param {*} value The value to add. - * @returns {Object} Returns `set`. - */ -function addSetEntry(set, value) { - // Don't return `set.add` because it's not chainable in IE 11. - set.add(value); - return set; -} +var _iterator = __webpack_require__(132); -/** - * A faster alternative to `Function#apply`, this function invokes `func` - * with the `this` binding of `thisArg` and the arguments of `args`. - * - * @private - * @param {Function} func The function to invoke. - * @param {*} thisArg The `this` binding of `func`. - * @param {Array} args The arguments to invoke `func` with. - * @returns {*} Returns the result of `func`. - */ -function apply(func, thisArg, args) { - switch (args.length) { - case 0: return func.call(thisArg); - case 1: return func.call(thisArg, args[0]); - case 2: return func.call(thisArg, args[0], args[1]); - case 3: return func.call(thisArg, args[0], args[1], args[2]); - } - return func.apply(thisArg, args); -} +var _iterator2 = _interopRequireDefault(_iterator); -/** - * A specialized version of `_.forEach` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns `array`. - */ -function arrayEach(array, iteratee) { - var index = -1, - length = array ? array.length : 0; +var _symbol = __webpack_require__(131); - while (++index < length) { - if (iteratee(array[index], index, array) === false) { - break; - } - } - return array; -} +var _symbol2 = _interopRequireDefault(_symbol); -/** - * Appends the elements of `values` to `array`. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to append. - * @returns {Array} Returns `array`. - */ -function arrayPush(array, values) { - var index = -1, - length = values.length, - offset = array.length; +var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; }; - while (++index < length) { - array[offset + index] = values[index]; - } - return array; -} +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -/** - * A specialized version of `_.reduce` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @param {boolean} [initAccum] Specify using the first element of `array` as - * the initial value. - * @returns {*} Returns the accumulated value. - */ -function arrayReduce(array, iteratee, accumulator, initAccum) { - var index = -1, - length = array ? array.length : 0; +exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) { + return typeof obj === "undefined" ? "undefined" : _typeof(obj); +} : function (obj) { + return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj); +}; - if (initAccum && length) { - accumulator = array[++index]; - } - while (++index < length) { - accumulator = iteratee(accumulator, array[index], index, array); - } - return accumulator; -} +/***/ }), +/* 37 */ +/***/ (function(module, exports) { -/** - * The base implementation of `_.times` without support for iteratee shorthands - * or max array length checks. - * - * @private - * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the array of results. - */ -function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); +var id = 0 + , px = Math.random(); +module.exports = function(key){ + return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); +}; - while (++index < n) { - result[index] = iteratee(index); - } - return result; -} +/***/ }), +/* 38 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * The base implementation of `_.unary` without support for storing metadata. - * - * @private - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new capped function. - */ -function baseUnary(func) { - return function(value) { - return func(value); - }; -} +"use strict"; -/** - * Gets the value at `key` of `object`. - * - * @private - * @param {Object} [object] The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. - */ -function getValue(object, key) { - return object == null ? undefined : object[key]; -} -/** - * Checks if `value` is a host object in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a host object, else `false`. - */ -function isHostObject(value) { - // Many host objects are `Object` objects that can coerce to strings - // despite having improperly defined `toString` methods. - var result = false; - if (value != null && typeof value.toString != 'function') { - try { - result = !!(value + ''); - } catch (e) {} - } - return result; -} +Object.defineProperty(exports, "__esModule", { + value: true +}); -/** - * Converts `map` to its key-value pairs. - * - * @private - * @param {Object} map The map to convert. - * @returns {Array} Returns the key-value pairs. - */ -function mapToArray(map) { - var index = -1, - result = Array(map.size); +var _classCallCheck2 = __webpack_require__(0); - map.forEach(function(value, key) { - result[++index] = [key, value]; - }); - return result; -} +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); -/** - * Creates a unary function that invokes `func` with its argument transformed. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. - */ -function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; -} +var _possibleConstructorReturn2 = __webpack_require__(2); -/** - * Converts `set` to an array of its values. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the values. - */ -function setToArray(set) { - var index = -1, - result = Array(set.size); +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - set.forEach(function(value) { - result[++index] = value; - }); - return result; -} +var _inherits2 = __webpack_require__(1); -/** Used for built-in method references. */ -var arrayProto = Array.prototype, - funcProto = Function.prototype, - objectProto = Object.prototype; +var _inherits3 = _interopRequireDefault(_inherits2); -/** Used to detect overreaching core-js shims. */ -var coreJsData = root['__core-js_shared__']; +var _utils = __webpack_require__(5); -/** Used to detect methods masquerading as native. */ -var maskSrcKey = (function() { - var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); - return uid ? ('Symbol(src)_1.' + uid) : ''; -}()); +var _ui_object = __webpack_require__(18); -/** Used to resolve the decompiled source of functions. */ -var funcToString = funcProto.toString; +var _ui_object2 = _interopRequireDefault(_ui_object); -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -/** Used to infer the `Object` constructor. */ -var objectCtorString = funcToString.call(Object); +var UICorePlugin = function (_UIObject) { + (0, _inherits3.default)(UICorePlugin, _UIObject); -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; - -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/** Built-in value references. */ -var Buffer = moduleExports ? root.Buffer : undefined, - Symbol = root.Symbol, - Uint8Array = root.Uint8Array, - getPrototype = overArg(Object.getPrototypeOf, Object), - objectCreate = Object.create, - propertyIsEnumerable = objectProto.propertyIsEnumerable, - splice = arrayProto.splice; - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeGetSymbols = Object.getOwnPropertySymbols, - nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, - nativeKeys = overArg(Object.keys, Object), - nativeMax = Math.max; - -/* Built-in method references that are verified to be native. */ -var DataView = getNative(root, 'DataView'), - Map = getNative(root, 'Map'), - Promise = getNative(root, 'Promise'), - Set = getNative(root, 'Set'), - WeakMap = getNative(root, 'WeakMap'), - nativeCreate = getNative(Object, 'create'); - -/** Used to detect maps, sets, and weakmaps. */ -var dataViewCtorString = toSource(DataView), - mapCtorString = toSource(Map), - promiseCtorString = toSource(Promise), - setCtorString = toSource(Set), - weakMapCtorString = toSource(WeakMap); - -/** Used to convert symbols to primitives and strings. */ -var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; + function UICorePlugin(core) { + (0, _classCallCheck3.default)(this, UICorePlugin); -/** - * Creates a hash object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function Hash(entries) { - var index = -1, - length = entries ? entries.length : 0; + var _this = (0, _possibleConstructorReturn3.default)(this, _UIObject.call(this, core.options)); - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); + _this.core = core; + _this.enabled = true; + _this.bindEvents(); + _this.render(); + return _this; } -} -/** - * Removes all key-value entries from the hash. - * - * @private - * @name clear - * @memberOf Hash - */ -function hashClear() { - this.__data__ = nativeCreate ? nativeCreate(null) : {}; -} + UICorePlugin.prototype.bindEvents = function bindEvents() {}; -/** - * Removes `key` and its value from the hash. - * - * @private - * @name delete - * @memberOf Hash - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function hashDelete(key) { - return this.has(key) && delete this.__data__[key]; -} + UICorePlugin.prototype.getExternalInterface = function getExternalInterface() { + return {}; + }; -/** - * Gets the hash value for `key`. - * - * @private - * @name get - * @memberOf Hash - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function hashGet(key) { - var data = this.__data__; - if (nativeCreate) { - var result = data[key]; - return result === HASH_UNDEFINED ? undefined : result; - } - return hasOwnProperty.call(data, key) ? data[key] : undefined; -} + UICorePlugin.prototype.enable = function enable() { + if (!this.enabled) { + this.bindEvents(); + this.$el.show(); + this.enabled = true; + } + }; -/** - * Checks if a hash value for `key` exists. - * - * @private - * @name has - * @memberOf Hash - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function hashHas(key) { - var data = this.__data__; - return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); -} + UICorePlugin.prototype.disable = function disable() { + this.stopListening(); + this.$el.hide(); + this.enabled = false; + }; -/** - * Sets the hash `key` to `value`. - * - * @private - * @name set - * @memberOf Hash - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the hash instance. - */ -function hashSet(key, value) { - var data = this.__data__; - data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; - return this; -} + UICorePlugin.prototype.destroy = function destroy() { + this.remove(); + }; -// Add methods to `Hash`. -Hash.prototype.clear = hashClear; -Hash.prototype['delete'] = hashDelete; -Hash.prototype.get = hashGet; -Hash.prototype.has = hashHas; -Hash.prototype.set = hashSet; + UICorePlugin.prototype.render = function render() { + return this; + }; -/** - * Creates an list cache object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function ListCache(entries) { - var index = -1, - length = entries ? entries.length : 0; + return UICorePlugin; +}(_ui_object2.default); - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } -} +exports.default = UICorePlugin; -/** - * Removes all key-value entries from the list cache. - * - * @private - * @name clear - * @memberOf ListCache - */ -function listCacheClear() { - this.__data__ = []; -} -/** - * Removes `key` and its value from the list cache. - * - * @private - * @name delete - * @memberOf ListCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function listCacheDelete(key) { - var data = this.__data__, - index = assocIndexOf(data, key); +UICorePlugin.extend = function (properties) { + return (0, _utils.extend)(UICorePlugin, properties); +}; - if (index < 0) { - return false; - } - var lastIndex = data.length - 1; - if (index == lastIndex) { - data.pop(); - } else { - splice.call(data, index, 1); - } - return true; -} +UICorePlugin.type = 'core'; +module.exports = exports['default']; -/** - * Gets the list cache value for `key`. - * - * @private - * @name get - * @memberOf ListCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function listCacheGet(key) { - var data = this.__data__, - index = assocIndexOf(data, key); +/***/ }), +/* 39 */ +/***/ (function(module, exports, __webpack_require__) { - return index < 0 ? undefined : data[index][1]; -} +"use strict"; -/** - * Checks if a list cache value for `key` exists. - * - * @private - * @name has - * @memberOf ListCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function listCacheHas(key) { - return assocIndexOf(this.__data__, key) > -1; -} -/** - * Sets the list cache `key` to `value`. - * - * @private - * @name set - * @memberOf ListCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the list cache instance. - */ -function listCacheSet(key, value) { - var data = this.__data__, - index = assocIndexOf(data, key); +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = __webpack_require__(96); +module.exports = exports['default']; - if (index < 0) { - data.push([key, value]); - } else { - data[index][1] = value; - } - return this; -} +/***/ }), +/* 40 */ +/***/ (function(module, exports, __webpack_require__) { -// Add methods to `ListCache`. -ListCache.prototype.clear = listCacheClear; -ListCache.prototype['delete'] = listCacheDelete; -ListCache.prototype.get = listCacheGet; -ListCache.prototype.has = listCacheHas; -ListCache.prototype.set = listCacheSet; +"use strict"; -/** - * Creates a map cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function MapCache(entries) { - var index = -1, - length = entries ? entries.length : 0; - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } -} +Object.defineProperty(exports, "__esModule", { + value: true +}); -/** - * Removes all key-value entries from the map. - * - * @private - * @name clear - * @memberOf MapCache - */ -function mapCacheClear() { - this.__data__ = { - 'hash': new Hash, - 'map': new (Map || ListCache), - 'string': new Hash - }; -} +var _log = __webpack_require__(114); -/** - * Removes `key` and its value from the map. - * - * @private - * @name delete - * @memberOf MapCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function mapCacheDelete(key) { - return getMapData(this, key)['delete'](key); -} +var _log2 = _interopRequireDefault(_log); -/** - * Gets the map value for `key`. - * - * @private - * @name get - * @memberOf MapCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function mapCacheGet(key) { - return getMapData(this, key).get(key); -} +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -/** - * Checks if a map value for `key` exists. - * - * @private - * @name has - * @memberOf MapCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function mapCacheHas(key) { - return getMapData(this, key).has(key); -} +exports.default = _log2.default; +module.exports = exports['default']; -/** - * Sets the map `key` to `value`. - * - * @private - * @name set - * @memberOf MapCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the map cache instance. - */ -function mapCacheSet(key, value) { - getMapData(this, key).set(key, value); - return this; -} +/***/ }), +/* 41 */ +/***/ (function(module, exports, __webpack_require__) { -// Add methods to `MapCache`. -MapCache.prototype.clear = mapCacheClear; -MapCache.prototype['delete'] = mapCacheDelete; -MapCache.prototype.get = mapCacheGet; -MapCache.prototype.has = mapCacheHas; -MapCache.prototype.set = mapCacheSet; +"use strict"; -/** - * Creates a stack cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function Stack(entries) { - this.__data__ = new ListCache(entries); -} -/** - * Removes all key-value entries from the stack. - * - * @private - * @name clear - * @memberOf Stack - */ -function stackClear() { - this.__data__ = new ListCache; -} +Object.defineProperty(exports, "__esModule", { + value: true +}); -/** - * Removes `key` and its value from the stack. - * - * @private - * @name delete - * @memberOf Stack - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function stackDelete(key) { - return this.__data__['delete'](key); -} +var _kibo = __webpack_require__(126); -/** - * Gets the stack value for `key`. - * - * @private - * @name get - * @memberOf Stack - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function stackGet(key) { - return this.__data__.get(key); -} +var _kibo2 = _interopRequireDefault(_kibo); -/** - * Checks if a stack value for `key` exists. - * - * @private - * @name has - * @memberOf Stack - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function stackHas(key) { - return this.__data__.has(key); -} +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -/** - * Sets the stack `key` to `value`. - * - * @private - * @name set - * @memberOf Stack - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the stack cache instance. - */ -function stackSet(key, value) { - var cache = this.__data__; - if (cache instanceof ListCache) { - var pairs = cache.__data__; - if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { - pairs.push([key, value]); - return this; - } - cache = this.__data__ = new MapCache(pairs); - } - cache.set(key, value); - return this; -} +exports.default = { Kibo: _kibo2.default }; +module.exports = exports['default']; -// Add methods to `Stack`. -Stack.prototype.clear = stackClear; -Stack.prototype['delete'] = stackDelete; -Stack.prototype.get = stackGet; -Stack.prototype.has = stackHas; -Stack.prototype.set = stackSet; +/***/ }), +/* 42 */ +/***/ (function(module, exports) { -/** - * Creates an array of the enumerable property names of the array-like `value`. - * - * @private - * @param {*} value The value to query. - * @param {boolean} inherited Specify returning inherited property names. - * @returns {Array} Returns the array of property names. - */ -function arrayLikeKeys(value, inherited) { - // Safari 8.1 makes `arguments.callee` enumerable in strict mode. - // Safari 9 makes `arguments.length` enumerable in strict mode. - var result = (isArray(value) || isArguments(value)) - ? baseTimes(value.length, String) - : []; +var toString = {}.toString; - var length = result.length, - skipIndexes = !!length; +module.exports = function(it){ + return toString.call(it).slice(8, -1); +}; - for (var key in value) { - if ((inherited || hasOwnProperty.call(value, key)) && - !(skipIndexes && (key == 'length' || isIndex(key, length)))) { - result.push(key); - } - } - return result; -} +/***/ }), +/* 43 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * This function is like `assignValue` except that it doesn't assign - * `undefined` values. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ -function assignMergeValue(object, key, value) { - if ((value !== undefined && !eq(object[key], value)) || - (typeof key == 'number' && value === undefined && !(key in object))) { - object[key] = value; +// optional / simple context binding +var aFunction = __webpack_require__(142); +module.exports = function(fn, that, length){ + aFunction(fn); + if(that === undefined)return fn; + switch(length){ + case 1: return function(a){ + return fn.call(that, a); + }; + case 2: return function(a, b){ + return fn.call(that, a, b); + }; + case 3: return function(a, b, c){ + return fn.call(that, a, b, c); + }; } -} + return function(/* ...args */){ + return fn.apply(that, arguments); + }; +}; -/** - * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ -function assignValue(object, key, value) { - var objValue = object[key]; - if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || - (value === undefined && !(key in object))) { - object[key] = value; - } -} +/***/ }), +/* 44 */ +/***/ (function(module, exports) { -/** - * Gets the index at which the `key` is found in `array` of key-value pairs. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} key The key to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - */ -function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq(array[length][0], key)) { - return length; - } - } - return -1; -} +// 7.2.1 RequireObjectCoercible(argument) +module.exports = function(it){ + if(it == undefined)throw TypeError("Can't call method on " + it); + return it; +}; -/** - * The base implementation of `_.assign` without support for multiple sources - * or `customizer` functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. - */ -function baseAssign(object, source) { - return object && copyObject(source, keys(source), object); -} +/***/ }), +/* 45 */ +/***/ (function(module, exports) { -/** - * The base implementation of `_.clone` and `_.cloneDeep` which tracks - * traversed objects. - * - * @private - * @param {*} value The value to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @param {boolean} [isFull] Specify a clone including symbols. - * @param {Function} [customizer] The function to customize cloning. - * @param {string} [key] The key of `value`. - * @param {Object} [object] The parent object of `value`. - * @param {Object} [stack] Tracks traversed objects and their clone counterparts. - * @returns {*} Returns the cloned value. - */ -function baseClone(value, isDeep, isFull, customizer, key, object, stack) { - var result; - if (customizer) { - result = object ? customizer(value, key, object, stack) : customizer(value); - } - if (result !== undefined) { - return result; - } - if (!isObject(value)) { - return value; - } - var isArr = isArray(value); - if (isArr) { - result = initCloneArray(value); - if (!isDeep) { - return copyArray(value, result); - } - } else { - var tag = getTag(value), - isFunc = tag == funcTag || tag == genTag; +// IE 8- don't enum bug keys +module.exports = ( + 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' +).split(','); - if (isBuffer(value)) { - return cloneBuffer(value, isDeep); - } - if (tag == objectTag || tag == argsTag || (isFunc && !object)) { - if (isHostObject(value)) { - return object ? value : {}; - } - result = initCloneObject(isFunc ? {} : value); - if (!isDeep) { - return copySymbols(value, baseAssign(result, value)); - } - } else { - if (!cloneableTags[tag]) { - return object ? value : {}; - } - result = initCloneByTag(value, tag, baseClone, isDeep); - } - } - // Check for circular references and return its corresponding clone. - stack || (stack = new Stack); - var stacked = stack.get(value); - if (stacked) { - return stacked; - } - stack.set(value, result); +/***/ }), +/* 46 */ +/***/ (function(module, exports) { - if (!isArr) { - var props = isFull ? getAllKeys(value) : keys(value); - } - arrayEach(props || value, function(subValue, key) { - if (props) { - key = subValue; - subValue = value[key]; - } - // Recursively populate clone (susceptible to call stack limits). - assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack)); - }); - return result; -} +module.exports = true; -/** - * The base implementation of `_.create` without support for assigning - * properties to the created object. - * - * @private - * @param {Object} prototype The object to inherit from. - * @returns {Object} Returns the new object. - */ -function baseCreate(proto) { - return isObject(proto) ? objectCreate(proto) : {}; -} +/***/ }), +/* 47 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * The base implementation of `getAllKeys` and `getAllKeysIn` which uses - * `keysFunc` and `symbolsFunc` to get the enumerable property names and - * symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Function} keysFunc The function to get the keys of `object`. - * @param {Function} symbolsFunc The function to get the symbols of `object`. - * @returns {Array} Returns the array of property names and symbols. - */ -function baseGetAllKeys(object, keysFunc, symbolsFunc) { - var result = keysFunc(object); - return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); -} +// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) +var anObject = __webpack_require__(23) + , dPs = __webpack_require__(158) + , enumBugKeys = __webpack_require__(45) + , IE_PROTO = __webpack_require__(51)('IE_PROTO') + , Empty = function(){ /* empty */ } + , PROTOTYPE = 'prototype'; + +// Create object with fake `null` prototype: use iframe Object with cleared prototype +var createDict = function(){ + // Thrash, waste and sodomy: IE GC bug + var iframe = __webpack_require__(74)('iframe') + , i = enumBugKeys.length + , lt = '<' + , gt = '>' + , iframeDocument; + iframe.style.display = 'none'; + __webpack_require__(148).appendChild(iframe); + iframe.src = 'javascript:'; // eslint-disable-line no-script-url + // createDict = iframe.contentWindow.Object; + // html.removeChild(iframe); + iframeDocument = iframe.contentWindow.document; + iframeDocument.open(); + iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); + iframeDocument.close(); + createDict = iframeDocument.F; + while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]]; + return createDict(); +}; -/** - * The base implementation of `getTag`. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ -function baseGetTag(value) { - return objectToString.call(value); -} +module.exports = Object.create || function create(O, Properties){ + var result; + if(O !== null){ + Empty[PROTOTYPE] = anObject(O); + result = new Empty; + Empty[PROTOTYPE] = null; + // add "__proto__" for Object.getPrototypeOf polyfill + result[IE_PROTO] = O; + } else result = createDict(); + return Properties === undefined ? result : dPs(result, Properties); +}; -/** - * The base implementation of `_.isNative` without bad shim checks. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. - */ -function baseIsNative(value) { - if (!isObject(value) || isMasked(value)) { - return false; - } - var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); -} -/** - * The base implementation of `_.isTypedArray` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - */ -function baseIsTypedArray(value) { - return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; -} +/***/ }), +/* 48 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ -function baseKeys(object) { - if (!isPrototype(object)) { - return nativeKeys(object); - } - var result = []; - for (var key in Object(object)) { - if (hasOwnProperty.call(object, key) && key != 'constructor') { - result.push(key); - } - } - return result; -} +var pIE = __webpack_require__(49) + , createDesc = __webpack_require__(30) + , toIObject = __webpack_require__(17) + , toPrimitive = __webpack_require__(55) + , has = __webpack_require__(21) + , IE8_DOM_DEFINE = __webpack_require__(75) + , gOPD = Object.getOwnPropertyDescriptor; + +exports.f = __webpack_require__(19) ? gOPD : function getOwnPropertyDescriptor(O, P){ + O = toIObject(O); + P = toPrimitive(P, true); + if(IE8_DOM_DEFINE)try { + return gOPD(O, P); + } catch(e){ /* empty */ } + if(has(O, P))return createDesc(!pIE.f.call(O, P), O[P]); +}; -/** - * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ -function baseKeysIn(object) { - if (!isObject(object)) { - return nativeKeysIn(object); - } - var isProto = isPrototype(object), - result = []; +/***/ }), +/* 49 */ +/***/ (function(module, exports) { - for (var key in object) { - if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { - result.push(key); - } - } - return result; -} +exports.f = {}.propertyIsEnumerable; -/** - * The base implementation of `_.merge` without support for multiple sources. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {number} srcIndex The index of `source`. - * @param {Function} [customizer] The function to customize merged values. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. - */ -function baseMerge(object, source, srcIndex, customizer, stack) { - if (object === source) { - return; - } - if (!(isArray(source) || isTypedArray(source))) { - var props = baseKeysIn(source); - } - arrayEach(props || source, function(srcValue, key) { - if (props) { - key = srcValue; - srcValue = source[key]; - } - if (isObject(srcValue)) { - stack || (stack = new Stack); - baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); - } - else { - var newValue = customizer - ? customizer(object[key], srcValue, (key + ''), object, source, stack) - : undefined; +/***/ }), +/* 50 */ +/***/ (function(module, exports, __webpack_require__) { - if (newValue === undefined) { - newValue = srcValue; - } - assignMergeValue(object, key, newValue); - } - }); -} +var def = __webpack_require__(16).f + , has = __webpack_require__(21) + , TAG = __webpack_require__(12)('toStringTag'); -/** - * A specialized version of `baseMerge` for arrays and objects which performs - * deep merges and tracks traversed objects enabling objects with circular - * references to be merged. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {string} key The key of the value to merge. - * @param {number} srcIndex The index of `source`. - * @param {Function} mergeFunc The function to merge values. - * @param {Function} [customizer] The function to customize assigned values. - * @param {Object} [stack] Tracks traversed source values and their merged - * counterparts. - */ -function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { - var objValue = object[key], - srcValue = source[key], - stacked = stack.get(srcValue); - - if (stacked) { - assignMergeValue(object, key, stacked); - return; - } - var newValue = customizer - ? customizer(objValue, srcValue, (key + ''), object, source, stack) - : undefined; +module.exports = function(it, tag, stat){ + if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag}); +}; - var isCommon = newValue === undefined; +/***/ }), +/* 51 */ +/***/ (function(module, exports, __webpack_require__) { - if (isCommon) { - newValue = srcValue; - if (isArray(srcValue) || isTypedArray(srcValue)) { - if (isArray(objValue)) { - newValue = objValue; - } - else if (isArrayLikeObject(objValue)) { - newValue = copyArray(objValue); - } - else { - isCommon = false; - newValue = baseClone(srcValue, true); - } - } - else if (isPlainObject(srcValue) || isArguments(srcValue)) { - if (isArguments(objValue)) { - newValue = toPlainObject(objValue); - } - else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) { - isCommon = false; - newValue = baseClone(srcValue, true); - } - else { - newValue = objValue; - } - } - else { - isCommon = false; - } - } - if (isCommon) { - // Recursively merge objects and arrays (susceptible to call stack limits). - stack.set(srcValue, newValue); - mergeFunc(newValue, srcValue, srcIndex, customizer, stack); - stack['delete'](srcValue); - } - assignMergeValue(object, key, newValue); -} +var shared = __webpack_require__(52)('keys') + , uid = __webpack_require__(37); +module.exports = function(key){ + return shared[key] || (shared[key] = uid(key)); +}; -/** - * The base implementation of `_.rest` which doesn't validate or coerce arguments. - * - * @private - * @param {Function} func The function to apply a rest parameter to. - * @param {number} [start=func.length-1] The start position of the rest parameter. - * @returns {Function} Returns the new function. - */ -function baseRest(func, start) { - start = nativeMax(start === undefined ? (func.length - 1) : start, 0); - return function() { - var args = arguments, - index = -1, - length = nativeMax(args.length - start, 0), - array = Array(length); +/***/ }), +/* 52 */ +/***/ (function(module, exports, __webpack_require__) { - while (++index < length) { - array[index] = args[start + index]; - } - index = -1; - var otherArgs = Array(start + 1); - while (++index < start) { - otherArgs[index] = args[index]; - } - otherArgs[start] = array; - return apply(func, this, otherArgs); - }; -} +var global = __webpack_require__(15) + , SHARED = '__core-js_shared__' + , store = global[SHARED] || (global[SHARED] = {}); +module.exports = function(key){ + return store[key] || (store[key] = {}); +}; -/** - * Creates a clone of `buffer`. - * - * @private - * @param {Buffer} buffer The buffer to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Buffer} Returns the cloned buffer. - */ -function cloneBuffer(buffer, isDeep) { - if (isDeep) { - return buffer.slice(); - } - var result = new buffer.constructor(buffer.length); - buffer.copy(result); - return result; -} +/***/ }), +/* 53 */ +/***/ (function(module, exports) { -/** - * Creates a clone of `arrayBuffer`. - * - * @private - * @param {ArrayBuffer} arrayBuffer The array buffer to clone. - * @returns {ArrayBuffer} Returns the cloned array buffer. - */ -function cloneArrayBuffer(arrayBuffer) { - var result = new arrayBuffer.constructor(arrayBuffer.byteLength); - new Uint8Array(result).set(new Uint8Array(arrayBuffer)); - return result; -} +// 7.1.4 ToInteger +var ceil = Math.ceil + , floor = Math.floor; +module.exports = function(it){ + return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); +}; -/** - * Creates a clone of `dataView`. - * - * @private - * @param {Object} dataView The data view to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned data view. - */ -function cloneDataView(dataView, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; - return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); -} +/***/ }), +/* 54 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * Creates a clone of `map`. - * - * @private - * @param {Object} map The map to clone. - * @param {Function} cloneFunc The function to clone values. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned map. - */ -function cloneMap(map, isDeep, cloneFunc) { - var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map); - return arrayReduce(array, addMapEntry, new map.constructor); -} +// 7.1.13 ToObject(argument) +var defined = __webpack_require__(44); +module.exports = function(it){ + return Object(defined(it)); +}; -/** - * Creates a clone of `regexp`. - * - * @private - * @param {Object} regexp The regexp to clone. - * @returns {Object} Returns the cloned regexp. - */ -function cloneRegExp(regexp) { - var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); - result.lastIndex = regexp.lastIndex; - return result; -} +/***/ }), +/* 55 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * Creates a clone of `set`. - * - * @private - * @param {Object} set The set to clone. - * @param {Function} cloneFunc The function to clone values. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned set. - */ -function cloneSet(set, isDeep, cloneFunc) { - var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set); - return arrayReduce(array, addSetEntry, new set.constructor); -} +// 7.1.1 ToPrimitive(input [, PreferredType]) +var isObject = __webpack_require__(27); +// instead of the ES6 spec version, we didn't implement @@toPrimitive case +// and the second argument - flag - preferred type is a string +module.exports = function(it, S){ + if(!isObject(it))return it; + var fn, val; + if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; + if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val; + if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val; + throw TypeError("Can't convert object to primitive value"); +}; -/** - * Creates a clone of the `symbol` object. - * - * @private - * @param {Object} symbol The symbol object to clone. - * @returns {Object} Returns the cloned symbol object. - */ -function cloneSymbol(symbol) { - return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; -} +/***/ }), +/* 56 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * Creates a clone of `typedArray`. - * - * @private - * @param {Object} typedArray The typed array to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned typed array. - */ -function cloneTypedArray(typedArray, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; - return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); -} +var global = __webpack_require__(15) + , core = __webpack_require__(10) + , LIBRARY = __webpack_require__(46) + , wksExt = __webpack_require__(57) + , defineProperty = __webpack_require__(16).f; +module.exports = function(name){ + var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); + if(name.charAt(0) != '_' && !(name in $Symbol))defineProperty($Symbol, name, {value: wksExt.f(name)}); +}; -/** - * Copies the values of `source` to `array`. - * - * @private - * @param {Array} source The array to copy values from. - * @param {Array} [array=[]] The array to copy values to. - * @returns {Array} Returns `array`. - */ -function copyArray(source, array) { - var index = -1, - length = source.length; +/***/ }), +/* 57 */ +/***/ (function(module, exports, __webpack_require__) { - array || (array = Array(length)); - while (++index < length) { - array[index] = source[index]; - } - return array; -} +exports.f = __webpack_require__(12); -/** - * Copies properties of `source` to `object`. - * - * @private - * @param {Object} source The object to copy properties from. - * @param {Array} props The property identifiers to copy. - * @param {Object} [object={}] The object to copy properties to. - * @param {Function} [customizer] The function to customize copied values. - * @returns {Object} Returns `object`. - */ -function copyObject(source, props, object, customizer) { - object || (object = {}); +/***/ }), +/* 58 */ +/***/ (function(module, exports) { - var index = -1, - length = props.length; +// shim for using process in browser +var process = module.exports = {}; - while (++index < length) { - var key = props[index]; +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. - var newValue = customizer - ? customizer(object[key], source[key], key, object, source) - : undefined; +var cachedSetTimeout; +var cachedClearTimeout; - assignValue(object, key, newValue === undefined ? source[key] : newValue); - } - return object; +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); } - -/** - * Copies own symbol properties of `source` to `object`. - * - * @private - * @param {Object} source The object to copy symbols from. - * @param {Object} [object={}] The object to copy symbols to. - * @returns {Object} Returns `object`. - */ -function copySymbols(source, object) { - return copyObject(source, getSymbols(source), object); +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); } +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } -/** - * Creates a function like `_.assign`. - * - * @private - * @param {Function} assigner The function to assign values. - * @returns {Function} Returns the new assigner function. - */ -function createAssigner(assigner) { - return baseRest(function(object, sources) { - var index = -1, - length = sources.length, - customizer = length > 1 ? sources[length - 1] : undefined, - guard = length > 2 ? sources[2] : undefined; - - customizer = (assigner.length > 3 && typeof customizer == 'function') - ? (length--, customizer) - : undefined; - if (guard && isIterateeCall(sources[0], sources[1], guard)) { - customizer = length < 3 ? undefined : customizer; - length = 1; +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); } - object = Object(object); - while (++index < length) { - var source = sources[index]; - if (source) { - assigner(object, source, index, customizer); - } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } } - return object; - }); -} -/** - * Creates an array of own enumerable property names and symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names and symbols. - */ -function getAllKeys(object) { - return baseGetAllKeys(object, keys, getSymbols); -} -/** - * Gets the data for `map`. - * - * @private - * @param {Object} map The map to query. - * @param {string} key The reference key. - * @returns {*} Returns the map data. - */ -function getMapData(map, key) { - var data = map.__data__; - return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; -} -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = getValue(object, key); - return baseIsNative(value) ? value : undefined; } +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; -/** - * Creates an array of the own enumerable symbol properties of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of symbols. - */ -var getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray; - -/** - * Gets the `toStringTag` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ -var getTag = baseGetTag; - -// Fallback for data views, maps, sets, and weak maps in IE 11, -// for data views in Edge < 14, and promises in Node.js. -if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || - (Map && getTag(new Map) != mapTag) || - (Promise && getTag(Promise.resolve()) != promiseTag) || - (Set && getTag(new Set) != setTag) || - (WeakMap && getTag(new WeakMap) != weakMapTag)) { - getTag = function(value) { - var result = objectToString.call(value), - Ctor = result == objectTag ? value.constructor : undefined, - ctorString = Ctor ? toSource(Ctor) : undefined; - - if (ctorString) { - switch (ctorString) { - case dataViewCtorString: return dataViewTag; - case mapCtorString: return mapTag; - case promiseCtorString: return promiseTag; - case setCtorString: return setTag; - case weakMapCtorString: return weakMapTag; - } +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); } - return result; - }; } -/** - * Initializes an array clone. - * - * @private - * @param {Array} array The array to clone. - * @returns {Array} Returns the initialized clone. - */ -function initCloneArray(array) { - var length = array.length, - result = array.constructor(length); +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; - // Add properties assigned by `RegExp#exec`. - if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { - result.index = array.index; - result.input = array.input; - } - return result; + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); } -/** - * Initializes an object clone. - * - * @private - * @param {Object} object The object to clone. - * @returns {Object} Returns the initialized clone. - */ -function initCloneObject(object) { - return (typeof object.constructor == 'function' && !isPrototype(object)) - ? baseCreate(getPrototype(object)) - : {}; +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; } +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; -/** - * Initializes an object clone based on its `toStringTag`. - * - * **Note:** This function only supports cloning values with tags of - * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. - * - * @private - * @param {Object} object The object to clone. - * @param {string} tag The `toStringTag` of the object to clone. - * @param {Function} cloneFunc The function to clone values. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the initialized clone. - */ -function initCloneByTag(object, tag, cloneFunc, isDeep) { - var Ctor = object.constructor; - switch (tag) { - case arrayBufferTag: - return cloneArrayBuffer(object); +function noop() {} - case boolTag: - case dateTag: - return new Ctor(+object); +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; - case dataViewTag: - return cloneDataView(object, isDeep); +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; - case float32Tag: case float64Tag: - case int8Tag: case int16Tag: case int32Tag: - case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: - return cloneTypedArray(object, isDeep); +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; - case mapTag: - return cloneMap(object, isDeep, cloneFunc); - case numberTag: - case stringTag: - return new Ctor(object); +/***/ }), +/* 59 */ +/***/ (function(module, exports) { - case regexpTag: - return cloneRegExp(object); +module.exports = "" - case setTag: - return cloneSet(object, isDeep, cloneFunc); +/***/ }), +/* 60 */ +/***/ (function(module, exports, __webpack_require__) { - case symbolTag: - return cloneSymbol(object); - } -} +"use strict"; -/** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ -function isIndex(value, length) { - length = length == null ? MAX_SAFE_INTEGER : length; - return !!length && - (typeof value == 'number' || reIsUint.test(value)) && - (value > -1 && value % 1 == 0 && value < length); -} -/** - * Checks if the given arguments are from an iteratee call. - * - * @private - * @param {*} value The potential iteratee value argument. - * @param {*} index The potential iteratee index or key argument. - * @param {*} object The potential iteratee object argument. - * @returns {boolean} Returns `true` if the arguments are from an iteratee call, - * else `false`. - */ -function isIterateeCall(value, index, object) { - if (!isObject(object)) { - return false; - } - var type = typeof index; - if (type == 'number' - ? (isArrayLike(object) && isIndex(index, object.length)) - : (type == 'string' && index in object) - ) { - return eq(object[index], value); - } - return false; -} +Object.defineProperty(exports, "__esModule", { + value: true +}); -/** - * Checks if `value` is suitable for use as unique object key. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is suitable, else `false`. - */ -function isKeyable(value) { - var type = typeof value; - return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); -} +var _container = __webpack_require__(87); -/** - * Checks if `func` has its source masked. - * - * @private - * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` is masked, else `false`. - */ -function isMasked(func) { - return !!maskSrcKey && (maskSrcKey in func); -} +var _container2 = _interopRequireDefault(_container); -/** - * Checks if `value` is likely a prototype object. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. - */ -function isPrototype(value) { - var Ctor = value && value.constructor, - proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - return value === proto; -} +exports.default = _container2.default; +module.exports = exports['default']; -/** - * This function is like - * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * except that it includes inherited enumerable properties. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ -function nativeKeysIn(object) { - var result = []; - if (object != null) { - for (var key in Object(object)) { - result.push(key); - } - } - return result; -} +/***/ }), +/* 61 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * Converts `func` to its source code. - * - * @private - * @param {Function} func The function to process. - * @returns {string} Returns the source code. - */ -function toSource(func) { - if (func != null) { - try { - return funcToString.call(func); - } catch (e) {} - try { - return (func + ''); - } catch (e) {} - } - return ''; -} +"use strict"; -/** - * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * comparison between two values to determine if they are equivalent. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.eq(object, object); - * // => true - * - * _.eq(object, other); - * // => false - * - * _.eq('a', 'a'); - * // => true - * - * _.eq('a', Object('a')); - * // => false - * - * _.eq(NaN, NaN); - * // => true - */ -function eq(value, other) { - return value === other || (value !== value && other !== other); -} -/** - * Checks if `value` is likely an `arguments` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - * else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ -function isArguments(value) { - // Safari 8.1 makes `arguments.callee` enumerable in strict mode. - return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && - (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); -} +Object.defineProperty(exports, "__esModule", { + value: true +}); -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; +var _core = __webpack_require__(90); -/** - * Checks if `value` is array-like. A value is considered array-like if it's - * not a function and has a `value.length` that's an integer greater than or - * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - * @example - * - * _.isArrayLike([1, 2, 3]); - * // => true - * - * _.isArrayLike(document.body.children); - * // => true - * - * _.isArrayLike('abc'); - * // => true - * - * _.isArrayLike(_.noop); - * // => false - */ -function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); -} +var _core2 = _interopRequireDefault(_core); -/** - * This method is like `_.isArrayLike` except that it also checks if `value` - * is an object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array-like object, - * else `false`. - * @example - * - * _.isArrayLikeObject([1, 2, 3]); - * // => true - * - * _.isArrayLikeObject(document.body.children); - * // => true - * - * _.isArrayLikeObject('abc'); - * // => false - * - * _.isArrayLikeObject(_.noop); - * // => false - */ -function isArrayLikeObject(value) { - return isObjectLike(value) && isArrayLike(value); -} +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -/** - * Checks if `value` is a buffer. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. - * @example - * - * _.isBuffer(new Buffer(2)); - * // => true - * - * _.isBuffer(new Uint8Array(2)); - * // => false - */ -var isBuffer = nativeIsBuffer || stubFalse; +exports.default = _core2.default; +module.exports = exports['default']; -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8-9 which returns 'object' for typed array and other constructors. - var tag = isObject(value) ? objectToString.call(value) : ''; - return tag == funcTag || tag == genTag; -} +/***/ }), +/* 62 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * Checks if `value` is a valid array-like length. - * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - * @example - * - * _.isLength(3); - * // => true - * - * _.isLength(Number.MIN_VALUE); - * // => false - * - * _.isLength(Infinity); - * // => false - * - * _.isLength('3'); - * // => false - */ -function isLength(value) { - return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; -} +"use strict"; -/** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} +Object.defineProperty(exports, "__esModule", { + value: true +}); -/** - * Checks if `value` is a plain object, that is, an object created by the - * `Object` constructor or one with a `[[Prototype]]` of `null`. - * - * @static - * @memberOf _ - * @since 0.8.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * _.isPlainObject(new Foo); - * // => false - * - * _.isPlainObject([1, 2, 3]); - * // => false - * - * _.isPlainObject({ 'x': 0, 'y': 0 }); - * // => true - * - * _.isPlainObject(Object.create(null)); - * // => true - */ -function isPlainObject(value) { - if (!isObjectLike(value) || - objectToString.call(value) != objectTag || isHostObject(value)) { - return false; - } - var proto = getPrototype(value); - if (proto === null) { - return true; - } - var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; - return (typeof Ctor == 'function' && - Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString); -} +var _loader = __webpack_require__(93); -/** - * Checks if `value` is classified as a typed array. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - * @example - * - * _.isTypedArray(new Uint8Array); - * // => true - * - * _.isTypedArray([]); - * // => false - */ -var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; +var _loader2 = _interopRequireDefault(_loader); -/** - * Converts `value` to a plain object flattening inherited enumerable string - * keyed properties of `value` to own properties of the plain object. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {Object} Returns the converted plain object. - * @example - * - * function Foo() { - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.assign({ 'a': 1 }, new Foo); - * // => { 'a': 1, 'b': 2 } - * - * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); - * // => { 'a': 1, 'b': 2, 'c': 3 } - */ -function toPlainObject(value) { - return copyObject(value, keysIn(value)); -} +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -/** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * for more details. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) - * - * _.keys('hi'); - * // => ['0', '1'] - */ -function keys(object) { - return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); -} +exports.default = _loader2.default; +module.exports = exports['default']; -/** - * Creates an array of the own and inherited enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keysIn(new Foo); - * // => ['a', 'b', 'c'] (iteration order is not guaranteed) - */ -function keysIn(object) { - return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); -} +/***/ }), +/* 63 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * This method is like `_.assign` except that it recursively merges own and - * inherited enumerable string keyed properties of source objects into the - * destination object. Source properties that resolve to `undefined` are - * skipped if a destination value exists. Array and plain object properties - * are merged recursively. Other objects and value types are overridden by - * assignment. Source objects are applied from left to right. Subsequent - * sources overwrite property assignments of previous sources. - * - * **Note:** This method mutates `object`. - * - * @static - * @memberOf _ - * @since 0.5.0 - * @category Object - * @param {Object} object The destination object. - * @param {...Object} [sources] The source objects. - * @returns {Object} Returns `object`. - * @example - * - * var object = { - * 'a': [{ 'b': 2 }, { 'd': 4 }] - * }; - * - * var other = { - * 'a': [{ 'c': 3 }, { 'e': 5 }] - * }; - * - * _.merge(object, other); - * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } - */ -var merge = createAssigner(function(object, source, srcIndex) { - baseMerge(object, source, srcIndex); +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true }); -/** - * This method returns a new empty array. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {Array} Returns the new empty array. - * @example - * - * var arrays = _.times(2, _.stubArray); - * - * console.log(arrays); - * // => [[], []] - * - * console.log(arrays[0] === arrays[1]); - * // => false - */ -function stubArray() { - return []; -} +var _media_control = __webpack_require__(94); -/** - * This method returns `false`. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {boolean} Returns `false`. - * @example - * - * _.times(2, _.stubFalse); - * // => [false, false] - */ -function stubFalse() { - return false; -} +var _media_control2 = _interopRequireDefault(_media_control); -module.exports = merge; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(12), __webpack_require__(23)(module))) +exports.default = _media_control2.default; +module.exports = exports['default']; /***/ }), -/* 36 */ -/***/ (function(module, exports) { +/* 64 */ +/***/ (function(module, exports, __webpack_require__) { -module.exports = "" +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _flash = __webpack_require__(97); + +var _flash2 = _interopRequireDefault(_flash); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _flash2.default; +module.exports = exports['default']; /***/ }), -/* 37 */ +/* 65 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = __webpack_require__.p + "a8c874b93b3d848f39a71260c57e3863.cur"; +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _flashls = __webpack_require__(98); + +var _flashls2 = _interopRequireDefault(_flashls); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _flashls2.default; +module.exports = exports['default']; /***/ }), -/* 38 */ +/* 66 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -7212,1191 +5691,1030 @@ Object.defineProperty(exports, "__esModule", { value: 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 _hls = __webpack_require__(100); + +var _hls2 = _interopRequireDefault(_hls); -var _utils = __webpack_require__(1); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _base_object = __webpack_require__(8); +exports.default = _hls2.default; +module.exports = exports['default']; -var _base_object2 = _interopRequireDefault(_base_object); +/***/ }), +/* 67 */ +/***/ (function(module, exports, __webpack_require__) { -var _events = __webpack_require__(0); +"use strict"; -var _events2 = _interopRequireDefault(_events); -var _browser = __webpack_require__(7); +Object.defineProperty(exports, "__esModule", { + value: true +}); -var _browser2 = _interopRequireDefault(_browser); +var _html5_audio = __webpack_require__(101); -var _core_factory = __webpack_require__(44); +var _html5_audio2 = _interopRequireDefault(_html5_audio); -var _core_factory2 = _interopRequireDefault(_core_factory); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _loader = __webpack_require__(26); +exports.default = _html5_audio2.default; +module.exports = exports['default']; -var _loader2 = _interopRequireDefault(_loader); +/***/ }), +/* 68 */ +/***/ (function(module, exports, __webpack_require__) { -var _player_info = __webpack_require__(15); +"use strict"; -var _player_info2 = _interopRequireDefault(_player_info); -var _clapprZepto = __webpack_require__(3); +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _html_img = __webpack_require__(103); -var _clapprZepto2 = _interopRequireDefault(_clapprZepto); +var _html_img2 = _interopRequireDefault(_html_img); 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"); } } +exports.default = _html_img2.default; +module.exports = exports['default']; -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } +/***/ }), +/* 69 */ +/***/ (function(module, exports, __webpack_require__) { -function _inherits(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; } // Copyright 2014 Globo.com Player authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. +"use strict"; -var baseUrl = (0, _utils.currentScriptUrl)().replace(/\/[^\/]+$/, ''); -/** - * @class Player - * @constructor - * @extends BaseObject - * @module components - * @example - * ### Using the Player - * - * Add the following script on your HTML: - * ```html - * - * - * - * ``` - * Now, create the player: - * ```html - * - *
- * - * - * ``` - */ +Object.defineProperty(exports, "__esModule", { + value: true +}); -var Player = function (_BaseObject) { - _inherits(Player, _BaseObject); +var _no_op = __webpack_require__(104); - _createClass(Player, [{ - key: 'loader', - set: function set(loader) { - this._loader = loader; - }, - get: function get() { - if (!this._loader) { - this._loader = new _loader2.default(this.options.plugins || {}, this.options.playerId); - } - return this._loader; - } +var _no_op2 = _interopRequireDefault(_no_op); - /** - * Determine if the playback has ended. - * @property ended - * @type Boolean - */ +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - }, { - key: 'ended', - get: function get() { - return this.core.mediaControl.container.ended; - } +exports.default = _no_op2.default; +module.exports = exports['default']; - /** - * Determine if the playback is having to buffer in order for - * playback to be smooth. - * (i.e if a live stream is playing smoothly, this will be false) - * @property buffering - * @type Boolean - */ +/***/ }), +/* 70 */ +/***/ (function(module, exports, __webpack_require__) { - }, { - key: 'buffering', - get: function get() { - return this.core.mediaControl.container.buffering; - } +"use strict"; - /* - * determine if the player is ready. - * @property isReady - * @type {Boolean} `true` if the player is ready. ie PLAYER_READY event has fired - */ - }, { - key: 'isReady', - get: function get() { - return !!this._ready; - } +Object.defineProperty(exports, "__esModule", { + value: true +}); - /** - * An events map that allows the user to add custom callbacks in player's options. - * @property eventsMapping - * @type {Object} - */ +var _poster = __webpack_require__(115); - }, { - key: 'eventsMapping', - get: function get() { - return { - onReady: _events2.default.PLAYER_READY, - onResize: _events2.default.PLAYER_RESIZE, - onPlay: _events2.default.PLAYER_PLAY, - onPause: _events2.default.PLAYER_PAUSE, - onStop: _events2.default.PLAYER_STOP, - onEnded: _events2.default.PLAYER_ENDED, - onSeek: _events2.default.PLAYER_SEEK, - onError: _events2.default.PLAYER_ERROR, - onTimeUpdate: _events2.default.PLAYER_TIMEUPDATE, - onVolumeUpdate: _events2.default.PLAYER_VOLUMEUPDATE - }; - } +var _poster2 = _interopRequireDefault(_poster); - /** - * ## Player's constructor - * - * You might pass the options object to build the player. - * ```javascript - * var options = {source: "http://example.com/video.mp4", param1: "val1"}; - * var player = new Clappr.Player(options); - * ``` - * - * @method constructor - * @param {Object} options Data - * options to build a player instance - * @param {Number} [options.width] - * player's width **default**: `640` - * @param {Number} [options.height] - * player's height **default**: `360` - * @param {String} [options.parentId] - * the id of the element on the page that the player should be inserted into - * @param {Object} [options.parent] - * a reference to a dom element that the player should be inserted into - * @param {String} [options.source] - * The media source URL, or {source: <>, mimeType: <>} - * @param {Object} [options.sources] - * An array of media source URL's, or an array of {source: <>, mimeType: <>} - * @param {Boolean} [options.autoPlay] - * automatically play after page load **default**: `false` - * @param {Boolean} [options.loop] - * automatically replay after it ends **default**: `false` - * @param {Boolean} [options.chromeless] - * player acts in chromeless mode **default**: `false` - * @param {Boolean} [options.allowUserInteraction] - * whether or not the player should handle click events when in chromeless mode **default**: `false` on desktops browsers, `true` on mobile. - * @param {Boolean} [options.disableKeyboardShortcuts] - * disable keyboard shortcuts. **default**: `false`. `true` if `allowUserInteraction` is `false`. - * @param {Boolean} [options.muted] - * start the video muted **default**: `false` - * @param {String} [options.mimeType] - * add `mimeType: "application/vnd.apple.mpegurl"` if you need to use a url without extension. - * @param {String} [options.actualLiveTime] - * show duration and seek time relative to actual time. - * @param {String} [options.actualLiveServerTime] - * specify server time as a string, format: "2015/11/26 06:01:03". This option is meant to be used with actualLiveTime. - * @param {Boolean} [options.persistConfig] - * persist player's settings (volume) through the same domain **default**: `true` - * @param {String} [options.preload] - * video will be preloaded according to `preload` attribute options **default**: `'metadata'` - * @param {Number} [options.maxBufferLength] - * the default behavior for the **HLS playback** is to keep buffering indefinitely, even on VoD. - * This replicates the behavior for progressive download, which continues buffering when pausing the video, thus making the video available for playback even on slow networks. - * To change this behavior use `maxBufferLength` where **value is in seconds**. - * @param {String} [options.gaAccount] - * enable Google Analytics events dispatch **(play/pause/stop/buffering/etc)** by adding your `gaAccount` - * @param {String} [options.gaTrackerName] - * besides `gaAccount` you can optionally, pass your favorite trackerName as `gaTrackerName` - * @param {Object} [options.mediacontrol] - * customize control bar colors, example: `mediacontrol: {seekbar: "#E113D3", buttons: "#66B2FF"}` - * @param {Boolean} [options.hideMediaControl] - * control media control auto hide **default**: `true` - * @param {Boolean} [options.hideVolumeBar] - * when embedded with width less than 320, volume bar will hide. You can force this behavior for all sizes by adding `true` **default**: `false` - * @param {String} [options.watermark] - * put `watermark: 'http://url/img.png'` on your embed parameters to automatically add watermark on your video. - * You can customize corner position by defining position parameter. Positions can be `bottom-left`, `bottom-right`, `top-left` and `top-right`. - * @param {String} [options.watermarkLink] - * `watermarkLink: 'http://example.net/'` - define URL to open when the watermark is clicked. If not provided watermark will not be clickable. - * @param {Boolean} [options.disableVideoTagContextMenu] - * disables the context menu (right click) on the video element if a HTML5Video playback is used. - * @param {Boolean} [options.autoSeekFromUrl] - * Automatically seek to the seconds provided in the url (e.g example.com?t=100) **default**: `true` - * @param {Boolean} [options.exitFullscreenOnEnd] - * Automatically exit full screen when the media finishes. **default**: `true` - * @param {String} [options.poster] - * define a poster by adding its address `poster: 'http://url/img.png'`. It will appear after video embed, disappear on play and go back when user stops the video. - * @param {String} [options.playbackNotSupportedMessage] - * define a custom message to be displayed when a playback is not supported. - * @param {Object} [options.events] - * Specify listeners which will be registered with their corresponding player events. - * E.g. onReady -> "PLAYER_READY", onTimeUpdate -> "PLAYER_TIMEUPDATE" - */ +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - }]); +exports.default = _poster2.default; +module.exports = exports['default']; - function Player(options) { - _classCallCheck(this, Player); +/***/ }), +/* 71 */ +/***/ (function(module, exports, __webpack_require__) { - var _this = _possibleConstructorReturn(this, _BaseObject.call(this, options)); +module.exports = { "default": __webpack_require__(135), __esModule: true }; - var defaultOptions = { playerId: (0, _utils.uniqueId)(''), persistConfig: true, width: 640, height: 360, baseUrl: baseUrl, allowUserInteraction: _browser2.default.isMobile }; - _this._options = _clapprZepto2.default.extend(defaultOptions, options); - _this.options.sources = _this._normalizeSources(options); - if (!_this.options.chromeless) { - // "allowUserInteraction" cannot be false if not in chromeless mode. - _this.options.allowUserInteraction = true; - } - if (!_this.options.allowUserInteraction) { - // if user iteraction is not allowed ensure keyboard shortcuts are disabled - _this.options.disableKeyboardShortcuts = true; - } - _this._registerOptionEventListeners(); - _this._coreFactory = new _core_factory2.default(_this); - _this.playerInfo = _player_info2.default.getInstance(_this.options.playerId); - _this.playerInfo.currentSize = { width: options.width, height: options.height }; - _this.playerInfo.options = _this.options; - if (_this.options.parentId) { - _this.setParentId(_this.options.parentId); - } else if (_this.options.parent) { - _this.attachTo(_this.options.parent); - } - return _this; - } +/***/ }), +/* 72 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * Specify a `parentId` to the player. - * @method setParentId - * @param {String} parentId the element parent id. - * @return {Player} itself - */ +module.exports = { "default": __webpack_require__(136), __esModule: true }; +/***/ }), +/* 73 */ +/***/ (function(module, exports, __webpack_require__) { - Player.prototype.setParentId = function setParentId(parentId) { - var el = document.querySelector(parentId); - if (el) { - this.attachTo(el); - } - return this; - }; +"use strict"; - /** - * You can use this method to attach the player to a given element. You don't need to do this when you specify it during the player instantiation passing the `parentId` param. - * @method attachTo - * @param {Object} element a given element. - * @return {Player} itself - */ +exports.__esModule = true; - Player.prototype.attachTo = function attachTo(element) { - this.options.parentElement = element; - this.core = this._coreFactory.create(); - this._addEventListeners(); - return this; - }; +var _from = __webpack_require__(127); - Player.prototype._addEventListeners = function _addEventListeners() { - if (!this.core.isReady) { - this.listenToOnce(this.core, _events2.default.CORE_READY, this._onReady); - } else { - this._onReady(); - } - this.listenTo(this.core.mediaControl, _events2.default.MEDIACONTROL_CONTAINERCHANGED, this._containerChanged); - this.listenTo(this.core, _events2.default.CORE_FULLSCREEN, this._onFullscreenChange); - return this; - }; +var _from2 = _interopRequireDefault(_from); - Player.prototype._addContainerEventListeners = function _addContainerEventListeners() { - var container = this.core.mediaControl.container; - if (container) { - this.listenTo(container, _events2.default.CONTAINER_PLAY, this._onPlay); - this.listenTo(container, _events2.default.CONTAINER_PAUSE, this._onPause); - this.listenTo(container, _events2.default.CONTAINER_STOP, this._onStop); - this.listenTo(container, _events2.default.CONTAINER_ENDED, this._onEnded); - this.listenTo(container, _events2.default.CONTAINER_SEEK, this._onSeek); - this.listenTo(container, _events2.default.CONTAINER_ERROR, this._onError); - this.listenTo(container, _events2.default.CONTAINER_TIMEUPDATE, this._onTimeUpdate); - this.listenTo(container, _events2.default.CONTAINER_VOLUME, this._onVolumeUpdate); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = function (arr) { + if (Array.isArray(arr)) { + for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { + arr2[i] = arr[i]; } - return this; - }; - Player.prototype._registerOptionEventListeners = function _registerOptionEventListeners() { - var _this2 = this; + return arr2; + } else { + return (0, _from2.default)(arr); + } +}; - var userEvents = this.options.events || {}; - Object.keys(userEvents).forEach(function (userEvent) { - var eventType = _this2.eventsMapping[userEvent]; - if (eventType) { - var eventFunction = userEvents[userEvent]; - eventFunction = typeof eventFunction === 'function' && eventFunction; - eventFunction && _this2.on(eventType, eventFunction); - } - }); - return this; - }; +/***/ }), +/* 74 */ +/***/ (function(module, exports, __webpack_require__) { - Player.prototype._containerChanged = function _containerChanged() { - this.stopListening(); - this._addEventListeners(); - }; +var isObject = __webpack_require__(27) + , document = __webpack_require__(15).document + // in old IE typeof document.createElement is 'object' + , is = isObject(document) && isObject(document.createElement); +module.exports = function(it){ + return is ? document.createElement(it) : {}; +}; - Player.prototype._onReady = function _onReady() { - this._ready = true; - this._addContainerEventListeners(); - this.trigger(_events2.default.PLAYER_READY); - }; +/***/ }), +/* 75 */ +/***/ (function(module, exports, __webpack_require__) { - Player.prototype._onFullscreenChange = function _onFullscreenChange(fullscreen) { - this.trigger(_events2.default.PLAYER_FULLSCREEN, fullscreen); - }; +module.exports = !__webpack_require__(19) && !__webpack_require__(26)(function(){ + return Object.defineProperty(__webpack_require__(74)('div'), 'a', {get: function(){ return 7; }}).a != 7; +}); - Player.prototype._onVolumeUpdate = function _onVolumeUpdate(volume) { - this.trigger(_events2.default.PLAYER_VOLUMEUPDATE, volume); - }; +/***/ }), +/* 76 */ +/***/ (function(module, exports, __webpack_require__) { - Player.prototype._onPlay = function _onPlay() { - this.trigger(_events2.default.PLAYER_PLAY); - }; +"use strict"; - Player.prototype._onPause = function _onPause() { - this.trigger(_events2.default.PLAYER_PAUSE); - }; +var LIBRARY = __webpack_require__(46) + , $export = __webpack_require__(20) + , redefine = __webpack_require__(81) + , hide = __webpack_require__(24) + , has = __webpack_require__(21) + , Iterators = __webpack_require__(28) + , $iterCreate = __webpack_require__(153) + , setToStringTag = __webpack_require__(50) + , getPrototypeOf = __webpack_require__(160) + , ITERATOR = __webpack_require__(12)('iterator') + , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next` + , FF_ITERATOR = '@@iterator' + , KEYS = 'keys' + , VALUES = 'values'; + +var returnThis = function(){ return this; }; + +module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){ + $iterCreate(Constructor, NAME, next); + var getMethod = function(kind){ + if(!BUGGY && kind in proto)return proto[kind]; + switch(kind){ + case KEYS: return function keys(){ return new Constructor(this, kind); }; + case VALUES: return function values(){ return new Constructor(this, kind); }; + } return function entries(){ return new Constructor(this, kind); }; + }; + var TAG = NAME + ' Iterator' + , DEF_VALUES = DEFAULT == VALUES + , VALUES_BUG = false + , proto = Base.prototype + , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT] + , $default = $native || getMethod(DEFAULT) + , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined + , $anyNative = NAME == 'Array' ? proto.entries || $native : $native + , methods, key, IteratorPrototype; + // Fix native + if($anyNative){ + IteratorPrototype = getPrototypeOf($anyNative.call(new Base)); + if(IteratorPrototype !== Object.prototype){ + // Set @@toStringTag to native iterators + setToStringTag(IteratorPrototype, TAG, true); + // fix for some old engines + if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis); + } + } + // fix Array#{values, @@iterator}.name in V8 / FF + if(DEF_VALUES && $native && $native.name !== VALUES){ + VALUES_BUG = true; + $default = function values(){ return $native.call(this); }; + } + // Define iterator + if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){ + hide(proto, ITERATOR, $default); + } + // Plug for library + Iterators[NAME] = $default; + Iterators[TAG] = returnThis; + if(DEFAULT){ + methods = { + values: DEF_VALUES ? $default : getMethod(VALUES), + keys: IS_SET ? $default : getMethod(KEYS), + entries: $entries + }; + if(FORCED)for(key in methods){ + if(!(key in proto))redefine(proto, key, methods[key]); + } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); + } + return methods; +}; - Player.prototype._onStop = function _onStop() { - this.trigger(_events2.default.PLAYER_STOP, this.getCurrentTime()); - }; +/***/ }), +/* 77 */ +/***/ (function(module, exports, __webpack_require__) { - Player.prototype._onEnded = function _onEnded() { - this.trigger(_events2.default.PLAYER_ENDED); - }; +// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) +var $keys = __webpack_require__(79) + , hiddenKeys = __webpack_require__(45).concat('length', 'prototype'); - Player.prototype._onSeek = function _onSeek(time) { - this.trigger(_events2.default.PLAYER_SEEK, time); - }; +exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O){ + return $keys(O, hiddenKeys); +}; - Player.prototype._onTimeUpdate = function _onTimeUpdate(timeProgress) { - this.trigger(_events2.default.PLAYER_TIMEUPDATE, timeProgress); - }; +/***/ }), +/* 78 */ +/***/ (function(module, exports) { - Player.prototype._onError = function _onError(error) { - this.trigger(_events2.default.PLAYER_ERROR, error); - }; +exports.f = Object.getOwnPropertySymbols; - Player.prototype._normalizeSources = function _normalizeSources(options) { - var sources = options.sources || (options.source !== undefined ? [options.source] : []); - return sources.length === 0 ? [{ source: '', mimeType: '' }] : sources; - }; +/***/ }), +/* 79 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * resizes the current player canvas. - * @method resize - * @param {Object} size should be a literal object with `height` and `width`. - * @return {Player} itself - * @example - * ```javascript - * player.resize({height: 360, width: 640}) - * ``` - */ +var has = __webpack_require__(21) + , toIObject = __webpack_require__(17) + , arrayIndexOf = __webpack_require__(144)(false) + , IE_PROTO = __webpack_require__(51)('IE_PROTO'); + +module.exports = function(object, names){ + var O = toIObject(object) + , i = 0 + , result = [] + , key; + for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key); + // Don't enum bug & hidden keys + while(names.length > i)if(has(O, key = names[i++])){ + ~arrayIndexOf(result, key) || result.push(key); + } + return result; +}; +/***/ }), +/* 80 */ +/***/ (function(module, exports, __webpack_require__) { - Player.prototype.resize = function resize(size) { - this.core.resize(size); - return this; - }; +// most Object methods by ES6 should accept primitives +var $export = __webpack_require__(20) + , core = __webpack_require__(10) + , fails = __webpack_require__(26); +module.exports = function(KEY, exec){ + var fn = (core.Object || {})[KEY] || Object[KEY] + , exp = {}; + exp[KEY] = exec(fn); + $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp); +}; - /** - * loads a new source. - * @method load - * @param {Array|String} sources source or sources of video. - * An array item can be a string or {source: <>, mimeType: <>} - * @param {String} mimeType a mime type, example: `'application/vnd.apple.mpegurl'` - * @param {Boolean} [autoPlay=false] whether playing should be started immediately - * @return {Player} itself - */ +/***/ }), +/* 81 */ +/***/ (function(module, exports, __webpack_require__) { +module.exports = __webpack_require__(24); - Player.prototype.load = function load(sources, mimeType, autoPlay) { - if (autoPlay !== undefined) { - this.configure({ autoPlay: !!autoPlay }); - } - this.core.load(sources, mimeType); - return this; - }; +/***/ }), +/* 82 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * destroys the current player and removes it from the DOM. - * @method destroy - * @return {Player} itself - */ +// 7.1.15 ToLength +var toInteger = __webpack_require__(53) + , min = Math.min; +module.exports = function(it){ + return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 +}; +/***/ }), +/* 83 */ +/***/ (function(module, exports, __webpack_require__) { - Player.prototype.destroy = function destroy() { - this.core.destroy(); - return this; - }; +"use strict"; - /** - * Gives user consent to playback. Required by mobile device after a click event before Player.load(). - * @method consent - * @return {Player} itself - */ +var $at = __webpack_require__(162)(true); + +// 21.1.3.27 String.prototype[@@iterator]() +__webpack_require__(76)(String, 'String', function(iterated){ + this._t = String(iterated); // target + this._i = 0; // next index +// 21.1.5.2.1 %StringIteratorPrototype%.next() +}, function(){ + var O = this._t + , index = this._i + , point; + if(index >= O.length)return {value: undefined, done: true}; + point = $at(O, index); + this._i += point.length; + return {value: point, done: false}; +}); +/***/ }), +/* 84 */ +/***/ (function(module, exports) { - Player.prototype.consent = function consent() { - this.core.getCurrentPlayback().consent(); - return this; - }; +module.exports = "" - /** - * plays the current video (`source`). - * @method play - * @return {Player} itself - */ +/***/ }), +/* 85 */ +/***/ (function(module, exports, __webpack_require__) { +module.exports = __webpack_require__.p + "a8c874b93b3d848f39a71260c57e3863.cur"; - Player.prototype.play = function play() { - this.core.mediaControl.container.play(); - return this; - }; +/***/ }), +/* 86 */ +/***/ (function(module, exports, __webpack_require__) { - /** - * pauses the current video (`source`). - * @method pause - * @return {Player} itself - */ +"use strict"; - Player.prototype.pause = function pause() { - this.core.mediaControl.container.pause(); - return this; - }; +Object.defineProperty(exports, "__esModule", { + value: true +}); - /** - * stops the current video (`source`). - * @method stop - * @return {Player} itself - */ +var _keys = __webpack_require__(35); +var _keys2 = _interopRequireDefault(_keys); - Player.prototype.stop = function stop() { - this.core.mediaControl.container.stop(); - return this; - }; +var _classCallCheck2 = __webpack_require__(0); - /** - * seeks the current video (`source`). For example, `player.seek(120)` will seek to second 120 (2minutes) of the current video. - * @method seek - * @param {Number} time should be a number between 0 and the video duration. - * @return {Player} itself - */ +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); +var _possibleConstructorReturn2 = __webpack_require__(2); - Player.prototype.seek = function seek(time) { - this.core.mediaControl.container.seek(time); - return this; - }; +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - /** - * seeks the current video (`source`). For example, `player.seek(50)` will seek to the middle of the current video. - * @method seekPercentage - * @param {Number} time should be a number between 0 and 100. - * @return {Player} itself - */ +var _createClass2 = __webpack_require__(3); +var _createClass3 = _interopRequireDefault(_createClass2); - Player.prototype.seekPercentage = function seekPercentage(percentage) { - this.core.mediaControl.container.seekPercentage(percentage); - return this; - }; +var _inherits2 = __webpack_require__(1); - /** - * Set the volume for the current video (`source`). - * @method setVolume - * @param {Number} volume should be a number between 0 and 100, 0 being mute and 100 the max volume. - * @return {Player} itself - */ +var _inherits3 = _interopRequireDefault(_inherits2); +var _utils = __webpack_require__(5); - Player.prototype.setVolume = function setVolume(volume) { - if (this.core && this.core.mediaControl) { - this.core.mediaControl.setVolume(volume); - } - return this; - }; +var _base_object = __webpack_require__(14); - /** - * Get the volume for the current video - * @method getVolume - * @return {Number} volume should be a number between 0 and 100, 0 being mute and 100 the max volume. - */ +var _base_object2 = _interopRequireDefault(_base_object); +var _events = __webpack_require__(4); - Player.prototype.getVolume = function getVolume() { - return this.core && this.core.mediaControl ? this.core.mediaControl.volume : 0; - }; +var _events2 = _interopRequireDefault(_events); - /** - * mutes the current video (`source`). - * @method mute - * @return {Player} itself - */ +var _browser = __webpack_require__(13); +var _browser2 = _interopRequireDefault(_browser); - Player.prototype.mute = function mute() { - this._mutedVolume = this.getVolume(); - this.setVolume(0); - return this; - }; +var _core_factory = __webpack_require__(92); - /** - * unmutes the current video (`source`). - * @method unmute - * @return {Player} itself - */ +var _core_factory2 = _interopRequireDefault(_core_factory); +var _loader = __webpack_require__(62); - Player.prototype.unmute = function unmute() { - this.setVolume(typeof this._mutedVolume === 'number' ? this._mutedVolume : 100); - this._mutedVolume = null; - return this; - }; +var _loader2 = _interopRequireDefault(_loader); - /** - * checks if the player is playing. - * @method isPlaying - * @return {Boolean} `true` if the current source is playing, otherwise `false` - */ +var _player_info = __webpack_require__(33); +var _player_info2 = _interopRequireDefault(_player_info); - Player.prototype.isPlaying = function isPlaying() { - return this.core.mediaControl.container.isPlaying(); - }; +var _clapprZepto = __webpack_require__(6); - /** - * returns `true` if DVR is enable otherwise `false`. - * @method isDvrEnabled - * @return {Boolean} - */ +var _clapprZepto2 = _interopRequireDefault(_clapprZepto); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - Player.prototype.isDvrEnabled = function isDvrEnabled() { - return this.core.mediaControl.container.isDvrEnabled(); - }; +// Copyright 2014 Globo.com Player authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. - /** - * returns `true` if DVR is in use otherwise `false`. - * @method isDvrInUse - * @return {Boolean} - */ +var baseUrl = (0, _utils.currentScriptUrl)().replace(/\/[^\/]+$/, ''); +/** + * @class Player + * @constructor + * @extends BaseObject + * @module components + * @example + * ### Using the Player + * + * Add the following script on your HTML: + * ```html + * + * + * + * ``` + * Now, create the player: + * ```html + * + *
+ * + * + * ``` + */ - Player.prototype.isDvrInUse = function isDvrInUse() { - return this.core.mediaControl.container.isDvrInUse(); - }; +var Player = function (_BaseObject) { + (0, _inherits3.default)(Player, _BaseObject); + (0, _createClass3.default)(Player, [{ + key: 'loader', + set: function set(loader) { + this._loader = loader; + }, + get: function get() { + if (!this._loader) { + this._loader = new _loader2.default(this.options.plugins || {}, this.options.playerId); + } + return this._loader; + } - /** - * enables to configure a player after its creation - * @method configure - * @param {Object} options all the options to change in form of a javascript object - * @return {Player} itself - */ + /** + * Determine if the playback has ended. + * @property ended + * @type Boolean + */ + }, { + key: 'ended', + get: function get() { + return this.core.mediaControl.container.ended; + } - Player.prototype.configure = function configure(options) { - this.core.configure(options); - return this; - }; + /** + * Determine if the playback is having to buffer in order for + * playback to be smooth. + * (i.e if a live stream is playing smoothly, this will be false) + * @property buffering + * @type Boolean + */ - /** - * get a plugin by its name. - * @method getPlugin - * @param {String} name of the plugin. - * @return {Object} the plugin instance - * @example - * ```javascript - * var poster = player.getPlugin('poster'); - * poster.hidePlayButton(); - * ``` - */ + }, { + key: 'buffering', + get: function get() { + return this.core.mediaControl.container.buffering; + } + /* + * determine if the player is ready. + * @property isReady + * @type {Boolean} `true` if the player is ready. ie PLAYER_READY event has fired + */ - Player.prototype.getPlugin = function getPlugin(name) { - var plugins = this.core.plugins.concat(this.core.mediaControl.container.plugins); - return plugins.filter(function (plugin) { - return plugin.name === name; - })[0]; - }; + }, { + key: 'isReady', + get: function get() { + return !!this._ready; + } - /** - * the current time in seconds. - * @method getCurrentTime - * @return {Number} current time (in seconds) of the current source - */ + /** + * An events map that allows the user to add custom callbacks in player's options. + * @property eventsMapping + * @type {Object} + */ + }, { + key: 'eventsMapping', + get: function get() { + return { + onReady: _events2.default.PLAYER_READY, + onResize: _events2.default.PLAYER_RESIZE, + onPlay: _events2.default.PLAYER_PLAY, + onPause: _events2.default.PLAYER_PAUSE, + onStop: _events2.default.PLAYER_STOP, + onEnded: _events2.default.PLAYER_ENDED, + onSeek: _events2.default.PLAYER_SEEK, + onError: _events2.default.PLAYER_ERROR, + onTimeUpdate: _events2.default.PLAYER_TIMEUPDATE, + onVolumeUpdate: _events2.default.PLAYER_VOLUMEUPDATE, + onTextTrackLoaded: _events2.default.PLAYER_TEXTTRACKLOADED + }; + } - Player.prototype.getCurrentTime = function getCurrentTime() { - return this.core.mediaControl.container.getCurrentTime(); - }; + /** + * ## Player's constructor + * + * You might pass the options object to build the player. + * ```javascript + * var options = {source: "http://example.com/video.mp4", param1: "val1"}; + * var player = new Clappr.Player(options); + * ``` + * + * @method constructor + * @param {Object} options Data + * options to build a player instance + * @param {Number} [options.width] + * player's width **default**: `640` + * @param {Number} [options.height] + * player's height **default**: `360` + * @param {String} [options.parentId] + * the id of the element on the page that the player should be inserted into + * @param {Object} [options.parent] + * a reference to a dom element that the player should be inserted into + * @param {String} [options.source] + * The media source URL, or {source: <>, mimeType: <>} + * @param {Object} [options.sources] + * An array of media source URL's, or an array of {source: <>, mimeType: <>} + * @param {Boolean} [options.autoPlay] + * automatically play after page load **default**: `false` + * @param {Boolean} [options.loop] + * automatically replay after it ends **default**: `false` + * @param {Boolean} [options.chromeless] + * player acts in chromeless mode **default**: `false` + * @param {Boolean} [options.allowUserInteraction] + * whether or not the player should handle click events when in chromeless mode **default**: `false` on desktops browsers, `true` on mobile. + * @param {Boolean} [options.disableKeyboardShortcuts] + * disable keyboard shortcuts. **default**: `false`. `true` if `allowUserInteraction` is `false`. + * @param {Boolean} [options.muted] + * start the video muted **default**: `false` + * @param {String} [options.mimeType] + * add `mimeType: "application/vnd.apple.mpegurl"` if you need to use a url without extension. + * @param {String} [options.actualLiveTime] + * show duration and seek time relative to actual time. + * @param {String} [options.actualLiveServerTime] + * specify server time as a string, format: "2015/11/26 06:01:03". This option is meant to be used with actualLiveTime. + * @param {Boolean} [options.persistConfig] + * persist player's settings (volume) through the same domain **default**: `true` + * @param {String} [options.preload] + * video will be preloaded according to `preload` attribute options **default**: `'metadata'` + * @param {Number} [options.maxBufferLength] + * the default behavior for the **HLS playback** is to keep buffering indefinitely, even on VoD. + * This replicates the behavior for progressive download, which continues buffering when pausing the video, thus making the video available for playback even on slow networks. + * To change this behavior use `maxBufferLength` where **value is in seconds**. + * @param {String} [options.gaAccount] + * enable Google Analytics events dispatch **(play/pause/stop/buffering/etc)** by adding your `gaAccount` + * @param {String} [options.gaTrackerName] + * besides `gaAccount` you can optionally, pass your favorite trackerName as `gaTrackerName` + * @param {Object} [options.mediacontrol] + * customize control bar colors, example: `mediacontrol: {seekbar: "#E113D3", buttons: "#66B2FF"}` + * @param {Boolean} [options.hideMediaControl] + * control media control auto hide **default**: `true` + * @param {Boolean} [options.hideVolumeBar] + * when embedded with width less than 320, volume bar will hide. You can force this behavior for all sizes by adding `true` **default**: `false` + * @param {String} [options.watermark] + * put `watermark: 'http://url/img.png'` on your embed parameters to automatically add watermark on your video. + * You can customize corner position by defining position parameter. Positions can be `bottom-left`, `bottom-right`, `top-left` and `top-right`. + * @param {String} [options.watermarkLink] + * `watermarkLink: 'http://example.net/'` - define URL to open when the watermark is clicked. If not provided watermark will not be clickable. + * @param {Boolean} [options.disableVideoTagContextMenu] + * disables the context menu (right click) on the video element if a HTML5Video playback is used. + * @param {Boolean} [options.autoSeekFromUrl] + * Automatically seek to the seconds provided in the url (e.g example.com?t=100) **default**: `true` + * @param {Boolean} [options.exitFullscreenOnEnd] + * Automatically exit full screen when the media finishes. **default**: `true` + * @param {String} [options.poster] + * define a poster by adding its address `poster: 'http://url/img.png'`. It will appear after video embed, disappear on play and go back when user stops the video. + * @param {String} [options.playbackNotSupportedMessage] + * define a custom message to be displayed when a playback is not supported. + * @param {Object} [options.events] + * Specify listeners which will be registered with their corresponding player events. + * E.g. onReady -> "PLAYER_READY", onTimeUpdate -> "PLAYER_TIMEUPDATE" + */ + + }]); + + function Player(options) { + (0, _classCallCheck3.default)(this, Player); + + var _this = (0, _possibleConstructorReturn3.default)(this, _BaseObject.call(this, options)); + + var defaultOptions = { playerId: (0, _utils.uniqueId)(''), persistConfig: true, width: 640, height: 360, baseUrl: baseUrl, allowUserInteraction: _browser2.default.isMobile }; + _this._options = _clapprZepto2.default.extend(defaultOptions, options); + _this.options.sources = _this._normalizeSources(options); + if (!_this.options.chromeless) { + // "allowUserInteraction" cannot be false if not in chromeless mode. + _this.options.allowUserInteraction = true; + } + if (!_this.options.allowUserInteraction) { + // if user iteraction is not allowed ensure keyboard shortcuts are disabled + _this.options.disableKeyboardShortcuts = true; + } + _this._registerOptionEventListeners(); + _this._coreFactory = new _core_factory2.default(_this); + _this.playerInfo = _player_info2.default.getInstance(_this.options.playerId); + _this.playerInfo.currentSize = { width: options.width, height: options.height }; + _this.playerInfo.options = _this.options; + if (_this.options.parentId) { + _this.setParentId(_this.options.parentId); + } else if (_this.options.parent) { + _this.attachTo(_this.options.parent); + } + return _this; + } /** - * The time that "0" now represents relative to when playback started. - * For a stream with a sliding window this will increase as content is - * removed from the beginning. - * @method getStartTimeOffset - * @return {Number} time (in seconds) that time "0" represents. + * Specify a `parentId` to the player. + * @method setParentId + * @param {String} parentId the element parent id. + * @return {Player} itself */ - Player.prototype.getStartTimeOffset = function getStartTimeOffset() { - return this.core.mediaControl.container.getStartTimeOffset(); + Player.prototype.setParentId = function setParentId(parentId) { + var el = document.querySelector(parentId); + if (el) { + this.attachTo(el); + } + return this; }; /** - * the duration time in seconds. - * @method getDuration - * @return {Number} duration time (in seconds) of the current source + * You can use this method to attach the player to a given element. You don't need to do this when you specify it during the player instantiation passing the `parentId` param. + * @method attachTo + * @param {Object} element a given element. + * @return {Player} itself */ - Player.prototype.getDuration = function getDuration() { - return this.core.mediaControl.container.getDuration(); + Player.prototype.attachTo = function attachTo(element) { + this.options.parentElement = element; + this.core = this._coreFactory.create(); + this._addEventListeners(); + return this; }; - return Player; -}(_base_object2.default); - -exports.default = Player; -module.exports = exports['default']; + Player.prototype._addEventListeners = function _addEventListeners() { + if (!this.core.isReady) { + this.listenToOnce(this.core, _events2.default.CORE_READY, this._onReady); + } else { + this._onReady(); + } + this.listenTo(this.core.mediaControl, _events2.default.MEDIACONTROL_CONTAINERCHANGED, this._containerChanged); + this.listenTo(this.core, _events2.default.CORE_FULLSCREEN, this._onFullscreenChange); + return this; + }; -/***/ }), -/* 39 */ -/***/ (function(module, exports, __webpack_require__) { + Player.prototype._addContainerEventListeners = function _addContainerEventListeners() { + var container = this.core.mediaControl.container; + if (container) { + this.listenTo(container, _events2.default.CONTAINER_PLAY, this._onPlay); + this.listenTo(container, _events2.default.CONTAINER_PAUSE, this._onPause); + this.listenTo(container, _events2.default.CONTAINER_STOP, this._onStop); + this.listenTo(container, _events2.default.CONTAINER_ENDED, this._onEnded); + this.listenTo(container, _events2.default.CONTAINER_SEEK, this._onSeek); + this.listenTo(container, _events2.default.CONTAINER_ERROR, this._onError); + this.listenTo(container, _events2.default.CONTAINER_TIMEUPDATE, this._onTimeUpdate); + this.listenTo(container, _events2.default.CONTAINER_VOLUME, this._onVolumeUpdate); + this.listenTo(container, _events2.default.CONTAINER_LOADEDTEXTTRACK, this._onTextTrackLoaded); + } + return this; + }; -"use strict"; + Player.prototype._registerOptionEventListeners = function _registerOptionEventListeners() { + var _this2 = this; + var userEvents = this.options.events || {}; + (0, _keys2.default)(userEvents).forEach(function (userEvent) { + var eventType = _this2.eventsMapping[userEvent]; + if (eventType) { + var eventFunction = userEvents[userEvent]; + eventFunction = typeof eventFunction === 'function' && eventFunction; + eventFunction && _this2.on(eventType, eventFunction); + } + }); + return this; + }; -Object.defineProperty(exports, "__esModule", { - value: true -}); + Player.prototype._containerChanged = function _containerChanged() { + this.stopListening(); + this._addEventListeners(); + }; -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; }; }(); + Player.prototype._onReady = function _onReady() { + this._ready = true; + this._addContainerEventListeners(); + this.trigger(_events2.default.PLAYER_READY); + }; -var _events = __webpack_require__(0); + Player.prototype._onFullscreenChange = function _onFullscreenChange(fullscreen) { + this.trigger(_events2.default.PLAYER_FULLSCREEN, fullscreen); + }; -var _events2 = _interopRequireDefault(_events); + Player.prototype._onVolumeUpdate = function _onVolumeUpdate(volume) { + this.trigger(_events2.default.PLAYER_VOLUMEUPDATE, volume); + }; -var _ui_object = __webpack_require__(9); + Player.prototype._onTextTrackLoaded = function _onTextTrackLoaded(evt, data) { + this.trigger(_events2.default.PLAYER_TEXTTRACKLOADED, evt, data); + }; -var _ui_object2 = _interopRequireDefault(_ui_object); + Player.prototype._onPlay = function _onPlay() { + this.trigger(_events2.default.PLAYER_PLAY); + }; -var _styler = __webpack_require__(4); + Player.prototype._onPause = function _onPause() { + this.trigger(_events2.default.PLAYER_PAUSE); + }; -var _styler2 = _interopRequireDefault(_styler); + Player.prototype._onStop = function _onStop() { + this.trigger(_events2.default.PLAYER_STOP, this.getCurrentTime()); + }; -var _style = __webpack_require__(82); + Player.prototype._onEnded = function _onEnded() { + this.trigger(_events2.default.PLAYER_ENDED); + }; -var _style2 = _interopRequireDefault(_style); - -var _clapprZepto = __webpack_require__(3); - -var _clapprZepto2 = _interopRequireDefault(_clapprZepto); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(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; } // Copyright 2014 Globo.com Player authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/** - * Container is responsible for the video rendering and state - */ + Player.prototype._onSeek = function _onSeek(time) { + this.trigger(_events2.default.PLAYER_SEEK, time); + }; -/** - * An abstraction to represent a container for a given playback - * TODO: describe its responsabilities - * @class Container - * @constructor - * @extends UIObject - * @module base - */ -var Container = function (_UIObject) { - _inherits(Container, _UIObject); + Player.prototype._onTimeUpdate = function _onTimeUpdate(timeProgress) { + this.trigger(_events2.default.PLAYER_TIMEUPDATE, timeProgress); + }; - _createClass(Container, [{ - key: 'name', + Player.prototype._onError = function _onError(error) { + this.trigger(_events2.default.PLAYER_ERROR, error); + }; - /** - * container's name - * @method name - * @default Container - * @return {String} container's name - */ - get: function get() { - return 'Container'; - } - }, { - key: 'attributes', - get: function get() { - return { class: 'container', 'data-container': '' }; - } - }, { - key: 'events', - get: function get() { - return { - 'click': 'clicked', - 'dblclick': 'dblClicked', - 'doubleTap': 'dblClicked', - 'contextmenu': 'onContextMenu', - 'mouseenter': 'mouseEnter', - 'mouseleave': 'mouseLeave' - }; - } + Player.prototype._normalizeSources = function _normalizeSources(options) { + var sources = options.sources || (options.source !== undefined ? [options.source] : []); + return sources.length === 0 ? [{ source: '', mimeType: '' }] : sources; + }; - /** - * Determine if the playback has ended. - * @property ended - * @type Boolean - */ + /** + * resizes the current player canvas. + * @method resize + * @param {Object} size should be a literal object with `height` and `width`. + * @return {Player} itself + * @example + * ```javascript + * player.resize({height: 360, width: 640}) + * ``` + */ - }, { - key: 'ended', - get: function get() { - return this.playback.ended; - } - /** - * Determine if the playback is having to buffer in order for - * playback to be smooth. - * (i.e if a live stream is playing smoothly, this will be false) - * @property buffering - * @type Boolean - */ + Player.prototype.resize = function resize(size) { + this.core.resize(size); + return this; + }; - }, { - key: 'buffering', - get: function get() { - return this.playback.buffering; - } + /** + * loads a new source. + * @method load + * @param {Array|String} sources source or sources of video. + * An array item can be a string or {source: <>, mimeType: <>} + * @param {String} mimeType a mime type, example: `'application/vnd.apple.mpegurl'` + * @param {Boolean} [autoPlay=false] whether playing should be started immediately + * @return {Player} itself + */ - /** - * The internationalization plugin. - * @property i18n - * @type {Strings} - */ - }, { - key: 'i18n', - get: function get() { - return this._i18n; + Player.prototype.load = function load(sources, mimeType, autoPlay) { + if (autoPlay !== undefined) { + this.configure({ autoPlay: !!autoPlay }); } - - /** - * it builds a container - * @method constructor - * @param {Object} options the options object - * @param {Strings} i18n the internationalization component - */ - - }]); - - function Container(options, i18n) { - _classCallCheck(this, Container); - - var _this = _possibleConstructorReturn(this, _UIObject.call(this, options)); - - _this._i18n = i18n; - _this.currentTime = 0; - _this.volume = 100; - _this.playback = options.playback; - _this.settings = _clapprZepto2.default.extend({}, _this.playback.settings); - _this.isReady = false; - _this.mediaControlDisabled = false; - _this.plugins = [_this.playback]; - _this.bindEvents(); - return _this; - } + this.core.load(sources, mimeType); + return this; + }; /** - * binds playback events to the methods of the container. - * it listens to playback's events and triggers them as container events. - * - * | Playback | - * |----------| - * | progress | - * | timeupdate | - * | ready | - * | buffering | - * | bufferfull | - * | settingsupdate | - * | loadedmetadata | - * | highdefinitionupdate | - * | bitrate | - * | playbackstate | - * | dvr | - * | mediacontrol_disable | - * | mediacontrol_enable | - * | ended | - * | play | - * | pause | - * | error | - * - * ps: the events usually translate from PLABACK_x to CONTAINER_x, you can check all the events at `Event` class. - * - * @method bindEvents + * destroys the current player and removes it from the DOM. + * @method destroy + * @return {Player} itself */ - Container.prototype.bindEvents = function bindEvents() { - this.listenTo(this.playback, _events2.default.PLAYBACK_PROGRESS, this.progress); - this.listenTo(this.playback, _events2.default.PLAYBACK_TIMEUPDATE, this.timeUpdated); - this.listenTo(this.playback, _events2.default.PLAYBACK_READY, this.ready); - this.listenTo(this.playback, _events2.default.PLAYBACK_BUFFERING, this.onBuffering); - this.listenTo(this.playback, _events2.default.PLAYBACK_BUFFERFULL, this.bufferfull); - this.listenTo(this.playback, _events2.default.PLAYBACK_SETTINGSUPDATE, this.settingsUpdate); - this.listenTo(this.playback, _events2.default.PLAYBACK_LOADEDMETADATA, this.loadedMetadata); - this.listenTo(this.playback, _events2.default.PLAYBACK_HIGHDEFINITIONUPDATE, this.highDefinitionUpdate); - this.listenTo(this.playback, _events2.default.PLAYBACK_BITRATE, this.updateBitrate); - this.listenTo(this.playback, _events2.default.PLAYBACK_PLAYBACKSTATE, this.playbackStateChanged); - this.listenTo(this.playback, _events2.default.PLAYBACK_DVR, this.playbackDvrStateChanged); - this.listenTo(this.playback, _events2.default.PLAYBACK_MEDIACONTROL_DISABLE, this.disableMediaControl); - this.listenTo(this.playback, _events2.default.PLAYBACK_MEDIACONTROL_ENABLE, this.enableMediaControl); - this.listenTo(this.playback, _events2.default.PLAYBACK_ENDED, this.onEnded); - this.listenTo(this.playback, _events2.default.PLAYBACK_PLAY, this.playing); - this.listenTo(this.playback, _events2.default.PLAYBACK_PAUSE, this.paused); - this.listenTo(this.playback, _events2.default.PLAYBACK_STOP, this.stopped); - this.listenTo(this.playback, _events2.default.PLAYBACK_ERROR, this.error); - }; - - Container.prototype.playbackStateChanged = function playbackStateChanged(state) { - this.trigger(_events2.default.CONTAINER_PLAYBACKSTATE, state); - }; - - Container.prototype.playbackDvrStateChanged = function playbackDvrStateChanged(dvrInUse) { - this.settings = this.playback.settings; - this.dvrInUse = dvrInUse; - this.trigger(_events2.default.CONTAINER_PLAYBACKDVRSTATECHANGED, dvrInUse); + Player.prototype.destroy = function destroy() { + this.core.destroy(); + return this; }; - Container.prototype.updateBitrate = function updateBitrate(newBitrate) { - this.trigger(_events2.default.CONTAINER_BITRATE, newBitrate); - }; + /** + * Gives user consent to playback. Required by mobile device after a click event before Player.load(). + * @method consent + * @return {Player} itself + */ - Container.prototype.statsReport = function statsReport(metrics) { - this.trigger(_events2.default.CONTAINER_STATS_REPORT, metrics); - }; - Container.prototype.getPlaybackType = function getPlaybackType() { - return this.playback.getPlaybackType(); + Player.prototype.consent = function consent() { + this.core.getCurrentPlayback().consent(); + return this; }; /** - * returns `true` if DVR is enable otherwise `false`. - * @method isDvrEnabled - * @return {Boolean} + * plays the current video (`source`). + * @method play + * @return {Player} itself */ - Container.prototype.isDvrEnabled = function isDvrEnabled() { - return !!this.playback.dvrEnabled; + Player.prototype.play = function play() { + this.core.mediaControl.container.play(); + return this; }; /** - * returns `true` if DVR is in use otherwise `false`. - * @method isDvrInUse - * @return {Boolean} + * pauses the current video (`source`). + * @method pause + * @return {Player} itself */ - Container.prototype.isDvrInUse = function isDvrInUse() { - return !!this.dvrInUse; + Player.prototype.pause = function pause() { + this.core.mediaControl.container.pause(); + return this; }; /** - * destroys the container - * @method destroy + * stops the current video (`source`). + * @method stop + * @return {Player} itself */ - Container.prototype.destroy = function destroy() { - this.trigger(_events2.default.CONTAINER_DESTROYED, this, this.name); - this.stopListening(); - this.plugins.forEach(function (plugin) { - return plugin.destroy(); - }); - this.$el.remove(); - }; - - Container.prototype.setStyle = function setStyle(style) { - this.$el.css(style); - }; - - Container.prototype.animate = function animate(style, duration) { - return this.$el.animate(style, duration).promise(); + Player.prototype.stop = function stop() { + this.core.mediaControl.container.stop(); + return this; }; - Container.prototype.ready = function ready() { - this.isReady = true; - this.trigger(_events2.default.CONTAINER_READY, this.name); - }; + /** + * seeks the current video (`source`). For example, `player.seek(120)` will seek to second 120 (2minutes) of the current video. + * @method seek + * @param {Number} time should be a number between 0 and the video duration. + * @return {Player} itself + */ - Container.prototype.isPlaying = function isPlaying() { - return this.playback.isPlaying(); - }; - Container.prototype.getStartTimeOffset = function getStartTimeOffset() { - return this.playback.getStartTimeOffset(); + Player.prototype.seek = function seek(time) { + this.core.mediaControl.container.seek(time); + return this; }; - Container.prototype.getCurrentTime = function getCurrentTime() { - return this.currentTime; - }; + /** + * seeks the current video (`source`). For example, `player.seek(50)` will seek to the middle of the current video. + * @method seekPercentage + * @param {Number} time should be a number between 0 and 100. + * @return {Player} itself + */ - Container.prototype.getDuration = function getDuration() { - return this.playback.getDuration(); - }; - Container.prototype.error = function error(errorObj) { - if (!this.isReady) { - this.ready(); - } - this.trigger(_events2.default.CONTAINER_ERROR, { error: errorObj, container: this }, this.name); + Player.prototype.seekPercentage = function seekPercentage(percentage) { + this.core.mediaControl.container.seekPercentage(percentage); + return this; }; - Container.prototype.loadedMetadata = function loadedMetadata(metadata) { - this.trigger(_events2.default.CONTAINER_LOADEDMETADATA, metadata); - }; + /** + * Set the volume for the current video (`source`). + * @method setVolume + * @param {Number} volume should be a number between 0 and 100, 0 being mute and 100 the max volume. + * @return {Player} itself + */ - Container.prototype.timeUpdated = function timeUpdated(timeProgress) { - this.currentTime = timeProgress.current; - this.trigger(_events2.default.CONTAINER_TIMEUPDATE, timeProgress, this.name); - }; - Container.prototype.progress = function progress() { - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; + Player.prototype.setVolume = function setVolume(volume) { + if (this.core && this.core.mediaControl) { + this.core.mediaControl.setVolume(volume); } - - this.trigger.apply(this, [_events2.default.CONTAINER_PROGRESS].concat(args, [this.name])); + return this; }; - Container.prototype.playing = function playing() { - this.trigger(_events2.default.CONTAINER_PLAY, this.name); - }; + /** + * Get the volume for the current video + * @method getVolume + * @return {Number} volume should be a number between 0 and 100, 0 being mute and 100 the max volume. + */ - Container.prototype.paused = function paused() { - this.trigger(_events2.default.CONTAINER_PAUSE, this.name); + + Player.prototype.getVolume = function getVolume() { + return this.core && this.core.mediaControl ? this.core.mediaControl.volume : 0; }; /** - * plays the playback - * @method play + * mutes the current video (`source`). + * @method mute + * @return {Player} itself */ - Container.prototype.play = function play() { - this.playback.play(); + Player.prototype.mute = function mute() { + this._mutedVolume = this.getVolume(); + this.setVolume(0); + return this; }; /** - * stops the playback - * @method stop + * unmutes the current video (`source`). + * @method unmute + * @return {Player} itself */ - Container.prototype.stop = function stop() { - this.playback.stop(); - this.currentTime = 0; + Player.prototype.unmute = function unmute() { + this.setVolume(typeof this._mutedVolume === 'number' ? this._mutedVolume : 100); + this._mutedVolume = null; + return this; }; /** - * pauses the playback - * @method pause + * checks if the player is playing. + * @method isPlaying + * @return {Boolean} `true` if the current source is playing, otherwise `false` */ - Container.prototype.pause = function pause() { - this.playback.pause(); + Player.prototype.isPlaying = function isPlaying() { + return this.core.mediaControl.container.isPlaying(); }; - Container.prototype.onEnded = function onEnded() { - this.trigger(_events2.default.CONTAINER_ENDED, this, this.name); - this.currentTime = 0; - }; + /** + * returns `true` if DVR is enable otherwise `false`. + * @method isDvrEnabled + * @return {Boolean} + */ - Container.prototype.stopped = function stopped() { - this.trigger(_events2.default.CONTAINER_STOP); - }; - Container.prototype.clicked = function clicked() { - if (!this.options.chromeless || this.options.allowUserInteraction) { - this.trigger(_events2.default.CONTAINER_CLICK, this, this.name); - } + Player.prototype.isDvrEnabled = function isDvrEnabled() { + return this.core.mediaControl.container.isDvrEnabled(); }; - Container.prototype.dblClicked = function dblClicked() { - if (!this.options.chromeless || this.options.allowUserInteraction) { - this.trigger(_events2.default.CONTAINER_DBLCLICK, this, this.name); - } - }; + /** + * returns `true` if DVR is in use otherwise `false`. + * @method isDvrInUse + * @return {Boolean} + */ - Container.prototype.onContextMenu = function onContextMenu(event) { - if (!this.options.chromeless || this.options.allowUserInteraction) { - this.trigger(_events2.default.CONTAINER_CONTEXTMENU, event, this.name); - } - }; - Container.prototype.seek = function seek(time) { - this.trigger(_events2.default.CONTAINER_SEEK, time, this.name); - this.playback.seek(time); + Player.prototype.isDvrInUse = function isDvrInUse() { + return this.core.mediaControl.container.isDvrInUse(); }; - Container.prototype.seekPercentage = function seekPercentage(percentage) { - var duration = this.getDuration(); - if (percentage >= 0 && percentage <= 100) { - var time = duration * (percentage / 100); - this.seek(time); - } - }; + /** + * enables to configure a player after its creation + * @method configure + * @param {Object} options all the options to change in form of a javascript object + * @return {Player} itself + */ - Container.prototype.setVolume = function setVolume(value) { - this.volume = parseInt(value, 10); - this.trigger(_events2.default.CONTAINER_VOLUME, value, this.name); - this.playback.volume(value); - }; - Container.prototype.fullscreen = function fullscreen() { - this.trigger(_events2.default.CONTAINER_FULLSCREEN, this.name); + Player.prototype.configure = function configure(options) { + this.core.configure(options); + return this; }; - Container.prototype.onBuffering = function onBuffering() { - this.trigger(_events2.default.CONTAINER_STATE_BUFFERING, this.name); - }; + /** + * get a plugin by its name. + * @method getPlugin + * @param {String} name of the plugin. + * @return {Object} the plugin instance + * @example + * ```javascript + * var poster = player.getPlugin('poster'); + * poster.hidePlayButton(); + * ``` + */ - Container.prototype.bufferfull = function bufferfull() { - this.trigger(_events2.default.CONTAINER_STATE_BUFFERFULL, this.name); + + Player.prototype.getPlugin = function getPlugin(name) { + var plugins = this.core.plugins.concat(this.core.mediaControl.container.plugins); + return plugins.filter(function (plugin) { + return plugin.name === name; + })[0]; }; /** - * adds plugin to the container - * @method addPlugin - * @param {Object} plugin + * the current time in seconds. + * @method getCurrentTime + * @return {Number} current time (in seconds) of the current source */ - Container.prototype.addPlugin = function addPlugin(plugin) { - this.plugins.push(plugin); + Player.prototype.getCurrentTime = function getCurrentTime() { + return this.core.mediaControl.container.getCurrentTime(); }; /** - * checks if a plugin, given its name, exist - * @method hasPlugin - * @param {String} name - * @return {Boolean} + * The time that "0" now represents relative to when playback started. + * For a stream with a sliding window this will increase as content is + * removed from the beginning. + * @method getStartTimeOffset + * @return {Number} time (in seconds) that time "0" represents. */ - Container.prototype.hasPlugin = function hasPlugin(name) { - return !!this.getPlugin(name); + Player.prototype.getStartTimeOffset = function getStartTimeOffset() { + return this.core.mediaControl.container.getStartTimeOffset(); }; /** - * get the plugin given its name - * @method getPlugin - * @param {String} name + * the duration time in seconds. + * @method getDuration + * @return {Number} duration time (in seconds) of the current source */ - Container.prototype.getPlugin = function getPlugin(name) { - return this.plugins.filter(function (plugin) { - return plugin.name === name; - })[0]; + Player.prototype.getDuration = function getDuration() { + return this.core.mediaControl.container.getDuration(); }; - Container.prototype.mouseEnter = function mouseEnter() { - if (!this.options.chromeless || this.options.allowUserInteraction) { - this.trigger(_events2.default.CONTAINER_MOUSE_ENTER); - } - }; + return Player; +}(_base_object2.default); - Container.prototype.mouseLeave = function mouseLeave() { - if (!this.options.chromeless || this.options.allowUserInteraction) { - this.trigger(_events2.default.CONTAINER_MOUSE_LEAVE); - } - }; - - Container.prototype.settingsUpdate = function settingsUpdate() { - this.settings = this.playback.settings; - this.trigger(_events2.default.CONTAINER_SETTINGSUPDATE); - }; - - Container.prototype.highDefinitionUpdate = function highDefinitionUpdate(isHD) { - this.trigger(_events2.default.CONTAINER_HIGHDEFINITIONUPDATE, isHD); - }; - - Container.prototype.isHighDefinitionInUse = function isHighDefinitionInUse() { - return this.playback.isHighDefinitionInUse(); - }; - - Container.prototype.disableMediaControl = function disableMediaControl() { - if (!this.mediaControlDisabled) { - this.mediaControlDisabled = true; - this.trigger(_events2.default.CONTAINER_MEDIACONTROL_DISABLE); - } - }; - - Container.prototype.enableMediaControl = function enableMediaControl() { - if (this.mediaControlDisabled) { - this.mediaControlDisabled = false; - this.trigger(_events2.default.CONTAINER_MEDIACONTROL_ENABLE); - } - }; - - Container.prototype.updateStyle = function updateStyle() { - if (!this.options.chromeless || this.options.allowUserInteraction) { - this.$el.removeClass('chromeless'); - } else { - this.$el.addClass('chromeless'); - } - }; - - /** - * enables to configure the container after its creation - * @method configure - * @param {Object} options all the options to change in form of a javascript object - */ - - - Container.prototype.configure = function configure(options) { - this._options = _clapprZepto2.default.extend(this._options, options); - this.updateStyle(); - this.trigger(_events2.default.CONTAINER_OPTIONS_CHANGE); - }; - - Container.prototype.render = function render() { - var s = _styler2.default.getStyleFor(_style2.default); - this.$el.append(s); - this.$el.append(this.playback.render().el); - this.updateStyle(); - return this; - }; - - return Container; -}(_ui_object2.default); - -exports.default = Container; -module.exports = exports['default']; +exports.default = Player; +module.exports = exports['default']; /***/ }), -/* 40 */ +/* 87 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -8406,243 +6724,112 @@ Object.defineProperty(exports, "__esModule", { value: 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 _base_object = __webpack_require__(8); - -var _base_object2 = _interopRequireDefault(_base_object); - -var _events = __webpack_require__(0); - -var _events2 = _interopRequireDefault(_events); - -var _container = __webpack_require__(24); - -var _container2 = _interopRequireDefault(_container); - -var _clapprZepto = __webpack_require__(3); - -var _clapprZepto2 = _interopRequireDefault(_clapprZepto); - -var _lodash = __webpack_require__(105); - -var _lodash2 = _interopRequireDefault(_lodash); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(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; } // Copyright 2014 Globo.com Player authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -/** - * The ContainerFactory is responsible for manage playback bootstrap and create containers. - */ - -var ContainerFactory = function (_BaseObject) { - _inherits(ContainerFactory, _BaseObject); - - _createClass(ContainerFactory, [{ - key: 'options', - get: function get() { - return this._options; - }, - set: function set(options) { - this._options = options; - } - }]); - - function ContainerFactory(options, loader, i18n) { - _classCallCheck(this, ContainerFactory); - - var _this = _possibleConstructorReturn(this, _BaseObject.call(this, options)); - - _this._i18n = i18n; - _this.loader = loader; - return _this; - } - - ContainerFactory.prototype.createContainers = function createContainers() { - var _this2 = this; - - return _clapprZepto2.default.Deferred(function (promise) { - promise.resolve(_this2.options.sources.map(function (source) { - return _this2.createContainer(source); - })); - }); - }; - - ContainerFactory.prototype.findPlaybackPlugin = function findPlaybackPlugin(source, mimeType) { - return this.loader.playbackPlugins.filter(function (p) { - return p.canPlay(source, mimeType); - })[0]; - }; - - ContainerFactory.prototype.createContainer = function createContainer(source) { - var resolvedSource = null, - mimeType = this.options.mimeType; - if ((0, _lodash2.default)(source)) { - resolvedSource = source.source.toString(); - if (source.mimeType) { - mimeType = source.mimeType; - } - } else { - resolvedSource = source.toString(); - } - - if (resolvedSource.match(/^\/\//)) resolvedSource = window.location.protocol + resolvedSource; - - var options = _clapprZepto2.default.extend({}, this.options, { - src: resolvedSource, - mimeType: mimeType - }); - var playbackPlugin = this.findPlaybackPlugin(resolvedSource, mimeType); - var playback = new playbackPlugin(options, this._i18n); - - options = _clapprZepto2.default.extend({}, options, { playback: playback }); - - var container = new _container2.default(options, this._i18n); - var defer = _clapprZepto2.default.Deferred(); - defer.promise(container); - this.addContainerPlugins(container); - this.listenToOnce(container, _events2.default.CONTAINER_READY, function () { - return defer.resolve(container); - }); - return container; - }; - - ContainerFactory.prototype.addContainerPlugins = function addContainerPlugins(container) { - this.loader.containerPlugins.forEach(function (Plugin) { - container.addPlugin(new Plugin(container)); - }); - }; - - return ContainerFactory; -}(_base_object2.default); - -exports.default = ContainerFactory; -module.exports = exports['default']; - -/***/ }), -/* 41 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - +var _classCallCheck2 = __webpack_require__(0); -module.exports = __webpack_require__(40); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); -/***/ }), -/* 42 */ -/***/ (function(module, exports, __webpack_require__) { +var _possibleConstructorReturn2 = __webpack_require__(2); -"use strict"; +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); +var _createClass2 = __webpack_require__(3); -Object.defineProperty(exports, "__esModule", { - value: true -}); +var _createClass3 = _interopRequireDefault(_createClass2); -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 _inherits2 = __webpack_require__(1); -var _utils = __webpack_require__(1); +var _inherits3 = _interopRequireDefault(_inherits2); -var _events = __webpack_require__(0); +var _events = __webpack_require__(4); var _events2 = _interopRequireDefault(_events); -var _styler = __webpack_require__(4); - -var _styler2 = _interopRequireDefault(_styler); - -var _ui_object = __webpack_require__(9); +var _ui_object = __webpack_require__(18); var _ui_object2 = _interopRequireDefault(_ui_object); -var _browser = __webpack_require__(7); - -var _browser2 = _interopRequireDefault(_browser); - -var _container_factory = __webpack_require__(41); - -var _container_factory2 = _interopRequireDefault(_container_factory); - -var _media_control = __webpack_require__(27); - -var _media_control2 = _interopRequireDefault(_media_control); - -var _mediator = __webpack_require__(10); +var _styler = __webpack_require__(8); -var _mediator2 = _interopRequireDefault(_mediator); +var _styler2 = _interopRequireDefault(_styler); -var _player_info = __webpack_require__(15); +var _style = __webpack_require__(177); -var _player_info2 = _interopRequireDefault(_player_info); +var _style2 = _interopRequireDefault(_style); -var _clapprZepto = __webpack_require__(3); +var _clapprZepto = __webpack_require__(6); var _clapprZepto2 = _interopRequireDefault(_clapprZepto); -var _style = __webpack_require__(83); - -var _style2 = _interopRequireDefault(_style); - 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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(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; } // Copyright 2014 Globo.com Player authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - /** - * The Core is responsible to manage Containers, the mediator, MediaControl - * and the player state. - * @class Core + * An abstraction to represent a container for a given playback + * TODO: describe its responsabilities + * @class Container * @constructor * @extends UIObject - * @module components + * @module base */ -var Core = function (_UIObject) { - _inherits(Core, _UIObject); +var Container = function (_UIObject) { + (0, _inherits3.default)(Container, _UIObject); + (0, _createClass3.default)(Container, [{ + key: 'name', - _createClass(Core, [{ - key: 'events', + /** + * container's name + * @method name + * @default Container + * @return {String} container's name + */ get: function get() { - return { - 'webkitfullscreenchange': 'handleFullscreenChange', - 'mousemove': 'showMediaControl', - 'mouseleave': 'hideMediaControl' - }; + return 'Container'; } }, { key: 'attributes', + get: function get() { + return { class: 'container', 'data-container': '' }; + } + }, { + key: 'events', get: function get() { return { - 'data-player': '', - tabindex: 9999 + 'click': 'clicked', + 'dblclick': 'dblClicked', + 'doubleTap': 'dblClicked', + 'contextmenu': 'onContextMenu', + 'mouseenter': 'mouseEnter', + 'mouseleave': 'mouseLeave' }; } /** - * checks if the core is ready. - * @property isReady - * @type {Boolean} `true` if the core is ready, otherwise `false` + * Determine if the playback has ended. + * @property ended + * @type Boolean */ }, { - key: 'isReady', + key: 'ended', get: function get() { - return !!this.ready; + return this.playback.ended; } /** - * The internationalization plugin. + * Determine if the playback is having to buffer in order for + * playback to be smooth. + * (i.e if a live stream is playing smoothly, this will be false) + * @property buffering + * @type Boolean + */ + + }, { + key: 'buffering', + get: function get() { + return this.playback.buffering; + } + + /** + * The internationalization plugin. * @property i18n * @type {Strings} */ @@ -8650,1556 +6837,1172 @@ var Core = function (_UIObject) { }, { key: 'i18n', get: function get() { - return this.getPlugin('strings') || { t: function t(key) { - return key; - } }; + return this._i18n; } + + /** + * it builds a container + * @method constructor + * @param {Object} options the options object + * @param {Strings} i18n the internationalization component + */ + }]); - function Core(options) { - _classCallCheck(this, Core); + function Container(options, i18n) { + (0, _classCallCheck3.default)(this, Container); - var _this = _possibleConstructorReturn(this, _UIObject.call(this, options)); + var _this = (0, _possibleConstructorReturn3.default)(this, _UIObject.call(this, options)); - _this.configureDomRecycler(); - _this.playerInfo = _player_info2.default.getInstance(options.playerId); - _this.firstResize = true; - _this.plugins = []; - _this.containers = []; - _this.setupMediaControl(null); - //FIXME fullscreen api sucks - _this._boundFullscreenHandler = function () { - return _this.handleFullscreenChange(); - }; - (0, _clapprZepto2.default)(document).bind('fullscreenchange', _this._boundFullscreenHandler); - (0, _clapprZepto2.default)(document).bind('MSFullscreenChange', _this._boundFullscreenHandler); - (0, _clapprZepto2.default)(document).bind('mozfullscreenchange', _this._boundFullscreenHandler); + _this._i18n = i18n; + _this.currentTime = 0; + _this.volume = 100; + _this.playback = options.playback; + _this.settings = _clapprZepto2.default.extend({}, _this.playback.settings); + _this.isReady = false; + _this.mediaControlDisabled = false; + _this.plugins = [_this.playback]; + _this.bindEvents(); return _this; } - Core.prototype.configureDomRecycler = function configureDomRecycler() { - var recycleVideo = this.options && this.options.playback && this.options.playback.recycleVideo ? true : false; - _utils.DomRecycler.configure({ - recycleVideo: recycleVideo - }); - }; + /** + * binds playback events to the methods of the container. + * it listens to playback's events and triggers them as container events. + * + * | Playback | + * |----------| + * | progress | + * | timeupdate | + * | ready | + * | buffering | + * | bufferfull | + * | settingsupdate | + * | loadedmetadata | + * | highdefinitionupdate | + * | bitrate | + * | playbackstate | + * | dvr | + * | mediacontrol_disable | + * | mediacontrol_enable | + * | ended | + * | play | + * | pause | + * | error | + * + * ps: the events usually translate from PLABACK_x to CONTAINER_x, you can check all the events at `Event` class. + * + * @method bindEvents + */ - Core.prototype.createContainers = function createContainers(options) { - var _this2 = this; - this.defer = _clapprZepto2.default.Deferred(); - this.defer.promise(this); - this.containerFactory = new _container_factory2.default(options, options.loader, this.i18n); - this.containerFactory.createContainers().then(function (containers) { - return _this2.setupContainers(containers); - }).then(function (containers) { - return _this2.resolveOnContainersReady(containers); - }); + Container.prototype.bindEvents = function bindEvents() { + this.listenTo(this.playback, _events2.default.PLAYBACK_PROGRESS, this.progress); + this.listenTo(this.playback, _events2.default.PLAYBACK_TIMEUPDATE, this.timeUpdated); + this.listenTo(this.playback, _events2.default.PLAYBACK_READY, this.ready); + this.listenTo(this.playback, _events2.default.PLAYBACK_BUFFERING, this.onBuffering); + this.listenTo(this.playback, _events2.default.PLAYBACK_BUFFERFULL, this.bufferfull); + this.listenTo(this.playback, _events2.default.PLAYBACK_SETTINGSUPDATE, this.settingsUpdate); + this.listenTo(this.playback, _events2.default.PLAYBACK_LOADEDMETADATA, this.loadedMetadata); + this.listenTo(this.playback, _events2.default.PLAYBACK_HIGHDEFINITIONUPDATE, this.highDefinitionUpdate); + this.listenTo(this.playback, _events2.default.PLAYBACK_BITRATE, this.updateBitrate); + this.listenTo(this.playback, _events2.default.PLAYBACK_PLAYBACKSTATE, this.playbackStateChanged); + this.listenTo(this.playback, _events2.default.PLAYBACK_DVR, this.playbackDvrStateChanged); + this.listenTo(this.playback, _events2.default.PLAYBACK_MEDIACONTROL_DISABLE, this.disableMediaControl); + this.listenTo(this.playback, _events2.default.PLAYBACK_MEDIACONTROL_ENABLE, this.enableMediaControl); + this.listenTo(this.playback, _events2.default.PLAYBACK_ENDED, this.onEnded); + this.listenTo(this.playback, _events2.default.PLAYBACK_PLAY, this.playing); + this.listenTo(this.playback, _events2.default.PLAYBACK_PAUSE, this.paused); + this.listenTo(this.playback, _events2.default.PLAYBACK_STOP, this.stopped); + this.listenTo(this.playback, _events2.default.PLAYBACK_ERROR, this.error); + this.listenTo(this.playback, _events2.default.PLAYBACK_SUBTITLE_LOADED, this.subtitleLoaded); }; - Core.prototype.updateSize = function updateSize() { - if (_utils.Fullscreen.isFullscreen()) { - this.setFullscreen(); - } else { - this.setPlayerSize(); - } + Container.prototype.subtitleLoaded = function subtitleLoaded(evt, data) { + this.trigger(_events2.default.CONTAINER_LOADEDTEXTTRACK, evt, data); }; - Core.prototype.setFullscreen = function setFullscreen() { - if (!_browser2.default.isiOS) { - this.$el.addClass('fullscreen'); - this.$el.removeAttr('style'); - this.playerInfo.previousSize = { width: this.options.width, height: this.options.height }; - this.playerInfo.currentSize = { width: (0, _clapprZepto2.default)(window).width(), height: (0, _clapprZepto2.default)(window).height() }; - } + Container.prototype.playbackStateChanged = function playbackStateChanged(state) { + this.trigger(_events2.default.CONTAINER_PLAYBACKSTATE, state); }; - Core.prototype.setPlayerSize = function setPlayerSize() { - this.$el.removeClass('fullscreen'); - this.playerInfo.currentSize = this.playerInfo.previousSize; - this.playerInfo.previousSize = { width: (0, _clapprZepto2.default)(window).width(), height: (0, _clapprZepto2.default)(window).height() }; - this.resize(this.playerInfo.currentSize); + Container.prototype.playbackDvrStateChanged = function playbackDvrStateChanged(dvrInUse) { + this.settings = this.playback.settings; + this.dvrInUse = dvrInUse; + this.trigger(_events2.default.CONTAINER_PLAYBACKDVRSTATECHANGED, dvrInUse); }; - Core.prototype.resize = function resize(options) { - if (!(0, _utils.isNumber)(options.height) && !(0, _utils.isNumber)(options.width)) { - this.el.style.height = '' + options.height; - this.el.style.width = '' + options.width; - } else { - this.el.style.height = options.height + 'px'; - this.el.style.width = options.width + 'px'; - } - this.playerInfo.previousSize = { width: this.options.width, height: this.options.height }; - this.options.width = options.width; - this.options.height = options.height; - this.playerInfo.currentSize = options; - this.triggerResize(this.playerInfo.currentSize); + Container.prototype.updateBitrate = function updateBitrate(newBitrate) { + this.trigger(_events2.default.CONTAINER_BITRATE, newBitrate); }; - Core.prototype.enableResizeObserver = function enableResizeObserver() { - var _this3 = this; - - var checkSizeCallback = function checkSizeCallback() { - if (_this3.playerInfo.computedSize.width != _this3.el.clientWidth || _this3.playerInfo.computedSize.height != _this3.el.clientHeight) { - _this3.playerInfo.computedSize = { width: _this3.el.clientWidth, height: _this3.el.clientHeight }; - _this3.triggerResize(_this3.playerInfo.computedSize); - } - }; - this.resizeObserverInterval = setInterval(checkSizeCallback, 500); + Container.prototype.statsReport = function statsReport(metrics) { + this.trigger(_events2.default.CONTAINER_STATS_REPORT, metrics); }; - Core.prototype.triggerResize = function triggerResize(newSize) { - var thereWasChange = this.firstResize || this.oldHeight !== newSize.height || this.oldWidth !== newSize.width; - if (thereWasChange) { - _mediator2.default.trigger(this.options.playerId + ':' + _events2.default.PLAYER_RESIZE, newSize); - this.oldHeight = newSize.height; - this.oldWidth = newSize.width; - this.firstResize = false; - } + Container.prototype.getPlaybackType = function getPlaybackType() { + return this.playback.getPlaybackType(); }; - Core.prototype.disableResizeObserver = function disableResizeObserver() { - if (this.resizeObserverInterval) clearInterval(this.resizeObserverInterval); - }; + /** + * returns `true` if DVR is enable otherwise `false`. + * @method isDvrEnabled + * @return {Boolean} + */ - Core.prototype.resolveOnContainersReady = function resolveOnContainersReady(containers) { - var _this4 = this; - _clapprZepto2.default.when.apply(_clapprZepto2.default, containers).done(function () { - _this4.defer.resolve(_this4); - _this4.ready = true; - _this4.trigger(_events2.default.CORE_READY); - }); + Container.prototype.isDvrEnabled = function isDvrEnabled() { + return !!this.playback.dvrEnabled; }; - Core.prototype.addPlugin = function addPlugin(plugin) { - this.plugins.push(plugin); - }; + /** + * returns `true` if DVR is in use otherwise `false`. + * @method isDvrInUse + * @return {Boolean} + */ - Core.prototype.hasPlugin = function hasPlugin(name) { - return !!this.getPlugin(name); - }; - Core.prototype.getPlugin = function getPlugin(name) { - return this.plugins.filter(function (plugin) { - return plugin.name === name; - })[0]; + Container.prototype.isDvrInUse = function isDvrInUse() { + return !!this.dvrInUse; }; - Core.prototype.load = function load(sources, mimeType) { - var _this5 = this; + /** + * destroys the container + * @method destroy + */ - this.options.mimeType = mimeType; - sources = sources && sources.constructor === Array ? sources : [sources]; - this.containers.forEach(function (container) { - return container.destroy(); - }); - this.mediaControl.container = null; - this.containerFactory.options = _clapprZepto2.default.extend(this.options, { sources: sources }); - this.containerFactory.createContainers().then(function (containers) { - _this5.setupContainers(containers); - }); - }; - Core.prototype.destroy = function destroy() { - this.disableResizeObserver(); - this.containers.forEach(function (container) { - return container.destroy(); - }); + Container.prototype.destroy = function destroy() { + this.trigger(_events2.default.CONTAINER_DESTROYED, this, this.name); + this.stopListening(); this.plugins.forEach(function (plugin) { return plugin.destroy(); }); this.$el.remove(); - this.mediaControl.destroy(); - (0, _clapprZepto2.default)(document).unbind('fullscreenchange', this._boundFullscreenHandler); - (0, _clapprZepto2.default)(document).unbind('MSFullscreenChange', this._boundFullscreenHandler); - (0, _clapprZepto2.default)(document).unbind('mozfullscreenchange', this._boundFullscreenHandler); }; - Core.prototype.handleFullscreenChange = function handleFullscreenChange() { - this.trigger(_events2.default.CORE_FULLSCREEN, _utils.Fullscreen.isFullscreen()); - this.updateSize(); - this.mediaControl.show(); + Container.prototype.setStyle = function setStyle(style) { + this.$el.css(style); }; - Core.prototype.setMediaControlContainer = function setMediaControlContainer(container) { - this.mediaControl.setContainer(container); - this.mediaControl.render(); + Container.prototype.animate = function animate(style, duration) { + return this.$el.animate(style, duration).promise(); }; - Core.prototype.disableMediaControl = function disableMediaControl() { - this.mediaControl.disable(); - this.$el.removeClass('nocursor'); + Container.prototype.ready = function ready() { + this.isReady = true; + this.trigger(_events2.default.CONTAINER_READY, this.name); }; - Core.prototype.enableMediaControl = function enableMediaControl() { - this.mediaControl.enable(); + Container.prototype.isPlaying = function isPlaying() { + return this.playback.isPlaying(); }; - Core.prototype.removeContainer = function removeContainer(container) { - this.stopListening(container); - this.containers = this.containers.filter(function (c) { - return c !== container; - }); + Container.prototype.getStartTimeOffset = function getStartTimeOffset() { + return this.playback.getStartTimeOffset(); }; - Core.prototype.appendContainer = function appendContainer(container) { - this.listenTo(container, _events2.default.CONTAINER_DESTROYED, this.removeContainer); - this.containers.push(container); + Container.prototype.getCurrentTime = function getCurrentTime() { + return this.currentTime; }; - Core.prototype.setupContainers = function setupContainers(containers) { - containers.map(this.appendContainer.bind(this)); - this.trigger(_events2.default.CORE_CONTAINERS_CREATED); - this.renderContainers(); - this.setupMediaControl(this.getCurrentContainer()); - this.render(); - this.$el.appendTo(this.options.parentElement); - return this.containers; + Container.prototype.getDuration = function getDuration() { + return this.playback.getDuration(); }; - Core.prototype.renderContainers = function renderContainers() { - var _this6 = this; - - this.containers.map(function (container) { - return _this6.el.appendChild(container.render().el); - }); + Container.prototype.error = function error(errorObj) { + if (!this.isReady) { + this.ready(); + } + this.trigger(_events2.default.CONTAINER_ERROR, { error: errorObj, container: this }, this.name); }; - Core.prototype.createContainer = function createContainer(source, options) { - var container = this.containerFactory.createContainer(source, options); - this.appendContainer(container); - this.el.appendChild(container.render().el); - return container; + Container.prototype.loadedMetadata = function loadedMetadata(metadata) { + this.trigger(_events2.default.CONTAINER_LOADEDMETADATA, metadata); }; - Core.prototype.setupMediaControl = function setupMediaControl(container) { - if (this.mediaControl) { - this.mediaControl.setContainer(container); - } else { - this.mediaControl = this.createMediaControl(_clapprZepto2.default.extend({ container: container, focusElement: this.el }, this.options)); - this.listenTo(this.mediaControl, _events2.default.MEDIACONTROL_FULLSCREEN, this.toggleFullscreen); - this.listenTo(this.mediaControl, _events2.default.MEDIACONTROL_SHOW, this.onMediaControlShow.bind(this, true)); - this.listenTo(this.mediaControl, _events2.default.MEDIACONTROL_HIDE, this.onMediaControlShow.bind(this, false)); - } + Container.prototype.timeUpdated = function timeUpdated(timeProgress) { + this.currentTime = timeProgress.current; + this.trigger(_events2.default.CONTAINER_TIMEUPDATE, timeProgress, this.name); }; - Core.prototype.createMediaControl = function createMediaControl(options) { - if (options.mediacontrol && options.mediacontrol.external) { - return new options.mediacontrol.external(options).render(); - } else { - return new _media_control2.default(options).render(); + Container.prototype.progress = function progress() { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; } - }; - Core.prototype.getCurrentContainer = function getCurrentContainer() { - if (!this.mediaControl || !this.mediaControl.container) { - return this.containers[0]; - } - return this.mediaControl.container; + this.trigger.apply(this, [_events2.default.CONTAINER_PROGRESS].concat(args, [this.name])); }; - Core.prototype.getCurrentPlayback = function getCurrentPlayback() { - var container = this.getCurrentContainer(); - return container && container.playback; + Container.prototype.playing = function playing() { + this.trigger(_events2.default.CONTAINER_PLAY, this.name); }; - Core.prototype.getPlaybackType = function getPlaybackType() { - var container = this.getCurrentContainer(); - return container && container.getPlaybackType(); + Container.prototype.paused = function paused() { + this.trigger(_events2.default.CONTAINER_PAUSE, this.name); }; - Core.prototype.toggleFullscreen = function toggleFullscreen() { - if (!_utils.Fullscreen.isFullscreen()) { - _utils.Fullscreen.requestFullscreen(this.el); - if (!_browser2.default.isiOS) { - this.$el.addClass('fullscreen'); - } - } else { - _utils.Fullscreen.cancelFullscreen(); - if (!_browser2.default.isiOS) { - this.$el.removeClass('fullscreen nocursor'); - } - } - this.mediaControl.show(); - }; + /** + * plays the playback + * @method play + */ - Core.prototype.showMediaControl = function showMediaControl(event) { - this.mediaControl.show(event); - }; - Core.prototype.hideMediaControl = function hideMediaControl() { - this.mediaControl.hide(this.options.hideMediaControlDelay); + Container.prototype.play = function play() { + this.playback.play(); }; - Core.prototype.onMediaControlShow = function onMediaControlShow(showing) { - this.getCurrentContainer().trigger(showing ? _events2.default.CONTAINER_MEDIACONTROL_SHOW : _events2.default.CONTAINER_MEDIACONTROL_HIDE); + /** + * stops the playback + * @method stop + */ - if (showing) this.$el.removeClass('nocursor');else if (_utils.Fullscreen.isFullscreen()) this.$el.addClass('nocursor'); + + Container.prototype.stop = function stop() { + this.playback.stop(); + this.currentTime = 0; }; /** - * enables to configure the container after its creation - * @method configure - * @param {Object} options all the options to change in form of a javascript object + * pauses the playback + * @method pause */ - Core.prototype.configure = function configure(options) { - var _this7 = this; + Container.prototype.pause = function pause() { + this.playback.pause(); + }; - this._options = _clapprZepto2.default.extend(this._options, options); - this.configureDomRecycler(); - var sources = options.source || options.sources; + Container.prototype.onEnded = function onEnded() { + this.trigger(_events2.default.CONTAINER_ENDED, this, this.name); + this.currentTime = 0; + }; - if (sources) { - this.load(sources, options.mimeType || this.options.mimeType); - } else { - this.trigger(_events2.default.CORE_OPTIONS_CHANGE); + Container.prototype.stopped = function stopped() { + this.trigger(_events2.default.CONTAINER_STOP); + }; - this.containers.forEach(function (container) { - container.configure(_this7.options); - }); + Container.prototype.clicked = function clicked() { + if (!this.options.chromeless || this.options.allowUserInteraction) { + this.trigger(_events2.default.CONTAINER_CLICK, this, this.name); } }; - Core.prototype.render = function render() { - this.$style && this.$style.remove(); - this.$style = _styler2.default.getStyleFor(_style2.default, { baseUrl: this.options.baseUrl }); - this.$el.append(this.$style); - this.$el.append(this.mediaControl.render().el); + Container.prototype.dblClicked = function dblClicked() { + if (!this.options.chromeless || this.options.allowUserInteraction) { + this.trigger(_events2.default.CONTAINER_DBLCLICK, this, this.name); + } + }; - this.options.width = this.options.width || this.$el.width(); - this.options.height = this.options.height || this.$el.height(); - var size = { width: this.options.width, height: this.options.height }; - this.playerInfo.previousSize = this.playerInfo.currentSize = this.playerInfo.computedSize = size; - this.updateSize(); + Container.prototype.onContextMenu = function onContextMenu(event) { + if (!this.options.chromeless || this.options.allowUserInteraction) { + this.trigger(_events2.default.CONTAINER_CONTEXTMENU, event, this.name); + } + }; - this.previousSize = { width: this.$el.width(), height: this.$el.height() }; + Container.prototype.seek = function seek(time) { + this.trigger(_events2.default.CONTAINER_SEEK, time, this.name); + this.playback.seek(time); + }; - this.enableResizeObserver(); + Container.prototype.seekPercentage = function seekPercentage(percentage) { + var duration = this.getDuration(); + if (percentage >= 0 && percentage <= 100) { + var time = duration * (percentage / 100); + this.seek(time); + } + }; - return this; + Container.prototype.setVolume = function setVolume(value) { + this.volume = parseInt(value, 10); + this.trigger(_events2.default.CONTAINER_VOLUME, value, this.name); + this.playback.volume(value); }; - return Core; -}(_ui_object2.default); + Container.prototype.fullscreen = function fullscreen() { + this.trigger(_events2.default.CONTAINER_FULLSCREEN, this.name); + }; -exports.default = Core; -module.exports = exports['default']; + Container.prototype.onBuffering = function onBuffering() { + this.trigger(_events2.default.CONTAINER_STATE_BUFFERING, this.name); + }; -/***/ }), -/* 43 */ -/***/ (function(module, exports, __webpack_require__) { + Container.prototype.bufferfull = function bufferfull() { + this.trigger(_events2.default.CONTAINER_STATE_BUFFERFULL, this.name); + }; -"use strict"; + /** + * adds plugin to the container + * @method addPlugin + * @param {Object} plugin + */ -Object.defineProperty(exports, "__esModule", { - value: true -}); + Container.prototype.addPlugin = function addPlugin(plugin) { + this.plugins.push(plugin); + }; -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; }; }(); + /** + * checks if a plugin, given its name, exist + * @method hasPlugin + * @param {String} name + * @return {Boolean} + */ -var _base_object = __webpack_require__(8); -var _base_object2 = _interopRequireDefault(_base_object); + Container.prototype.hasPlugin = function hasPlugin(name) { + return !!this.getPlugin(name); + }; -var _core = __webpack_require__(25); + /** + * get the plugin given its name + * @method getPlugin + * @param {String} name + */ -var _core2 = _interopRequireDefault(_core); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + Container.prototype.getPlugin = function getPlugin(name) { + return this.plugins.filter(function (plugin) { + return plugin.name === name; + })[0]; + }; -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + Container.prototype.mouseEnter = function mouseEnter() { + if (!this.options.chromeless || this.options.allowUserInteraction) { + this.trigger(_events2.default.CONTAINER_MOUSE_ENTER); + } + }; -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + Container.prototype.mouseLeave = function mouseLeave() { + if (!this.options.chromeless || this.options.allowUserInteraction) { + this.trigger(_events2.default.CONTAINER_MOUSE_LEAVE); + } + }; -function _inherits(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; } // Copyright 2014 Globo.com Player authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. + Container.prototype.settingsUpdate = function settingsUpdate() { + this.settings = this.playback.settings; + this.trigger(_events2.default.CONTAINER_SETTINGSUPDATE); + }; -/** - * The Core Factory is responsible for instantiate the core and it's plugins. - * @class CoreFactory - * @constructor - * @extends BaseObject - * @module components - */ -var CoreFactory = function (_BaseObject) { - _inherits(CoreFactory, _BaseObject); - - _createClass(CoreFactory, [{ - key: 'loader', - get: function get() { - return this.player.loader; - } - - /** - * it builds the core factory - * @method constructor - * @param {Player} player the player object - */ - - }]); - - function CoreFactory(player) { - _classCallCheck(this, CoreFactory); - - var _this = _possibleConstructorReturn(this, _BaseObject.call(this)); + Container.prototype.highDefinitionUpdate = function highDefinitionUpdate(isHD) { + this.trigger(_events2.default.CONTAINER_HIGHDEFINITIONUPDATE, isHD); + }; - _this.player = player; - _this._options = player.options; - return _this; - } + Container.prototype.isHighDefinitionInUse = function isHighDefinitionInUse() { + return this.playback.isHighDefinitionInUse(); + }; - /** - * creates a core and its plugins - * @method create - * @return {Core} created core - */ + Container.prototype.disableMediaControl = function disableMediaControl() { + if (!this.mediaControlDisabled) { + this.mediaControlDisabled = true; + this.trigger(_events2.default.CONTAINER_MEDIACONTROL_DISABLE); + } + }; + Container.prototype.enableMediaControl = function enableMediaControl() { + if (this.mediaControlDisabled) { + this.mediaControlDisabled = false; + this.trigger(_events2.default.CONTAINER_MEDIACONTROL_ENABLE); + } + }; - CoreFactory.prototype.create = function create() { - this.options.loader = this.loader; - this.core = new _core2.default(this.options); - this.addCorePlugins(); - this.core.createContainers(this.options); - return this.core; + Container.prototype.updateStyle = function updateStyle() { + if (!this.options.chromeless || this.options.allowUserInteraction) { + this.$el.removeClass('chromeless'); + } else { + this.$el.addClass('chromeless'); + } }; /** - * given the core plugins (`loader.corePlugins`) it builds each one - * @method addCorePlugins - * @return {Core} the core with all plugins + * enables to configure the container after its creation + * @method configure + * @param {Object} options all the options to change in form of a javascript object */ - CoreFactory.prototype.addCorePlugins = function addCorePlugins() { - var _this2 = this; - - this.loader.corePlugins.forEach(function (Plugin) { - var plugin = new Plugin(_this2.core); - _this2.core.addPlugin(plugin); - _this2.setupExternalInterface(plugin); - }); - return this.core; + Container.prototype.configure = function configure(options) { + this._options = _clapprZepto2.default.extend(this._options, options); + this.updateStyle(); + this.trigger(_events2.default.CONTAINER_OPTIONS_CHANGE); }; - CoreFactory.prototype.setupExternalInterface = function setupExternalInterface(plugin) { - var externalFunctions = plugin.getExternalInterface(); - for (var key in externalFunctions) { - this.player[key] = externalFunctions[key].bind(plugin); - } + Container.prototype.render = function render() { + var s = _styler2.default.getStyleFor(_style2.default); + this.$el.append(s); + this.$el.append(this.playback.render().el); + this.updateStyle(); + return this; }; - return CoreFactory; -}(_base_object2.default); + return Container; +}(_ui_object2.default); // Copyright 2014 Globo.com Player authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. -exports.default = CoreFactory; +/** + * Container is responsible for the video rendering and state + */ + +exports.default = Container; module.exports = exports['default']; /***/ }), -/* 44 */ +/* 88 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -module.exports = __webpack_require__(43); +Object.defineProperty(exports, "__esModule", { + value: true +}); -/***/ }), -/* 45 */ -/***/ (function(module, exports, __webpack_require__) { +var _typeof2 = __webpack_require__(36); -"use strict"; +var _typeof3 = _interopRequireDefault(_typeof2); +var _classCallCheck2 = __webpack_require__(0); -Object.defineProperty(exports, "__esModule", { - value: true -}); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); -var _base_object = __webpack_require__(8); +var _possibleConstructorReturn2 = __webpack_require__(2); -var _base_object2 = _interopRequireDefault(_base_object); +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); -var _player_info = __webpack_require__(15); +var _createClass2 = __webpack_require__(3); -var _player_info2 = _interopRequireDefault(_player_info); +var _createClass3 = _interopRequireDefault(_createClass2); -var _lodash = __webpack_require__(108); +var _inherits2 = __webpack_require__(1); -var _lodash2 = _interopRequireDefault(_lodash); +var _inherits3 = _interopRequireDefault(_inherits2); -var _html5_video = __webpack_require__(16); +var _base_object = __webpack_require__(14); -var _html5_video2 = _interopRequireDefault(_html5_video); +var _base_object2 = _interopRequireDefault(_base_object); -var _flash = __webpack_require__(28); +var _events = __webpack_require__(4); -var _flash2 = _interopRequireDefault(_flash); +var _events2 = _interopRequireDefault(_events); -var _html5_audio = __webpack_require__(31); +var _container = __webpack_require__(60); -var _html5_audio2 = _interopRequireDefault(_html5_audio); +var _container2 = _interopRequireDefault(_container); -var _flashls = __webpack_require__(29); +var _clapprZepto = __webpack_require__(6); -var _flashls2 = _interopRequireDefault(_flashls); +var _clapprZepto2 = _interopRequireDefault(_clapprZepto); -var _hls = __webpack_require__(30); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _hls2 = _interopRequireDefault(_hls); +// Copyright 2014 Globo.com Player authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. -var _html_img = __webpack_require__(32); +/** + * The ContainerFactory is responsible for manage playback bootstrap and create containers. + */ -var _html_img2 = _interopRequireDefault(_html_img); +var ContainerFactory = function (_BaseObject) { + (0, _inherits3.default)(ContainerFactory, _BaseObject); + (0, _createClass3.default)(ContainerFactory, [{ + key: 'options', + get: function get() { + return this._options; + }, + set: function set(options) { + this._options = options; + } + }]); -var _no_op = __webpack_require__(33); + function ContainerFactory(options, loader, i18n) { + (0, _classCallCheck3.default)(this, ContainerFactory); -var _no_op2 = _interopRequireDefault(_no_op); + var _this = (0, _possibleConstructorReturn3.default)(this, _BaseObject.call(this, options)); -var _spinner_three_bounce = __webpack_require__(71); + _this._i18n = i18n; + _this.loader = loader; + return _this; + } -var _spinner_three_bounce2 = _interopRequireDefault(_spinner_three_bounce); + ContainerFactory.prototype.createContainers = function createContainers() { + var _this2 = this; -var _stats = __webpack_require__(73); + return _clapprZepto2.default.Deferred(function (promise) { + promise.resolve(_this2.options.sources.map(function (source) { + return _this2.createContainer(source); + })); + }); + }; -var _stats2 = _interopRequireDefault(_stats); + ContainerFactory.prototype.findPlaybackPlugin = function findPlaybackPlugin(source, mimeType) { + return this.loader.playbackPlugins.filter(function (p) { + return p.canPlay(source, mimeType); + })[0]; + }; -var _watermark = __webpack_require__(76); + ContainerFactory.prototype.createContainer = function createContainer(source) { + var resolvedSource = null, + mimeType = this.options.mimeType; + if ((typeof source === 'undefined' ? 'undefined' : (0, _typeof3.default)(source)) === 'object') { + resolvedSource = source.source.toString(); + if (source.mimeType) { + mimeType = source.mimeType; + } + } else { + resolvedSource = source.toString(); + } -var _watermark2 = _interopRequireDefault(_watermark); + if (resolvedSource.match(/^\/\//)) resolvedSource = window.location.protocol + resolvedSource; -var _poster = __webpack_require__(34); + var options = _clapprZepto2.default.extend({}, this.options, { + src: resolvedSource, + mimeType: mimeType + }); + var playbackPlugin = this.findPlaybackPlugin(resolvedSource, mimeType); + var playback = new playbackPlugin(options, this._i18n); -var _poster2 = _interopRequireDefault(_poster); + options = _clapprZepto2.default.extend({}, options, { playback: playback }); -var _google_analytics = __webpack_require__(65); + var container = new _container2.default(options, this._i18n); + var defer = _clapprZepto2.default.Deferred(); + defer.promise(container); + this.addContainerPlugins(container); + this.listenToOnce(container, _events2.default.CONTAINER_READY, function () { + return defer.resolve(container); + }); + return container; + }; -var _google_analytics2 = _interopRequireDefault(_google_analytics); + ContainerFactory.prototype.addContainerPlugins = function addContainerPlugins(container) { + this.loader.containerPlugins.forEach(function (Plugin) { + container.addPlugin(new Plugin(container)); + }); + }; -var _click_to_pause = __webpack_require__(58); + return ContainerFactory; +}(_base_object2.default); -var _click_to_pause2 = _interopRequireDefault(_click_to_pause); +exports.default = ContainerFactory; +module.exports = exports['default']; -var _dvr_controls = __webpack_require__(60); +/***/ }), +/* 89 */ +/***/ (function(module, exports, __webpack_require__) { -var _dvr_controls2 = _interopRequireDefault(_dvr_controls); +"use strict"; -var _favicon = __webpack_require__(63); -var _favicon2 = _interopRequireDefault(_favicon); +Object.defineProperty(exports, "__esModule", { + value: true +}); -var _seek_time = __webpack_require__(68); +var _container_factory = __webpack_require__(88); -var _seek_time2 = _interopRequireDefault(_seek_time); +var _container_factory2 = _interopRequireDefault(_container_factory); -var _sources = __webpack_require__(70); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _sources2 = _interopRequireDefault(_sources); +exports.default = _container_factory2.default; +module.exports = exports['default']; -var _end_video = __webpack_require__(61); +/***/ }), +/* 90 */ +/***/ (function(module, exports, __webpack_require__) { -var _end_video2 = _interopRequireDefault(_end_video); +"use strict"; -var _strings = __webpack_require__(75); -var _strings2 = _interopRequireDefault(_strings); +Object.defineProperty(exports, "__esModule", { + value: true +}); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _classCallCheck2 = __webpack_require__(0); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } +var _possibleConstructorReturn2 = __webpack_require__(2); -function _inherits(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; } // Copyright 2014 Globo.com Player authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); -/* Playback Plugins */ +var _createClass2 = __webpack_require__(3); +var _createClass3 = _interopRequireDefault(_createClass2); -/* Container Plugins */ +var _inherits2 = __webpack_require__(1); +var _inherits3 = _interopRequireDefault(_inherits2); -/* Core Plugins */ +var _utils = __webpack_require__(5); +var _events = __webpack_require__(4); -/** - * It keeps a list of the default plugins (playback, container, core) and it merges external plugins with its internals. - * @class Loader - * @constructor - * @extends BaseObject - * @module components - */ -var Loader = function (_BaseObject) { - _inherits(Loader, _BaseObject); +var _events2 = _interopRequireDefault(_events); - /** - * builds the loader - * @method constructor - * @param {Object} externalPlugins the external plugins - * @param {Number} playerId you can embed multiple instances of clappr, therefore this is the unique id of each one. - */ - function Loader(externalPlugins, playerId) { - _classCallCheck(this, Loader); +var _styler = __webpack_require__(8); - var _this = _possibleConstructorReturn(this, _BaseObject.call(this)); +var _styler2 = _interopRequireDefault(_styler); - _this.playerId = playerId; - _this.playbackPlugins = [_hls2.default, _html5_video2.default, _html5_audio2.default, _flash2.default, _flashls2.default, _html_img2.default, _no_op2.default]; - _this.containerPlugins = [_spinner_three_bounce2.default, _watermark2.default, _poster2.default, _stats2.default, _google_analytics2.default, _click_to_pause2.default]; - _this.corePlugins = [_dvr_controls2.default, _favicon2.default, _seek_time2.default, _sources2.default, _end_video2.default, _strings2.default]; - if (externalPlugins) { - if (!Array.isArray(externalPlugins)) { - _this.validateExternalPluginsType(externalPlugins); - } - _this.addExternalPlugins(externalPlugins); - } - return _this; - } - - /** - * groups by type the external plugins that were passed through `options.plugins` it they're on a flat array - * @method addExternalPlugins - * @private - * @param {Object} an config object or an array of plugins - * @return {Object} plugins the config object with the plugins separated by type - */ - - - Loader.prototype.groupPluginsByType = function groupPluginsByType(plugins) { - if (Array.isArray(plugins)) { - plugins = plugins.reduce(function (memo, plugin) { - memo[plugin.type] || (memo[plugin.type] = []); - memo[plugin.type].push(plugin); - return memo; - }, {}); - } - return plugins; - }; - - /** - * adds all the external plugins that were passed through `options.plugins` - * @method addExternalPlugins - * @private - * @param {Object} plugins the config object with all plugins - */ - - - Loader.prototype.addExternalPlugins = function addExternalPlugins(plugins) { - plugins = this.groupPluginsByType(plugins); - var pluginName = function pluginName(plugin) { - return plugin.prototype.name; - }; - if (plugins.playback) { - this.playbackPlugins = (0, _lodash2.default)(plugins.playback.concat(this.playbackPlugins), pluginName); - } - if (plugins.container) { - this.containerPlugins = (0, _lodash2.default)(plugins.container.concat(this.containerPlugins), pluginName); - } - if (plugins.core) { - this.corePlugins = (0, _lodash2.default)(plugins.core.concat(this.corePlugins), pluginName); - } - _player_info2.default.getInstance(this.playerId).playbackPlugins = this.playbackPlugins; - }; - - /** - * validate if the external plugins that were passed through `options.plugins` are associated to the correct type - * @method validateExternalPluginsType - * @private - * @param {Object} plugins the config object with all plugins - */ - - - Loader.prototype.validateExternalPluginsType = function validateExternalPluginsType(plugins) { - var plugintypes = ['playback', 'container', 'core']; - plugintypes.forEach(function (type) { - (plugins[type] || []).forEach(function (el) { - var errorMessage = 'external ' + el.type + ' plugin on ' + type + ' array'; - if (el.type !== type) { - throw new ReferenceError(errorMessage); - } - }); - }); - }; - - return Loader; -}(_base_object2.default); - -exports.default = Loader; -module.exports = exports['default']; - -/***/ }), -/* 46 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(process) { - -Object.defineProperty(exports, "__esModule", { - value: 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 _utils = __webpack_require__(1); - -var _vendor = __webpack_require__(20); - -var _events = __webpack_require__(0); - -var _events2 = _interopRequireDefault(_events); - -var _styler = __webpack_require__(4); - -var _styler2 = _interopRequireDefault(_styler); - -var _ui_object = __webpack_require__(9); +var _ui_object = __webpack_require__(18); var _ui_object2 = _interopRequireDefault(_ui_object); -var _browser = __webpack_require__(7); +var _browser = __webpack_require__(13); var _browser2 = _interopRequireDefault(_browser); -var _mediator = __webpack_require__(10); - -var _mediator2 = _interopRequireDefault(_mediator); - -var _template = __webpack_require__(5); - -var _template2 = _interopRequireDefault(_template); - -var _playback = __webpack_require__(2); - -var _playback2 = _interopRequireDefault(_playback); - -var _clapprZepto = __webpack_require__(3); - -var _clapprZepto2 = _interopRequireDefault(_clapprZepto); - -var _lodash = __webpack_require__(35); - -var _lodash2 = _interopRequireDefault(_lodash); - -var _mediaControl = __webpack_require__(84); - -var _mediaControl2 = _interopRequireDefault(_mediaControl); - -var _mediaControl3 = __webpack_require__(95); - -var _mediaControl4 = _interopRequireDefault(_mediaControl3); - -var _play = __webpack_require__(22); - -var _play2 = _interopRequireDefault(_play); - -var _pause = __webpack_require__(36); - -var _pause2 = _interopRequireDefault(_pause); - -var _stop = __webpack_require__(109); +var _container_factory = __webpack_require__(89); -var _stop2 = _interopRequireDefault(_stop); +var _container_factory2 = _interopRequireDefault(_container_factory); -var _volume = __webpack_require__(110); +var _media_control = __webpack_require__(63); -var _volume2 = _interopRequireDefault(_volume); +var _media_control2 = _interopRequireDefault(_media_control); -var _mute = __webpack_require__(111); +var _mediator = __webpack_require__(22); -var _mute2 = _interopRequireDefault(_mute); +var _mediator2 = _interopRequireDefault(_mediator); -var _expand = __webpack_require__(112); +var _player_info = __webpack_require__(33); -var _expand2 = _interopRequireDefault(_expand); +var _player_info2 = _interopRequireDefault(_player_info); -var _shrink = __webpack_require__(113); +var _clapprZepto = __webpack_require__(6); -var _shrink2 = _interopRequireDefault(_shrink); +var _clapprZepto2 = _interopRequireDefault(_clapprZepto); -var _hd = __webpack_require__(114); +var _style = __webpack_require__(178); -var _hd2 = _interopRequireDefault(_hd); +var _style2 = _interopRequireDefault(_style); 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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(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; } // Copyright 2014 Globo.com Player authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - /** - * The MediaControl is responsible for displaying the Player controls. + * The Core is responsible to manage Containers, the mediator, MediaControl + * and the player state. + * @class Core + * @constructor + * @extends UIObject + * @module components */ - -var MediaControl = function (_UIObject) { - _inherits(MediaControl, _UIObject); - - _createClass(MediaControl, [{ - key: 'name', - get: function get() { - return 'MediaControl'; - } - }, { - key: 'disabled', - get: function get() { - return this.userDisabled || this.container && this.container.getPlaybackType() === _playback2.default.NO_OP; - } - }, { - key: 'attributes', +var Core = function (_UIObject) { + (0, _inherits3.default)(Core, _UIObject); + (0, _createClass3.default)(Core, [{ + key: 'events', get: function get() { return { - 'class': 'media-control', - 'data-media-control': '' + 'webkitfullscreenchange': 'handleFullscreenChange', + 'mousemove': 'showMediaControl', + 'mouseleave': 'hideMediaControl' }; } }, { - key: 'events', + key: 'attributes', get: function get() { return { - 'click [data-play]': 'play', - 'click [data-pause]': 'pause', - 'click [data-playpause]': 'togglePlayPause', - 'click [data-stop]': 'stop', - 'click [data-playstop]': 'togglePlayStop', - 'click [data-fullscreen]': 'toggleFullscreen', - 'click .bar-container[data-seekbar]': 'seek', - 'click .bar-container[data-volume]': 'onVolumeClick', - 'click .drawer-icon[data-volume]': 'toggleMute', - 'mouseenter .drawer-container[data-volume]': 'showVolumeBar', - 'mouseleave .drawer-container[data-volume]': 'hideVolumeBar', - 'mousedown .bar-container[data-volume]': 'startVolumeDrag', - 'mousemove .bar-container[data-volume]': 'mousemoveOnVolumeBar', - 'mousedown .bar-scrubber[data-seekbar]': 'startSeekDrag', - 'mousemove .bar-container[data-seekbar]': 'mousemoveOnSeekBar', - 'mouseleave .bar-container[data-seekbar]': 'mouseleaveOnSeekBar', - 'mouseenter .media-control-layer[data-controls]': 'setUserKeepVisible', - 'mouseleave .media-control-layer[data-controls]': 'resetUserKeepVisible' + 'data-player': '', + tabindex: 9999 }; } + + /** + * checks if the core is ready. + * @property isReady + * @type {Boolean} `true` if the core is ready, otherwise `false` + */ + }, { - key: 'template', - get: function get() { - return (0, _template2.default)(_mediaControl4.default); - } - }, { - key: 'stylesheet', - get: function get() { - return _styler2.default.getStyleFor(_mediaControl2.default, { baseUrl: this.options.baseUrl }); - } - }, { - key: 'volume', + key: 'isReady', get: function get() { - return this.container && this.container.isReady ? this.container.volume : this.intendedVolume; + return !!this.ready; } + + /** + * The internationalization plugin. + * @property i18n + * @type {Strings} + */ + }, { - key: 'muted', + key: 'i18n', get: function get() { - return this.volume === 0; + return this.getPlugin('strings') || { t: function t(key) { + return key; + } }; } }]); - function MediaControl(options) { - _classCallCheck(this, MediaControl); + function Core(options) { + (0, _classCallCheck3.default)(this, Core); - var _this = _possibleConstructorReturn(this, _UIObject.call(this, options)); + var _this = (0, _possibleConstructorReturn3.default)(this, _UIObject.call(this, options)); - _this.persistConfig = _this.options.persistConfig; - _this.container = options.container; - _this.currentPositionValue = null; - _this.currentDurationValue = null; - var initialVolume = _this.persistConfig ? _utils.Config.restore('volume') : 100; - _this.setVolume(_this.options.mute ? 0 : initialVolume); - _this.keepVisible = false; - _this.fullScreenOnVideoTagSupported = null; // unknown - _this.addEventListeners(); - _this.settings = { - left: ['play', 'stop', 'pause'], - right: ['volume'], - default: ['position', 'seekbar', 'duration'] + _this.configureDomRecycler(); + _this.playerInfo = _player_info2.default.getInstance(options.playerId); + _this.firstResize = true; + _this.plugins = []; + _this.containers = []; + _this.setupMediaControl(null); + //FIXME fullscreen api sucks + _this._boundFullscreenHandler = function () { + return _this.handleFullscreenChange(); }; + (0, _clapprZepto2.default)(document).bind('fullscreenchange', _this._boundFullscreenHandler); + (0, _clapprZepto2.default)(document).bind('MSFullscreenChange', _this._boundFullscreenHandler); + (0, _clapprZepto2.default)(document).bind('mozfullscreenchange', _this._boundFullscreenHandler); + _browser2.default.isMobile && (0, _clapprZepto2.default)(window).bind('resize', function (o) { + _this.handleWindowResize(o); + }); + return _this; + } - if (_this.container) { - if (!_clapprZepto2.default.isEmptyObject(_this.container.settings)) { - _this.settings = _clapprZepto2.default.extend({}, _this.container.settings); - } + Core.prototype.configureDomRecycler = function configureDomRecycler() { + var recycleVideo = this.options && this.options.playback && this.options.playback.recycleVideo ? true : false; + _utils.DomRecycler.configure({ + recycleVideo: recycleVideo + }); + }; + + Core.prototype.createContainers = function createContainers(options) { + var _this2 = this; + + this.defer = _clapprZepto2.default.Deferred(); + this.defer.promise(this); + this.containerFactory = new _container_factory2.default(options, options.loader, this.i18n); + this.containerFactory.createContainers().then(function (containers) { + return _this2.setupContainers(containers); + }).then(function (containers) { + return _this2.resolveOnContainersReady(containers); + }); + }; + + Core.prototype.updateSize = function updateSize() { + if (_utils.Fullscreen.isFullscreen()) { + this.setFullscreen(); } else { - _this.settings = {}; + this.setPlayerSize(); } + }; - _this.userDisabled = false; - if (_this.container && _this.container.mediaControlDisabled || _this.options.chromeless) { - _this.disable(); + Core.prototype.setFullscreen = function setFullscreen() { + if (!_browser2.default.isiOS) { + this.$el.addClass('fullscreen'); + this.$el.removeAttr('style'); + this.playerInfo.previousSize = { width: this.options.width, height: this.options.height }; + this.playerInfo.currentSize = { width: (0, _clapprZepto2.default)(window).width(), height: (0, _clapprZepto2.default)(window).height() }; } - _this.stopDragHandler = function (event) { - return _this.stopDrag(event); - }; - _this.updateDragHandler = function (event) { - return _this.updateDrag(event); - }; - (0, _clapprZepto2.default)(document).bind('mouseup', _this.stopDragHandler); - (0, _clapprZepto2.default)(document).bind('mousemove', _this.updateDragHandler); - return _this; - } + }; - MediaControl.prototype.addEventListeners = function addEventListeners() { - if (this.container) { - _mediator2.default.on(this.options.playerId + ':' + _events2.default.PLAYER_RESIZE, this.playerResize, this); - this.listenTo(this.container, _events2.default.CONTAINER_PLAY, this.changeTogglePlay); - this.listenTo(this.container, _events2.default.CONTAINER_PAUSE, this.changeTogglePlay); - this.listenTo(this.container, _events2.default.CONTAINER_STOP, this.changeTogglePlay); - this.listenTo(this.container, _events2.default.CONTAINER_DBLCLICK, this.toggleFullscreen); - this.listenTo(this.container, _events2.default.CONTAINER_TIMEUPDATE, this.onTimeUpdate); - this.listenTo(this.container, _events2.default.CONTAINER_PROGRESS, this.updateProgressBar); - this.listenTo(this.container, _events2.default.CONTAINER_SETTINGSUPDATE, this.settingsUpdate); - this.listenTo(this.container, _events2.default.CONTAINER_PLAYBACKDVRSTATECHANGED, this.settingsUpdate); - this.listenTo(this.container, _events2.default.CONTAINER_HIGHDEFINITIONUPDATE, this.highDefinitionUpdate); - this.listenTo(this.container, _events2.default.CONTAINER_MEDIACONTROL_DISABLE, this.disable); - this.listenTo(this.container, _events2.default.CONTAINER_MEDIACONTROL_ENABLE, this.enable); - this.listenTo(this.container, _events2.default.CONTAINER_ENDED, this.ended); - this.listenTo(this.container, _events2.default.CONTAINER_VOLUME, this.onVolumeChanged); - if (this.container.playback.el.nodeName.toLowerCase() === 'video') { - // wait until the metadata has loaded and then check if fullscreen on video tag is supported - this.listenToOnce(this.container, _events2.default.CONTAINER_LOADEDMETADATA, this.onLoadedMetadataOnVideoTag); - } + Core.prototype.setPlayerSize = function setPlayerSize() { + this.$el.removeClass('fullscreen'); + this.playerInfo.currentSize = this.playerInfo.previousSize; + this.playerInfo.previousSize = { width: (0, _clapprZepto2.default)(window).width(), height: (0, _clapprZepto2.default)(window).height() }; + this.resize(this.playerInfo.currentSize); + }; + + Core.prototype.resize = function resize(options) { + if (!(0, _utils.isNumber)(options.height) && !(0, _utils.isNumber)(options.width)) { + this.el.style.height = '' + options.height; + this.el.style.width = '' + options.width; + } else { + this.el.style.height = options.height + 'px'; + this.el.style.width = options.width + 'px'; } + this.playerInfo.previousSize = { width: this.options.width, height: this.options.height }; + this.options.width = options.width; + this.options.height = options.height; + this.playerInfo.currentSize = options; + this.triggerResize(this.playerInfo.currentSize); }; - MediaControl.prototype.disable = function disable() { - this.userDisabled = true; - this.hide(); - this.$el.hide(); + Core.prototype.enableResizeObserver = function enableResizeObserver() { + var _this3 = this; + + var checkSizeCallback = function checkSizeCallback() { + if (_this3.playerInfo.computedSize.width != _this3.el.clientWidth || _this3.playerInfo.computedSize.height != _this3.el.clientHeight) { + _this3.playerInfo.computedSize = { width: _this3.el.clientWidth, height: _this3.el.clientHeight }; + _this3.triggerResize(_this3.playerInfo.computedSize); + } + }; + this.resizeObserverInterval = setInterval(checkSizeCallback, 500); }; - MediaControl.prototype.enable = function enable() { - if (this.options.chromeless) return; - this.userDisabled = false; - this.show(); + Core.prototype.triggerResize = function triggerResize(newSize) { + var thereWasChange = this.firstResize || this.oldHeight !== newSize.height || this.oldWidth !== newSize.width; + if (thereWasChange) { + _mediator2.default.trigger(this.options.playerId + ':' + _events2.default.PLAYER_RESIZE, newSize); + this.oldHeight = newSize.height; + this.oldWidth = newSize.width; + this.firstResize = false; + } }; - MediaControl.prototype.play = function play() { - this.container.play(); + Core.prototype.disableResizeObserver = function disableResizeObserver() { + if (this.resizeObserverInterval) clearInterval(this.resizeObserverInterval); }; - MediaControl.prototype.pause = function pause() { - this.container.pause(); + Core.prototype.resolveOnContainersReady = function resolveOnContainersReady(containers) { + var _this4 = this; + + _clapprZepto2.default.when.apply(_clapprZepto2.default, containers).done(function () { + _this4.defer.resolve(_this4); + _this4.ready = true; + _this4.trigger(_events2.default.CORE_READY); + }); }; - MediaControl.prototype.stop = function stop() { - this.container.stop(); + Core.prototype.addPlugin = function addPlugin(plugin) { + this.plugins.push(plugin); }; - MediaControl.prototype.onVolumeChanged = function onVolumeChanged() { - this.updateVolumeUI(); + Core.prototype.hasPlugin = function hasPlugin(name) { + return !!this.getPlugin(name); }; - MediaControl.prototype.onLoadedMetadataOnVideoTag = function onLoadedMetadataOnVideoTag() { - var video = this.container.playback.el; - // video.webkitSupportsFullscreen is deprecated but iOS appears to only use this - // see https://github.com/clappr/clappr/issues/1127 - if (!_utils.Fullscreen.fullscreenEnabled() && video.webkitSupportsFullscreen) { - this.fullScreenOnVideoTagSupported = true; - this.settingsUpdate(); - } + Core.prototype.getPlugin = function getPlugin(name) { + return this.plugins.filter(function (plugin) { + return plugin.name === name; + })[0]; }; - MediaControl.prototype.updateVolumeUI = function updateVolumeUI() { - if (!this.rendered) { - // this will be called after a render - return; - } - // update volume bar scrubber/fill on bar mode - this.$volumeBarContainer.find('.bar-fill-2').css({}); - var containerWidth = this.$volumeBarContainer.width(); - var barWidth = this.$volumeBarBackground.width(); - var offset = (containerWidth - barWidth) / 2.0; - var pos = barWidth * this.volume / 100.0 + offset; - this.$volumeBarFill.css({ width: this.volume + '%' }); - this.$volumeBarScrubber.css({ left: pos }); + Core.prototype.load = function load(sources, mimeType) { + var _this5 = this; - // update volume bar segments on segmented bar mode - this.$volumeBarContainer.find('.segmented-bar-element').removeClass('fill'); - var item = Math.ceil(this.volume / 10.0); - this.$volumeBarContainer.find('.segmented-bar-element').slice(0, item).addClass('fill'); - this.$volumeIcon.html(''); - this.$volumeIcon.removeClass('muted'); - if (!this.muted) { - this.$volumeIcon.append(_volume2.default); - } else { - this.$volumeIcon.append(_mute2.default); - this.$volumeIcon.addClass('muted'); - } - this.applyButtonStyle(this.$volumeIcon); + this.options.mimeType = mimeType; + sources = sources && sources.constructor === Array ? sources : [sources]; + this.containers.forEach(function (container) { + return container.destroy(); + }); + this.mediaControl.container = null; + this.containerFactory.options = _clapprZepto2.default.extend(this.options, { sources: sources }); + this.containerFactory.createContainers().then(function (containers) { + _this5.setupContainers(containers); + }); }; - MediaControl.prototype.changeTogglePlay = function changeTogglePlay() { - this.$playPauseToggle.html(''); - this.$playStopToggle.html(''); - if (this.container && this.container.isPlaying()) { - this.$playPauseToggle.append(_pause2.default); - this.$playStopToggle.append(_stop2.default); - this.trigger(_events2.default.MEDIACONTROL_PLAYING); - } else { - this.$playPauseToggle.append(_play2.default); - this.$playStopToggle.append(_play2.default); - this.trigger(_events2.default.MEDIACONTROL_NOTPLAYING); - if (_browser2.default.isMobile) { - this.show(); - } - } - this.applyButtonStyle(this.$playPauseToggle); - this.applyButtonStyle(this.$playStopToggle); + Core.prototype.destroy = function destroy() { + this.disableResizeObserver(); + this.containers.forEach(function (container) { + return container.destroy(); + }); + this.plugins.forEach(function (plugin) { + return plugin.destroy(); + }); + this.$el.remove(); + this.mediaControl.destroy(); + (0, _clapprZepto2.default)(document).unbind('fullscreenchange', this._boundFullscreenHandler); + (0, _clapprZepto2.default)(document).unbind('MSFullscreenChange', this._boundFullscreenHandler); + (0, _clapprZepto2.default)(document).unbind('mozfullscreenchange', this._boundFullscreenHandler); }; - MediaControl.prototype.mousemoveOnSeekBar = function mousemoveOnSeekBar(event) { - if (this.settings.seekEnabled) { - var offsetX = event.pageX - this.$seekBarContainer.offset().left - this.$seekBarHover.width() / 2; - this.$seekBarHover.css({ left: offsetX }); - } - this.trigger(_events2.default.MEDIACONTROL_MOUSEMOVE_SEEKBAR, event); + Core.prototype.handleFullscreenChange = function handleFullscreenChange() { + this.trigger(_events2.default.CORE_FULLSCREEN, _utils.Fullscreen.isFullscreen()); + this.updateSize(); + this.mediaControl.show(); }; - MediaControl.prototype.mouseleaveOnSeekBar = function mouseleaveOnSeekBar(event) { - this.trigger(_events2.default.MEDIACONTROL_MOUSELEAVE_SEEKBAR, event); + Core.prototype.handleWindowResize = function handleWindowResize(event) { + var orientation = (0, _clapprZepto2.default)(window).width() > (0, _clapprZepto2.default)(window).height() ? 'landscape' : 'portrait'; + if (this._screenOrientation === orientation) return; + this._screenOrientation = orientation; + + this.trigger(_events2.default.CORE_SCREEN_ORIENTATION_CHANGED, { + event: event, + orientation: this._screenOrientation + }); }; - MediaControl.prototype.onVolumeClick = function onVolumeClick(event) { - this.setVolume(this.getVolumeFromUIEvent(event)); + Core.prototype.setMediaControlContainer = function setMediaControlContainer(container) { + this.mediaControl.setContainer(container); + this.mediaControl.render(); }; - MediaControl.prototype.mousemoveOnVolumeBar = function mousemoveOnVolumeBar(event) { - if (this.draggingVolumeBar) { - this.setVolume(this.getVolumeFromUIEvent(event)); - } + Core.prototype.disableMediaControl = function disableMediaControl() { + this.mediaControl.disable(); + this.$el.removeClass('nocursor'); }; - MediaControl.prototype.playerResize = function playerResize(size) { - this.$fullscreenToggle.html(''); - if (_utils.Fullscreen.isFullscreen()) { - this.$fullscreenToggle.append(_shrink2.default); - } else { - this.$fullscreenToggle.append(_expand2.default); - } - this.applyButtonStyle(this.$fullscreenToggle); - this.$el.removeClass('w320'); - if (size.width <= 320 || this.options.hideVolumeBar) { - this.$el.addClass('w320'); - } + Core.prototype.enableMediaControl = function enableMediaControl() { + this.mediaControl.enable(); }; - MediaControl.prototype.togglePlayPause = function togglePlayPause() { - if (this.container.isPlaying()) { - this.container.pause(); - } else { - this.container.play(); - } - return false; + Core.prototype.removeContainer = function removeContainer(container) { + this.stopListening(container); + this.containers = this.containers.filter(function (c) { + return c !== container; + }); }; - MediaControl.prototype.togglePlayStop = function togglePlayStop() { - if (this.container.isPlaying()) { - this.container.stop(); - } else { - this.container.play(); - } + Core.prototype.appendContainer = function appendContainer(container) { + this.listenTo(container, _events2.default.CONTAINER_DESTROYED, this.removeContainer); + this.containers.push(container); }; - MediaControl.prototype.startSeekDrag = function startSeekDrag(event) { - if (!this.settings.seekEnabled) return; - this.draggingSeekBar = true; - this.$el.addClass('dragging'); - this.$seekBarLoaded.addClass('media-control-notransition'); - this.$seekBarPosition.addClass('media-control-notransition'); - this.$seekBarScrubber.addClass('media-control-notransition'); - if (event) { - event.preventDefault(); - } + Core.prototype.setupContainers = function setupContainers(containers) { + containers.map(this.appendContainer.bind(this)); + this.trigger(_events2.default.CORE_CONTAINERS_CREATED); + this.renderContainers(); + this.setupMediaControl(this.getCurrentContainer()); + this.render(); + this.$el.appendTo(this.options.parentElement); + return this.containers; }; - MediaControl.prototype.startVolumeDrag = function startVolumeDrag(event) { - this.draggingVolumeBar = true; - this.$el.addClass('dragging'); - if (event) { - event.preventDefault(); - } + Core.prototype.renderContainers = function renderContainers() { + var _this6 = this; + + this.containers.map(function (container) { + return _this6.el.appendChild(container.render().el); + }); }; - MediaControl.prototype.stopDrag = function stopDrag(event) { - if (this.draggingSeekBar) { - this.seek(event); + Core.prototype.createContainer = function createContainer(source, options) { + var container = this.containerFactory.createContainer(source, options); + this.appendContainer(container); + this.el.appendChild(container.render().el); + return container; + }; + + Core.prototype.setupMediaControl = function setupMediaControl(container) { + if (this.mediaControl) { + this.mediaControl.setContainer(container); + } else { + this.mediaControl = this.createMediaControl(_clapprZepto2.default.extend({ container: container, focusElement: this.el }, this.options)); + this.listenTo(this.mediaControl, _events2.default.MEDIACONTROL_FULLSCREEN, this.toggleFullscreen); + this.listenTo(this.mediaControl, _events2.default.MEDIACONTROL_SHOW, this.onMediaControlShow.bind(this, true)); + this.listenTo(this.mediaControl, _events2.default.MEDIACONTROL_HIDE, this.onMediaControlShow.bind(this, false)); } - this.$el.removeClass('dragging'); - this.$seekBarLoaded.removeClass('media-control-notransition'); - this.$seekBarPosition.removeClass('media-control-notransition'); - this.$seekBarScrubber.removeClass('media-control-notransition dragging'); - this.draggingSeekBar = false; - this.draggingVolumeBar = false; }; - MediaControl.prototype.updateDrag = function updateDrag(event) { - if (this.draggingSeekBar) { - event.preventDefault(); - var offsetX = event.pageX - this.$seekBarContainer.offset().left; - var pos = offsetX / this.$seekBarContainer.width() * 100; - pos = Math.min(100, Math.max(pos, 0)); - this.setSeekPercentage(pos); - } else if (this.draggingVolumeBar) { - event.preventDefault(); - this.setVolume(this.getVolumeFromUIEvent(event)); + Core.prototype.createMediaControl = function createMediaControl(options) { + if (options.mediacontrol && options.mediacontrol.external) { + return new options.mediacontrol.external(options).render(); + } else { + return new _media_control2.default(options).render(); } }; - MediaControl.prototype.getVolumeFromUIEvent = function getVolumeFromUIEvent(event) { - var offsetY = event.pageX - this.$volumeBarContainer.offset().left; - var volumeFromUI = offsetY / this.$volumeBarContainer.width() * 100; - return volumeFromUI; + Core.prototype.getCurrentContainer = function getCurrentContainer() { + if (!this.mediaControl || !this.mediaControl.container) { + return this.containers[0]; + } + return this.mediaControl.container; }; - MediaControl.prototype.toggleMute = function toggleMute() { - this.setVolume(this.muted ? 100 : 0); + Core.prototype.getCurrentPlayback = function getCurrentPlayback() { + var container = this.getCurrentContainer(); + return container && container.playback; }; - MediaControl.prototype.setVolume = function setVolume(value) { - var _this2 = this; + Core.prototype.getPlaybackType = function getPlaybackType() { + var container = this.getCurrentContainer(); + return container && container.getPlaybackType(); + }; - value = Math.min(100, Math.max(value, 0)); - // this will hold the intended volume - // it may not actually get set to this straight away - // if the container is not ready etc - this.intendedVolume = value; - this.persistConfig && _utils.Config.persist('volume', value); - var setWhenContainerReady = function setWhenContainerReady() { - if (_this2.container.isReady) { - _this2.container.setVolume(value); - } else { - _this2.listenToOnce(_this2.container, _events2.default.CONTAINER_READY, function () { - _this2.container.setVolume(value); - }); + Core.prototype.toggleFullscreen = function toggleFullscreen() { + if (!_utils.Fullscreen.isFullscreen()) { + _utils.Fullscreen.requestFullscreen(this.el); + if (!_browser2.default.isiOS) { + this.$el.addClass('fullscreen'); } - }; - - if (!this.container) { - this.listenToOnce(this, _events2.default.MEDIACONTROL_CONTAINERCHANGED, function () { - setWhenContainerReady(); - }); } else { - setWhenContainerReady(); + _utils.Fullscreen.cancelFullscreen(); + if (!_browser2.default.isiOS) { + this.$el.removeClass('fullscreen nocursor'); + } } + this.mediaControl.show(); }; - MediaControl.prototype.toggleFullscreen = function toggleFullscreen() { - this.trigger(_events2.default.MEDIACONTROL_FULLSCREEN, this.name); - this.container.fullscreen(); - this.resetUserKeepVisible(); + Core.prototype.showMediaControl = function showMediaControl(event) { + this.mediaControl.show(event); }; - MediaControl.prototype.setContainer = function setContainer(container) { - if (this.container) { - this.stopListening(this.container); - this.fullScreenOnVideoTagSupported = null; - } - _mediator2.default.off(this.options.playerId + ':' + _events2.default.PLAYER_RESIZE, this.playerResize, this); - this.container = container; - // set the new container to match the volume of the last one - this.setVolume(this.intendedVolume); - this.changeTogglePlay(); - this.addEventListeners(); - this.settingsUpdate(); - this.container.trigger(_events2.default.CONTAINER_PLAYBACKDVRSTATECHANGED, this.container.isDvrInUse()); - if (this.container.mediaControlDisabled) { - this.disable(); - } - this.trigger(_events2.default.MEDIACONTROL_CONTAINERCHANGED); + Core.prototype.hideMediaControl = function hideMediaControl() { + this.mediaControl.hide(this.options.hideMediaControlDelay); }; - MediaControl.prototype.showVolumeBar = function showVolumeBar() { - if (this.hideVolumeId) { - clearTimeout(this.hideVolumeId); - } - this.$volumeBarContainer.removeClass('volume-bar-hide'); + Core.prototype.onMediaControlShow = function onMediaControlShow(showing) { + this.getCurrentContainer().trigger(showing ? _events2.default.CONTAINER_MEDIACONTROL_SHOW : _events2.default.CONTAINER_MEDIACONTROL_HIDE); + + if (showing) this.$el.removeClass('nocursor');else if (_utils.Fullscreen.isFullscreen()) this.$el.addClass('nocursor'); }; - MediaControl.prototype.hideVolumeBar = function hideVolumeBar() { - var _this3 = this; + /** + * enables to configure the container after its creation + * @method configure + * @param {Object} options all the options to change in form of a javascript object + */ - var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 400; - if (!this.$volumeBarContainer) return; - if (this.draggingVolumeBar) { - this.hideVolumeId = setTimeout(function () { - return _this3.hideVolumeBar(); - }, timeout); + Core.prototype.configure = function configure(options) { + var _this7 = this; + + this._options = _clapprZepto2.default.extend(this._options, options); + this.configureDomRecycler(); + var sources = options.source || options.sources; + + if (sources) { + this.load(sources, options.mimeType || this.options.mimeType); } else { - if (this.hideVolumeId) { - clearTimeout(this.hideVolumeId); - } - this.hideVolumeId = setTimeout(function () { - return _this3.$volumeBarContainer.addClass('volume-bar-hide'); - }, timeout); + this.trigger(_events2.default.CORE_OPTIONS_CHANGE); + + this.containers.forEach(function (container) { + container.configure(_this7.options); + }); } }; - MediaControl.prototype.ended = function ended() { - this.changeTogglePlay(); - }; + Core.prototype.render = function render() { + this.$style && this.$style.remove(); + this.$style = _styler2.default.getStyleFor(_style2.default, { baseUrl: this.options.baseUrl }); + this.$el.append(this.$style); + this.$el.append(this.mediaControl.render().el); - MediaControl.prototype.updateProgressBar = function updateProgressBar(progress) { - var loadedStart = progress.start / progress.total * 100; - var loadedEnd = progress.current / progress.total * 100; - this.$seekBarLoaded.css({ left: loadedStart + '%', width: loadedEnd - loadedStart + '%' }); - }; + this.options.width = this.options.width || this.$el.width(); + this.options.height = this.options.height || this.$el.height(); + var size = { width: this.options.width, height: this.options.height }; + this.playerInfo.previousSize = this.playerInfo.currentSize = this.playerInfo.computedSize = size; + this.updateSize(); - MediaControl.prototype.onTimeUpdate = function onTimeUpdate(timeProgress) { - if (this.draggingSeekBar) return; - // TODO why should current time ever be negative? - var position = timeProgress.current < 0 ? timeProgress.total : timeProgress.current; + this.previousSize = { width: this.$el.width(), height: this.$el.height() }; - this.currentPositionValue = position; - this.currentDurationValue = timeProgress.total; - this.renderSeekBar(); + this.enableResizeObserver(); + + return this; }; - MediaControl.prototype.renderSeekBar = function renderSeekBar() { - if (this.currentPositionValue === null || this.currentDurationValue === null) { - // this will be triggered as soon as these beocome available - return; - } + return Core; +}(_ui_object2.default); // Copyright 2014 Globo.com Player authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. - // default to 100% - this.currentSeekBarPercentage = 100; - if (this.container.getPlaybackType() !== _playback2.default.LIVE || this.container.isDvrInUse()) { - this.currentSeekBarPercentage = this.currentPositionValue / this.currentDurationValue * 100; - } - this.setSeekPercentage(this.currentSeekBarPercentage); +exports.default = Core; +module.exports = exports['default']; - var newPosition = (0, _utils.formatTime)(this.currentPositionValue); - var newDuration = (0, _utils.formatTime)(this.currentDurationValue); - if (newPosition !== this.displayedPosition) { - this.$position.text(newPosition); - this.displayedPosition = newPosition; - } - if (newDuration !== this.displayedDuration) { - this.$duration.text(newDuration); - this.displayedDuration = newDuration; - } - }; +/***/ }), +/* 91 */ +/***/ (function(module, exports, __webpack_require__) { - MediaControl.prototype.seek = function seek(event) { - if (!this.settings.seekEnabled) return; - var offsetX = event.pageX - this.$seekBarContainer.offset().left; - var pos = offsetX / this.$seekBarContainer.width() * 100; - pos = Math.min(100, Math.max(pos, 0)); - this.container.seekPercentage(pos); - this.setSeekPercentage(pos); - return false; - }; +"use strict"; - MediaControl.prototype.setKeepVisible = function setKeepVisible() { - this.keepVisible = true; - }; - MediaControl.prototype.resetKeepVisible = function resetKeepVisible() { - this.keepVisible = false; - }; +Object.defineProperty(exports, "__esModule", { + value: true +}); - MediaControl.prototype.setUserKeepVisible = function setUserKeepVisible() { - this.userKeepVisible = true; - }; +var _classCallCheck2 = __webpack_require__(0); - MediaControl.prototype.resetUserKeepVisible = function resetUserKeepVisible() { - this.userKeepVisible = false; - }; +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - MediaControl.prototype.isVisible = function isVisible() { - return !this.$el.hasClass('media-control-hide'); - }; +var _possibleConstructorReturn2 = __webpack_require__(2); - MediaControl.prototype.show = function show(event) { - var _this4 = this; +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - if (this.disabled) { - return; - } - var timeout = 2000; - if (!event || event.clientX !== this.lastMouseX && event.clientY !== this.lastMouseY || navigator.userAgent.match(/firefox/i)) { - clearTimeout(this.hideId); - this.$el.show(); - this.trigger(_events2.default.MEDIACONTROL_SHOW, this.name); - this.$el.removeClass('media-control-hide'); - this.hideId = setTimeout(function () { - return _this4.hide(); - }, timeout); - if (event) { - this.lastMouseX = event.clientX; - this.lastMouseY = event.clientY; - } - } - }; +var _createClass2 = __webpack_require__(3); - MediaControl.prototype.hide = function hide() { - var _this5 = this; +var _createClass3 = _interopRequireDefault(_createClass2); - var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; +var _inherits2 = __webpack_require__(1); - if (!this.isVisible() || _browser2.default.isMobile && !this.container.isPlaying()) { - return; - } - var timeout = delay || 2000; - clearTimeout(this.hideId); - if (!this.disabled && this.options.hideMediaControl === false) { - return; - } - if (!this.disabled && (delay || this.userKeepVisible || this.keepVisible || this.draggingSeekBar || this.draggingVolumeBar)) { - this.hideId = setTimeout(function () { - return _this5.hide(); - }, timeout); - } else { - this.trigger(_events2.default.MEDIACONTROL_HIDE, this.name); - this.$el.addClass('media-control-hide'); - this.hideVolumeBar(0); - } - }; +var _inherits3 = _interopRequireDefault(_inherits2); - MediaControl.prototype.settingsUpdate = function settingsUpdate() { - var newSettings = this.getSettings(); - if (newSettings && !this.fullScreenOnVideoTagSupported && !_utils.Fullscreen.fullscreenEnabled()) { - // remove fullscreen from settings if it is present - newSettings.default && (0, _utils.removeArrayItem)(newSettings.default, 'fullscreen'); - newSettings.left && (0, _utils.removeArrayItem)(newSettings.left, 'fullscreen'); - newSettings.right && (0, _utils.removeArrayItem)(newSettings.right, 'fullscreen'); - } - var settingsChanged = JSON.stringify(this.settings) !== JSON.stringify(newSettings); - if (settingsChanged) { - this.settings = newSettings; - this.render(); - } - }; +var _base_object = __webpack_require__(14); - MediaControl.prototype.getSettings = function getSettings() { - return (0, _lodash2.default)({}, this.container.settings); - }; +var _base_object2 = _interopRequireDefault(_base_object); - MediaControl.prototype.highDefinitionUpdate = function highDefinitionUpdate(isHD) { - var method = isHD ? 'addClass' : 'removeClass'; - this.$hdIndicator[method]('enabled'); - }; +var _core = __webpack_require__(61); - MediaControl.prototype.createCachedElements = function createCachedElements() { - var $layer = this.$el.find('.media-control-layer'); - this.$duration = $layer.find('.media-control-indicator[data-duration]'); - this.$fullscreenToggle = $layer.find('button.media-control-button[data-fullscreen]'); - this.$playPauseToggle = $layer.find('button.media-control-button[data-playpause]'); - this.$playStopToggle = $layer.find('button.media-control-button[data-playstop]'); - this.$position = $layer.find('.media-control-indicator[data-position]'); - this.$seekBarContainer = $layer.find('.bar-container[data-seekbar]'); - this.$seekBarHover = $layer.find('.bar-hover[data-seekbar]'); - this.$seekBarLoaded = $layer.find('.bar-fill-1[data-seekbar]'); - this.$seekBarPosition = $layer.find('.bar-fill-2[data-seekbar]'); - this.$seekBarScrubber = $layer.find('.bar-scrubber[data-seekbar]'); - this.$volumeBarContainer = $layer.find('.bar-container[data-volume]'); - this.$volumeContainer = $layer.find('.drawer-container[data-volume]'); - this.$volumeIcon = $layer.find('.drawer-icon[data-volume]'); - this.$volumeBarBackground = this.$el.find('.bar-background[data-volume]'); - this.$volumeBarFill = this.$el.find('.bar-fill-1[data-volume]'); - this.$volumeBarScrubber = this.$el.find('.bar-scrubber[data-volume]'); - this.$hdIndicator = this.$el.find('button.media-control-button[data-hd-indicator]'); - this.resetIndicators(); - this.initializeIcons(); - }; +var _core2 = _interopRequireDefault(_core); - MediaControl.prototype.resetIndicators = function resetIndicators() { - this.displayedPosition = this.$position.text(); - this.displayedDuration = this.$duration.text(); - }; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - MediaControl.prototype.initializeIcons = function initializeIcons() { - var $layer = this.$el.find('.media-control-layer'); - $layer.find('button.media-control-button[data-play]').append(_play2.default); - $layer.find('button.media-control-button[data-pause]').append(_pause2.default); - $layer.find('button.media-control-button[data-stop]').append(_stop2.default); - this.$playPauseToggle.append(_play2.default); - this.$playStopToggle.append(_play2.default); - this.$volumeIcon.append(_volume2.default); - this.$fullscreenToggle.append(_expand2.default); - this.$hdIndicator.append(_hd2.default); - }; +/** + * The Core Factory is responsible for instantiate the core and it's plugins. + * @class CoreFactory + * @constructor + * @extends BaseObject + * @module components + */ +// Copyright 2014 Globo.com Player authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. - MediaControl.prototype.setSeekPercentage = function setSeekPercentage(value) { - value = Math.max(Math.min(value, 100.0), 0); - if (this.displayedSeekBarPercentage === value) { - // not changed since last update - return; +var CoreFactory = function (_BaseObject) { + (0, _inherits3.default)(CoreFactory, _BaseObject); + (0, _createClass3.default)(CoreFactory, [{ + key: 'loader', + get: function get() { + return this.player.loader; } - this.displayedSeekBarPercentage = value; - this.$seekBarPosition.removeClass('media-control-notransition'); - this.$seekBarScrubber.removeClass('media-control-notransition'); - this.$seekBarPosition.css({ width: value + '%' }); - this.$seekBarScrubber.css({ left: value + '%' }); - }; + /** + * it builds the core factory + * @method constructor + * @param {Player} player the player object + */ - MediaControl.prototype.seekRelative = function seekRelative(delta) { - if (!this.settings.seekEnabled) return; - var currentTime = this.container.getCurrentTime(); - var duration = this.container.getDuration(); - var position = Math.min(Math.max(currentTime + delta, 0), duration); - position = Math.min(position * 100 / duration, 100); - this.container.seekPercentage(position); - }; + }]); - MediaControl.prototype.bindKeyAndShow = function bindKeyAndShow(key, cb) { - var _this6 = this; + function CoreFactory(player) { + (0, _classCallCheck3.default)(this, CoreFactory); - this.kibo.down(key, function () { - _this6.show(); - return cb(); - }); - }; + var _this = (0, _possibleConstructorReturn3.default)(this, _BaseObject.call(this)); - MediaControl.prototype.bindKeyEvents = function bindKeyEvents() { - var _this7 = this; + _this.player = player; + _this._options = player.options; + return _this; + } - this.unbindKeyEvents(); - this.kibo = new _vendor.Kibo(this.options.focusElement); + /** + * creates a core and its plugins + * @method create + * @return {Core} created core + */ - this.bindKeyAndShow('space', function () { - return _this7.togglePlayPause(); - }); - this.bindKeyAndShow('left', function () { - return _this7.seekRelative(-5); - }); - this.bindKeyAndShow('right', function () { - return _this7.seekRelative(5); - }); - this.bindKeyAndShow('shift left', function () { - return _this7.seekRelative(-10); - }); - this.bindKeyAndShow('shift right', function () { - return _this7.seekRelative(10); - }); - this.bindKeyAndShow('shift ctrl left', function () { - return _this7.seekRelative(-15); - }); - this.bindKeyAndShow('shift ctrl right', function () { - return _this7.seekRelative(15); - }); - // this.kibo.down(['']) // should it be here? - var keys = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']; - keys.forEach(function (i) { - _this7.bindKeyAndShow(i, function () { - return _this7.settings.seekEnabled && _this7.container.seekPercentage(i * 10); - }); - }); - }; - MediaControl.prototype.unbindKeyEvents = function unbindKeyEvents() { - if (this.kibo) { - this.kibo.off('space'); - this.kibo.off('left'); - this.kibo.off('right'); - this.kibo.off('shift left'); - this.kibo.off('shift right'); - this.kibo.off('shift ctrl left'); - this.kibo.off('shift ctrl right'); - this.kibo.off(['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']); - } + CoreFactory.prototype.create = function create() { + this.options.loader = this.loader; + this.core = new _core2.default(this.options); + this.addCorePlugins(); + this.core.createContainers(this.options); + return this.core; }; - MediaControl.prototype.parseColors = function parseColors() { - if (this.options.mediacontrol) { - this.buttonsColor = this.options.mediacontrol.buttons; - var seekbarColor = this.options.mediacontrol.seekbar; - this.$el.find('.bar-fill-2[data-seekbar]').css('background-color', seekbarColor); - this.$el.find('.media-control-icon svg path').css('fill', this.buttonsColor); - this.$el.find('.segmented-bar-element[data-volume]').css('boxShadow', 'inset 2px 0 0 ' + this.buttonsColor); - } - }; + /** + * given the core plugins (`loader.corePlugins`) it builds each one + * @method addCorePlugins + * @return {Core} the core with all plugins + */ - MediaControl.prototype.applyButtonStyle = function applyButtonStyle(element) { - if (this.buttonsColor && element) { - (0, _clapprZepto2.default)(element).find('svg path').css('fill', this.buttonsColor); - } - }; - - MediaControl.prototype.destroy = function destroy() { - this.remove(); - (0, _clapprZepto2.default)(document).unbind('mouseup', this.stopDragHandler); - (0, _clapprZepto2.default)(document).unbind('mousemove', this.updateDragHandler); - this.unbindKeyEvents(); - }; - - MediaControl.prototype.render = function render() { - var _this8 = this; - - var timeout = 1000; - this.$el.html(this.template({ settings: this.settings })); - this.$el.append(this.stylesheet); - this.createCachedElements(); - this.$playPauseToggle.addClass('paused'); - this.$playStopToggle.addClass('stopped'); - - this.changeTogglePlay(); - this.hideId = setTimeout(function () { - return _this8.hide(); - }, timeout); - if (this.disabled) { - this.hide(); - } - - if (_browser2.default.isSafari && _browser2.default.isMobile) { - this.$volumeContainer.css('display', 'none'); - } - - this.$seekBarPosition.addClass('media-control-notransition'); - this.$seekBarScrubber.addClass('media-control-notransition'); - var previousSeekPercentage = 0; - if (this.displayedSeekBarPercentage) { - previousSeekPercentage = this.displayedSeekBarPercentage; - } - this.displayedSeekBarPercentage = null; - this.setSeekPercentage(previousSeekPercentage); + CoreFactory.prototype.addCorePlugins = function addCorePlugins() { + var _this2 = this; - process.nextTick(function () { - if (!_this8.settings.seekEnabled) { - _this8.$seekBarContainer.addClass('seek-disabled'); - } - if (!_browser2.default.isMobile && !_this8.options.disableKeyboardShortcuts) { - _this8.bindKeyEvents(); - } - _this8.playerResize({ width: _this8.options.width, height: _this8.options.height }); - _this8.hideVolumeBar(0); + this.loader.corePlugins.forEach(function (Plugin) { + var plugin = new Plugin(_this2.core); + _this2.core.addPlugin(plugin); + _this2.setupExternalInterface(plugin); }); - - this.parseColors(); - this.highDefinitionUpdate(); - - this.rendered = true; - this.updateVolumeUI(); - this.trigger(_events2.default.MEDIACONTROL_RENDERED); - return this; + return this.core; }; - return MediaControl; -}(_ui_object2.default); - -exports.default = MediaControl; + CoreFactory.prototype.setupExternalInterface = function setupExternalInterface(plugin) { + var externalFunctions = plugin.getExternalInterface(); + for (var key in externalFunctions) { + this.player[key] = externalFunctions[key].bind(plugin); + } + }; + return CoreFactory; +}(_base_object2.default); -MediaControl.extend = function (properties) { - return (0, _utils.extend)(MediaControl, properties); -}; +exports.default = CoreFactory; module.exports = exports['default']; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(21))) /***/ }), -/* 47 */ +/* 92 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -10209,1474 +8012,1340 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _player = __webpack_require__(38); +var _core_factory = __webpack_require__(91); -var _player2 = _interopRequireDefault(_player); +var _core_factory2 = _interopRequireDefault(_core_factory); -var _utils = __webpack_require__(1); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _utils2 = _interopRequireDefault(_utils); +exports.default = _core_factory2.default; +module.exports = exports['default']; -var _events = __webpack_require__(0); +/***/ }), +/* 93 */ +/***/ (function(module, exports, __webpack_require__) { -var _events2 = _interopRequireDefault(_events); +"use strict"; -var _playback = __webpack_require__(2); -var _playback2 = _interopRequireDefault(_playback); +Object.defineProperty(exports, "__esModule", { + value: true +}); -var _container_plugin = __webpack_require__(13); +var _create = __webpack_require__(71); -var _container_plugin2 = _interopRequireDefault(_container_plugin); +var _create2 = _interopRequireDefault(_create); -var _core_plugin = __webpack_require__(11); +var _classCallCheck2 = __webpack_require__(0); -var _core_plugin2 = _interopRequireDefault(_core_plugin); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); -var _ui_core_plugin = __webpack_require__(17); +var _possibleConstructorReturn2 = __webpack_require__(2); -var _ui_core_plugin2 = _interopRequireDefault(_ui_core_plugin); +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); -var _ui_container_plugin = __webpack_require__(14); +var _inherits2 = __webpack_require__(1); -var _ui_container_plugin2 = _interopRequireDefault(_ui_container_plugin); +var _inherits3 = _interopRequireDefault(_inherits2); -var _base_object = __webpack_require__(8); +var _base_object = __webpack_require__(14); var _base_object2 = _interopRequireDefault(_base_object); -var _ui_object = __webpack_require__(9); - -var _ui_object2 = _interopRequireDefault(_ui_object); - -var _browser = __webpack_require__(7); - -var _browser2 = _interopRequireDefault(_browser); - -var _container = __webpack_require__(24); +var _player_info = __webpack_require__(33); -var _container2 = _interopRequireDefault(_container); +var _player_info2 = _interopRequireDefault(_player_info); -var _core = __webpack_require__(25); +var _html5_video = __webpack_require__(34); -var _core2 = _interopRequireDefault(_core); +var _html5_video2 = _interopRequireDefault(_html5_video); -var _loader = __webpack_require__(26); +var _flash = __webpack_require__(64); -var _loader2 = _interopRequireDefault(_loader); +var _flash2 = _interopRequireDefault(_flash); -var _mediator = __webpack_require__(10); +var _html5_audio = __webpack_require__(67); -var _mediator2 = _interopRequireDefault(_mediator); +var _html5_audio2 = _interopRequireDefault(_html5_audio); -var _media_control = __webpack_require__(27); +var _flashls = __webpack_require__(65); -var _media_control2 = _interopRequireDefault(_media_control); +var _flashls2 = _interopRequireDefault(_flashls); -var _player_info = __webpack_require__(15); +var _hls = __webpack_require__(66); -var _player_info2 = _interopRequireDefault(_player_info); +var _hls2 = _interopRequireDefault(_hls); -var _base_flash_playback = __webpack_require__(18); +var _html_img = __webpack_require__(68); -var _base_flash_playback2 = _interopRequireDefault(_base_flash_playback); +var _html_img2 = _interopRequireDefault(_html_img); -var _flash = __webpack_require__(28); +var _no_op = __webpack_require__(69); -var _flash2 = _interopRequireDefault(_flash); +var _no_op2 = _interopRequireDefault(_no_op); -var _flashls = __webpack_require__(29); +var _spinner_three_bounce = __webpack_require__(119); -var _flashls2 = _interopRequireDefault(_flashls); +var _spinner_three_bounce2 = _interopRequireDefault(_spinner_three_bounce); -var _hls = __webpack_require__(30); +var _stats = __webpack_require__(121); -var _hls2 = _interopRequireDefault(_hls); +var _stats2 = _interopRequireDefault(_stats); -var _html5_audio = __webpack_require__(31); +var _watermark = __webpack_require__(124); -var _html5_audio2 = _interopRequireDefault(_html5_audio); +var _watermark2 = _interopRequireDefault(_watermark); -var _html5_video = __webpack_require__(16); +var _poster = __webpack_require__(70); -var _html5_video2 = _interopRequireDefault(_html5_video); +var _poster2 = _interopRequireDefault(_poster); -var _html_img = __webpack_require__(32); +var _google_analytics = __webpack_require__(113); -var _html_img2 = _interopRequireDefault(_html_img); +var _google_analytics2 = _interopRequireDefault(_google_analytics); -var _no_op = __webpack_require__(33); +var _click_to_pause = __webpack_require__(106); -var _no_op2 = _interopRequireDefault(_no_op); +var _click_to_pause2 = _interopRequireDefault(_click_to_pause); -var _poster = __webpack_require__(34); +var _dvr_controls = __webpack_require__(108); -var _poster2 = _interopRequireDefault(_poster); +var _dvr_controls2 = _interopRequireDefault(_dvr_controls); -var _log = __webpack_require__(19); +var _favicon = __webpack_require__(111); -var _log2 = _interopRequireDefault(_log); +var _favicon2 = _interopRequireDefault(_favicon); -var _styler = __webpack_require__(4); +var _seek_time = __webpack_require__(116); -var _styler2 = _interopRequireDefault(_styler); +var _seek_time2 = _interopRequireDefault(_seek_time); -var _vendor = __webpack_require__(20); +var _sources = __webpack_require__(118); -var _vendor2 = _interopRequireDefault(_vendor); +var _sources2 = _interopRequireDefault(_sources); -var _template = __webpack_require__(5); +var _end_video = __webpack_require__(109); -var _template2 = _interopRequireDefault(_template); +var _end_video2 = _interopRequireDefault(_end_video); -var _clapprZepto = __webpack_require__(3); +var _strings = __webpack_require__(123); -var _clapprZepto2 = _interopRequireDefault(_clapprZepto); +var _strings2 = _interopRequireDefault(_strings); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var version = "0.2.66"; // Copyright 2014 Globo.com Player authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -exports.default = { - Player: _player2.default, - Mediator: _mediator2.default, - Events: _events2.default, - Browser: _browser2.default, - PlayerInfo: _player_info2.default, - MediaControl: _media_control2.default, - ContainerPlugin: _container_plugin2.default, - UIContainerPlugin: _ui_container_plugin2.default, - CorePlugin: _core_plugin2.default, - UICorePlugin: _ui_core_plugin2.default, - Playback: _playback2.default, - Container: _container2.default, - Core: _core2.default, - Loader: _loader2.default, - BaseObject: _base_object2.default, - UIObject: _ui_object2.default, - Utils: _utils2.default, - BaseFlashPlayback: _base_flash_playback2.default, - Flash: _flash2.default, - FlasHLS: _flashls2.default, - HLS: _hls2.default, - HTML5Audio: _html5_audio2.default, - HTML5Video: _html5_video2.default, - HTMLImg: _html_img2.default, - NoOp: _no_op2.default, - Poster: _poster2.default, - Log: _log2.default, - Styler: _styler2.default, - Vendor: _vendor2.default, - version: version, - template: _template2.default, - $: _clapprZepto2.default -}; -module.exports = exports['default']; - -/***/ }), -/* 48 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * It keeps a list of the default plugins (playback, container, core) and it merges external plugins with its internals. + * @class Loader + * @constructor + * @extends BaseObject + * @module components + */ -"use strict"; +/* Core Plugins */ -Object.defineProperty(exports, "__esModule", { - value: 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; }; }(); +/* Container Plugins */ +var Loader = function (_BaseObject) { + (0, _inherits3.default)(Loader, _BaseObject); -var _playback = __webpack_require__(2); + /** + * builds the loader + * @method constructor + * @param {Object} externalPlugins the external plugins + * @param {Number} playerId you can embed multiple instances of clappr, therefore this is the unique id of each one. + */ + function Loader(externalPlugins, playerId) { + (0, _classCallCheck3.default)(this, Loader); -var _playback2 = _interopRequireDefault(_playback); + var _this = (0, _possibleConstructorReturn3.default)(this, _BaseObject.call(this)); -var _styler = __webpack_require__(4); + _this.playerId = playerId; + _this.playbackPlugins = [_hls2.default, _html5_video2.default, _html5_audio2.default, _flash2.default, _flashls2.default, _html_img2.default, _no_op2.default]; + _this.containerPlugins = [_spinner_three_bounce2.default, _watermark2.default, _poster2.default, _stats2.default, _google_analytics2.default, _click_to_pause2.default]; + _this.corePlugins = [_dvr_controls2.default, _favicon2.default, _seek_time2.default, _sources2.default, _end_video2.default, _strings2.default]; + if (externalPlugins) { + if (!Array.isArray(externalPlugins)) { + _this.validateExternalPluginsType(externalPlugins); + } + _this.addExternalPlugins(externalPlugins); + } + return _this; + } -var _styler2 = _interopRequireDefault(_styler); + /** + * groups by type the external plugins that were passed through `options.plugins` it they're on a flat array + * @method addExternalPlugins + * @private + * @param {Object} an config object or an array of plugins + * @return {Object} plugins the config object with the plugins separated by type + */ -var _template = __webpack_require__(5); -var _template2 = _interopRequireDefault(_template); + Loader.prototype.groupPluginsByType = function groupPluginsByType(plugins) { + if (Array.isArray(plugins)) { + plugins = plugins.reduce(function (memo, plugin) { + memo[plugin.type] || (memo[plugin.type] = []); + memo[plugin.type].push(plugin); + return memo; + }, {}); + } + return plugins; + }; -var _browser = __webpack_require__(7); + Loader.prototype.removeDups = function removeDups(list) { + var groupUp = function groupUp(plugins, plugin) { + plugins[plugin.prototype.name] && delete plugins[plugin.prototype.name]; + plugins[plugin.prototype.name] = plugin; + return plugins; + }; + var pluginsMap = list.reduceRight(groupUp, (0, _create2.default)(null)); -var _browser2 = _interopRequireDefault(_browser); + var plugins = []; + for (var key in pluginsMap) { + plugins.unshift(pluginsMap[key]); + } + return plugins; + }; -var _flash = __webpack_require__(96); + /** + * adds all the external plugins that were passed through `options.plugins` + * @method addExternalPlugins + * @private + * @param {Object} plugins the config object with all plugins + */ -var _flash2 = _interopRequireDefault(_flash); -var _flash3 = __webpack_require__(85); + Loader.prototype.addExternalPlugins = function addExternalPlugins(plugins) { + plugins = this.groupPluginsByType(plugins); + if (plugins.playback) { + this.playbackPlugins = this.removeDups(plugins.playback.concat(this.playbackPlugins)); + } + if (plugins.container) { + this.containerPlugins = this.removeDups(plugins.container.concat(this.containerPlugins)); + } + if (plugins.core) { + this.corePlugins = this.removeDups(plugins.core.concat(this.corePlugins)); + } -var _flash4 = _interopRequireDefault(_flash3); + _player_info2.default.getInstance(this.playerId).playbackPlugins = this.playbackPlugins; + }; -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + /** + * validate if the external plugins that were passed through `options.plugins` are associated to the correct type + * @method validateExternalPluginsType + * @private + * @param {Object} plugins the config object with all plugins + */ -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + Loader.prototype.validateExternalPluginsType = function validateExternalPluginsType(plugins) { + var plugintypes = ['playback', 'container', 'core']; + plugintypes.forEach(function (type) { + (plugins[type] || []).forEach(function (el) { + var errorMessage = 'external ' + el.type + ' plugin on ' + type + ' array'; + if (el.type !== type) { + throw new ReferenceError(errorMessage); + } + }); + }); + }; + + return Loader; +}(_base_object2.default); -function _inherits(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; } // Copyright 2015 Globo.com Player authors. All rights reserved. +/* Playback Plugins */ +// Copyright 2014 Globo.com Player authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -var IE_CLASSID = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'; - -var BaseFlashPlayback = function (_Playback) { - _inherits(BaseFlashPlayback, _Playback); - - function BaseFlashPlayback() { - _classCallCheck(this, BaseFlashPlayback); - - return _possibleConstructorReturn(this, _Playback.apply(this, arguments)); - } +exports.default = Loader; +module.exports = exports['default']; - BaseFlashPlayback.prototype.setElement = function setElement(element) { - this.$el = element; - this.el = element[0]; - }; +/***/ }), +/* 94 */ +/***/ (function(module, exports, __webpack_require__) { - BaseFlashPlayback.prototype._setupFirefox = function _setupFirefox() { - var $el = this.$('embed'); - $el.attr('data-flash-playback', this.name); - $el.addClass(this.attributes.class); - this.setElement($el); - }; +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) { - BaseFlashPlayback.prototype.render = function render() { - this.$el.html(this.template({ - cid: this.cid, - swfPath: this.swfPath, - baseUrl: this.baseUrl, - playbackId: this.uniqueId, - wmode: this.wmode, - callbackName: 'window.Clappr.flashlsCallbacks.' + this.cid })); +Object.defineProperty(exports, "__esModule", { + value: true +}); - if (_browser2.default.isIE) { - this.$('embed').remove(); +var _stringify = __webpack_require__(128); - if (_browser2.default.isLegacyIE) { - this.$el.attr('classid', IE_CLASSID); - } - } +var _stringify2 = _interopRequireDefault(_stringify); - if (_browser2.default.isFirefox) { - this._setupFirefox(); - } +var _classCallCheck2 = __webpack_require__(0); - this.el.id = this.cid; - this.$el.append(_styler2.default.getStyleFor(_flash4.default)); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - return this; - }; +var _possibleConstructorReturn2 = __webpack_require__(2); - _createClass(BaseFlashPlayback, [{ - key: 'tagName', - get: function get() { - return 'object'; - } - }, { - key: 'swfPath', - get: function get() { - return ''; - } - }, { - key: 'wmode', - get: function get() { - return 'transparent'; - } - }, { - key: 'template', - get: function get() { - return (0, _template2.default)(_flash2.default); - } - }, { - key: 'attributes', - get: function get() { - var type = 'application/x-shockwave-flash'; +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - if (_browser2.default.isLegacyIE) { - type = ''; - } +var _createClass2 = __webpack_require__(3); - return { - class: 'clappr-flash-playback', - type: type, - width: '100%', - height: '100%', - 'data-flash-playback': this.name - }; - } - }]); +var _createClass3 = _interopRequireDefault(_createClass2); - return BaseFlashPlayback; -}(_playback2.default); +var _inherits2 = __webpack_require__(1); -exports.default = BaseFlashPlayback; -module.exports = exports['default']; +var _inherits3 = _interopRequireDefault(_inherits2); -/***/ }), -/* 49 */ -/***/ (function(module, exports, __webpack_require__) { +var _utils = __webpack_require__(5); -"use strict"; +var _vendor = __webpack_require__(41); +var _events = __webpack_require__(4); -Object.defineProperty(exports, "__esModule", { - value: true -}); +var _events2 = _interopRequireDefault(_events); -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 _styler = __webpack_require__(8); -var _utils = __webpack_require__(1); +var _styler2 = _interopRequireDefault(_styler); -var _base_flash_playback = __webpack_require__(18); +var _ui_object = __webpack_require__(18); -var _base_flash_playback2 = _interopRequireDefault(_base_flash_playback); +var _ui_object2 = _interopRequireDefault(_ui_object); -var _browser = __webpack_require__(7); +var _browser = __webpack_require__(13); var _browser2 = _interopRequireDefault(_browser); -var _mediator = __webpack_require__(10); +var _mediator = __webpack_require__(22); var _mediator2 = _interopRequireDefault(_mediator); -var _template = __webpack_require__(5); +var _template = __webpack_require__(9); var _template2 = _interopRequireDefault(_template); -var _clapprZepto = __webpack_require__(3); +var _playback = __webpack_require__(7); + +var _playback2 = _interopRequireDefault(_playback); + +var _clapprZepto = __webpack_require__(6); var _clapprZepto2 = _interopRequireDefault(_clapprZepto); -var _events = __webpack_require__(0); +var _mediaControl = __webpack_require__(179); -var _events2 = _interopRequireDefault(_events); +var _mediaControl2 = _interopRequireDefault(_mediaControl); -var _playback = __webpack_require__(2); +var _mediaControl3 = __webpack_require__(190); -var _playback2 = _interopRequireDefault(_playback); +var _mediaControl4 = _interopRequireDefault(_mediaControl3); -var _Player = __webpack_require__(116); +var _play = __webpack_require__(59); -var _Player2 = _interopRequireDefault(_Player); +var _play2 = _interopRequireDefault(_play); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _pause = __webpack_require__(84); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +var _pause2 = _interopRequireDefault(_pause); -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } +var _stop = __webpack_require__(198); -function _inherits(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; } // Copyright 2014 Globo.com Player authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. +var _stop2 = _interopRequireDefault(_stop); -var MAX_ATTEMPTS = 60; +var _volume = __webpack_require__(199); -var Flash = function (_BaseFlashPlayback) { - _inherits(Flash, _BaseFlashPlayback); +var _volume2 = _interopRequireDefault(_volume); + +var _mute = __webpack_require__(200); + +var _mute2 = _interopRequireDefault(_mute); + +var _expand = __webpack_require__(201); + +var _expand2 = _interopRequireDefault(_expand); + +var _shrink = __webpack_require__(202); - _createClass(Flash, [{ +var _shrink2 = _interopRequireDefault(_shrink); + +var _hd = __webpack_require__(203); + +var _hd2 = _interopRequireDefault(_hd); + +var _cc = __webpack_require__(204); + +var _cc2 = _interopRequireDefault(_cc); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var MediaControl = function (_UIObject) { + (0, _inherits3.default)(MediaControl, _UIObject); + (0, _createClass3.default)(MediaControl, [{ key: 'name', get: function get() { - return 'flash'; + return 'MediaControl'; } }, { - key: 'swfPath', + key: 'disabled', get: function get() { - return (0, _template2.default)(_Player2.default)({ baseUrl: this._baseUrl }); + return this.userDisabled || this.container && this.container.getPlaybackType() === _playback2.default.NO_OP; } - - /** - * Determine if the playback has ended. - * @property ended - * @type Boolean - */ - }, { - key: 'ended', + key: 'attributes', get: function get() { - return this._currentState === 'ENDED'; + return { + 'class': 'media-control', + 'data-media-control': '' + }; } - - /** - * Determine if the playback is buffering. - * This is related to the PLAYBACK_BUFFERING and PLAYBACK_BUFFERFULL events - * @property buffering - * @type Boolean - */ - }, { - key: 'buffering', + key: 'events', get: function get() { - return !!this._bufferingState && this._currentState !== 'ENDED'; + return { + 'click [data-play]': 'play', + 'click [data-pause]': 'pause', + 'click [data-playpause]': 'togglePlayPause', + 'click [data-stop]': 'stop', + 'click [data-playstop]': 'togglePlayStop', + 'click [data-fullscreen]': 'toggleFullscreen', + 'click .bar-container[data-seekbar]': 'seek', + 'click .bar-container[data-volume]': 'onVolumeClick', + 'click .drawer-icon[data-volume]': 'toggleMute', + 'click [data-cc-button]': 'toggleClosedCaptions', + 'mouseenter .drawer-container[data-volume]': 'showVolumeBar', + 'mouseleave .drawer-container[data-volume]': 'hideVolumeBar', + 'mousedown .bar-container[data-volume]': 'startVolumeDrag', + 'mousemove .bar-container[data-volume]': 'mousemoveOnVolumeBar', + 'mousedown .bar-scrubber[data-seekbar]': 'startSeekDrag', + 'mousemove .bar-container[data-seekbar]': 'mousemoveOnSeekBar', + 'mouseleave .bar-container[data-seekbar]': 'mouseleaveOnSeekBar', + 'mouseenter .media-control-layer[data-controls]': 'setUserKeepVisible', + 'mouseleave .media-control-layer[data-controls]': 'resetUserKeepVisible' + }; + } + }, { + key: 'template', + get: function get() { + return (0, _template2.default)(_mediaControl4.default); + } + }, { + key: 'stylesheet', + get: function get() { + return _styler2.default.getStyleFor(_mediaControl2.default, { baseUrl: this.options.baseUrl }); + } + }, { + key: 'volume', + get: function get() { + return this.container && this.container.isReady ? this.container.volume : this.intendedVolume; + } + }, { + key: 'muted', + get: function get() { + return this.volume === 0; } }]); - function Flash() { - _classCallCheck(this, Flash); - - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } + function MediaControl(options) { + (0, _classCallCheck3.default)(this, MediaControl); - var _this = _possibleConstructorReturn(this, _BaseFlashPlayback.call.apply(_BaseFlashPlayback, [this].concat(args))); + var _this = (0, _possibleConstructorReturn3.default)(this, _UIObject.call(this, options)); - _this._src = _this.options.src; - _this._baseUrl = _this.options.baseUrl; - _this._autoPlay = _this.options.autoPlay; - _this.settings = { default: ['seekbar'] }; - _this.settings.left = ['playpause', 'position', 'duration']; - _this.settings.right = ['fullscreen', 'volume']; - _this.settings.seekEnabled = true; - _this._isReadyState = false; - _this._addListeners(); - return _this; - } - - Flash.prototype._bootstrap = function _bootstrap() { - var _this2 = this; + _this.persistConfig = _this.options.persistConfig; + _this.container = options.container; + _this.currentPositionValue = null; + _this.currentDurationValue = null; + var initialVolume = _this.persistConfig ? _utils.Config.restore('volume') : 100; + _this.setVolume(_this.options.mute ? 0 : initialVolume); + _this.keepVisible = false; + _this.fullScreenOnVideoTagSupported = null; // unknown + _this.addEventListeners(); + _this.settings = { + left: ['play', 'stop', 'pause'], + right: ['volume'], + default: ['position', 'seekbar', 'duration'] + }; - if (this.el.playerPlay) { - this.el.width = '100%'; - this.el.height = '100%'; - if (this._currentState === 'PLAYING') { - this._firstPlay(); - } else { - this._currentState = 'IDLE'; - this._autoPlay && this.play(); - } - (0, _clapprZepto2.default)('
').insertAfter(this.$el); - if (this.getDuration() > 0) { - this._metadataLoaded(); - } else { - _mediator2.default.once(this.uniqueId + ':timeupdate', this._metadataLoaded, this); + if (_this.container) { + if (!_clapprZepto2.default.isEmptyObject(_this.container.settings)) { + _this.settings = _clapprZepto2.default.extend({}, _this.container.settings); } } else { - this._attempts = this._attempts || 0; - if (++this._attempts <= MAX_ATTEMPTS) { - setTimeout(function () { - return _this2._bootstrap(); - }, 50); - } else { - this.trigger(_events2.default.PLAYBACK_ERROR, { message: 'Max number of attempts reached' }, this.name); + _this.settings = {}; + } + + _this.userDisabled = false; + if (_this.container && _this.container.mediaControlDisabled || _this.options.chromeless) { + _this.disable(); + } + _this.stopDragHandler = function (event) { + return _this.stopDrag(event); + }; + _this.updateDragHandler = function (event) { + return _this.updateDrag(event); + }; + (0, _clapprZepto2.default)(document).bind('mouseup', _this.stopDragHandler); + (0, _clapprZepto2.default)(document).bind('mousemove', _this.updateDragHandler); + return _this; + } + + MediaControl.prototype.addEventListeners = function addEventListeners() { + if (this.container) { + _mediator2.default.on(this.options.playerId + ':' + _events2.default.PLAYER_RESIZE, this.playerResize, this); + this.listenTo(this.container, _events2.default.CONTAINER_PLAY, this.changeTogglePlay); + this.listenTo(this.container, _events2.default.CONTAINER_PAUSE, this.changeTogglePlay); + this.listenTo(this.container, _events2.default.CONTAINER_STOP, this.changeTogglePlay); + this.listenTo(this.container, _events2.default.CONTAINER_DBLCLICK, this.toggleFullscreen); + this.listenTo(this.container, _events2.default.CONTAINER_TIMEUPDATE, this.onTimeUpdate); + this.listenTo(this.container, _events2.default.CONTAINER_PROGRESS, this.updateProgressBar); + this.listenTo(this.container, _events2.default.CONTAINER_SETTINGSUPDATE, this.settingsUpdate); + this.listenTo(this.container, _events2.default.CONTAINER_PLAYBACKDVRSTATECHANGED, this.settingsUpdate); + this.listenTo(this.container, _events2.default.CONTAINER_HIGHDEFINITIONUPDATE, this.highDefinitionUpdate); + this.listenTo(this.container, _events2.default.CONTAINER_LOADEDTEXTTRACK, this.ccAvailable.bind(this, true)); + this.listenTo(this.container, _events2.default.CONTAINER_MEDIACONTROL_DISABLE, this.disable); + this.listenTo(this.container, _events2.default.CONTAINER_MEDIACONTROL_ENABLE, this.enable); + this.listenTo(this.container, _events2.default.CONTAINER_ENDED, this.ended); + this.listenTo(this.container, _events2.default.CONTAINER_VOLUME, this.onVolumeChanged); + if (this.container.playback.el.nodeName.toLowerCase() === 'video') { + // wait until the metadata has loaded and then check if fullscreen on video tag is supported + this.listenToOnce(this.container, _events2.default.CONTAINER_LOADEDMETADATA, this.onLoadedMetadataOnVideoTag); } } }; - Flash.prototype._metadataLoaded = function _metadataLoaded() { - this._isReadyState = true; - this.trigger(_events2.default.PLAYBACK_READY, this.name); - this.trigger(_events2.default.PLAYBACK_SETTINGSUPDATE, this.name); + MediaControl.prototype.disable = function disable() { + this.userDisabled = true; + this.hide(); + this.$el.hide(); }; - Flash.prototype.getPlaybackType = function getPlaybackType() { - return _playback2.default.VOD; + MediaControl.prototype.enable = function enable() { + if (this.options.chromeless) return; + this.userDisabled = false; + this.show(); }; - Flash.prototype.isHighDefinitionInUse = function isHighDefinitionInUse() { - return false; + MediaControl.prototype.play = function play() { + this.container.play(); }; - Flash.prototype._updateTime = function _updateTime() { - this.trigger(_events2.default.PLAYBACK_TIMEUPDATE, { current: this.el.getPosition(), total: this.el.getDuration() }, this.name); + MediaControl.prototype.pause = function pause() { + this.container.pause(); }; - Flash.prototype._addListeners = function _addListeners() { - _mediator2.default.on(this.uniqueId + ':progress', this._progress, this); - _mediator2.default.on(this.uniqueId + ':timeupdate', this._updateTime, this); - _mediator2.default.on(this.uniqueId + ':statechanged', this._checkState, this); - _mediator2.default.on(this.uniqueId + ':flashready', this._bootstrap, this); + MediaControl.prototype.stop = function stop() { + this.container.stop(); }; - Flash.prototype.stopListening = function stopListening() { - _BaseFlashPlayback.prototype.stopListening.call(this); - _mediator2.default.off(this.uniqueId + ':progress'); - _mediator2.default.off(this.uniqueId + ':timeupdate'); - _mediator2.default.off(this.uniqueId + ':statechanged'); - _mediator2.default.off(this.uniqueId + ':flashready'); + MediaControl.prototype.onVolumeChanged = function onVolumeChanged() { + this.updateVolumeUI(); }; - Flash.prototype._checkState = function _checkState() { - if (this._isIdle || this._currentState === 'PAUSED') { - return; - } else if (this._currentState !== 'PLAYING_BUFFERING' && this.el.getState() === 'PLAYING_BUFFERING') { - this._bufferingState = true; - this.trigger(_events2.default.PLAYBACK_BUFFERING, this.name); - this._currentState = 'PLAYING_BUFFERING'; - } else if (this.el.getState() === 'PLAYING') { - this._bufferingState = false; - this.trigger(_events2.default.PLAYBACK_BUFFERFULL, this.name); - this._currentState = 'PLAYING'; - } else if (this.el.getState() === 'IDLE') { - this._currentState = 'IDLE'; - } else if (this.el.getState() === 'ENDED') { - this.trigger(_events2.default.PLAYBACK_ENDED, this.name); - this.trigger(_events2.default.PLAYBACK_TIMEUPDATE, { current: 0, total: this.el.getDuration() }, this.name); - this._currentState = 'ENDED'; - this._isIdle = true; + MediaControl.prototype.onLoadedMetadataOnVideoTag = function onLoadedMetadataOnVideoTag() { + var video = this.container.playback.el; + // video.webkitSupportsFullscreen is deprecated but iOS appears to only use this + // see https://github.com/clappr/clappr/issues/1127 + if (!_utils.Fullscreen.fullscreenEnabled() && video.webkitSupportsFullscreen) { + this.fullScreenOnVideoTagSupported = true; + this.settingsUpdate(); } }; - Flash.prototype._progress = function _progress() { - if (this._currentState !== 'IDLE' && this._currentState !== 'ENDED') { - this.trigger(_events2.default.PLAYBACK_PROGRESS, { - start: 0, - current: this.el.getBytesLoaded(), - total: this.el.getBytesTotal() - }); + MediaControl.prototype.updateVolumeUI = function updateVolumeUI() { + if (!this.rendered) { + // this will be called after a render + return; } - }; - - Flash.prototype._firstPlay = function _firstPlay() { - var _this3 = this; + // update volume bar scrubber/fill on bar mode + this.$volumeBarContainer.find('.bar-fill-2').css({}); + var containerWidth = this.$volumeBarContainer.width(); + var barWidth = this.$volumeBarBackground.width(); + var offset = (containerWidth - barWidth) / 2.0; + var pos = barWidth * this.volume / 100.0 + offset; + this.$volumeBarFill.css({ width: this.volume + '%' }); + this.$volumeBarScrubber.css({ left: pos }); - if (this.el.playerPlay) { - this._isIdle = false; - this.el.playerPlay(this._src); - this.listenToOnce(this, _events2.default.PLAYBACK_BUFFERFULL, function () { - return _this3._checkInitialSeek(); - }); - this._currentState = 'PLAYING'; + // update volume bar segments on segmented bar mode + this.$volumeBarContainer.find('.segmented-bar-element').removeClass('fill'); + var item = Math.ceil(this.volume / 10.0); + this.$volumeBarContainer.find('.segmented-bar-element').slice(0, item).addClass('fill'); + this.$volumeIcon.html(''); + this.$volumeIcon.removeClass('muted'); + if (!this.muted) { + this.$volumeIcon.append(_volume2.default); } else { - this.listenToOnce(this, _events2.default.PLAYBACK_READY, this._firstPlay); + this.$volumeIcon.append(_mute2.default); + this.$volumeIcon.addClass('muted'); } + this.applyButtonStyle(this.$volumeIcon); }; - Flash.prototype._checkInitialSeek = function _checkInitialSeek() { - var seekTime = (0, _utils.seekStringToSeconds)(window.location.href); - if (seekTime !== 0) { - this.seekSeconds(seekTime); + MediaControl.prototype.changeTogglePlay = function changeTogglePlay() { + this.$playPauseToggle.html(''); + this.$playStopToggle.html(''); + if (this.container && this.container.isPlaying()) { + this.$playPauseToggle.append(_pause2.default); + this.$playStopToggle.append(_stop2.default); + this.trigger(_events2.default.MEDIACONTROL_PLAYING); + } else { + this.$playPauseToggle.append(_play2.default); + this.$playStopToggle.append(_play2.default); + this.trigger(_events2.default.MEDIACONTROL_NOTPLAYING); + if (_browser2.default.isMobile) { + this.show(); + } } + this.applyButtonStyle(this.$playPauseToggle); + this.applyButtonStyle(this.$playStopToggle); }; - Flash.prototype.play = function play() { - this.trigger(_events2.default.PLAYBACK_PLAY_INTENT); - if (this._currentState === 'PAUSED' || this._currentState === 'PLAYING_BUFFERING') { - this._currentState = 'PLAYING'; - this.el.playerResume(); - this.trigger(_events2.default.PLAYBACK_PLAY, this.name); - } else if (this._currentState !== 'PLAYING') { - this._firstPlay(); - this.trigger(_events2.default.PLAYBACK_PLAY, this.name); + MediaControl.prototype.mousemoveOnSeekBar = function mousemoveOnSeekBar(event) { + if (this.settings.seekEnabled) { + var offsetX = event.pageX - this.$seekBarContainer.offset().left - this.$seekBarHover.width() / 2; + this.$seekBarHover.css({ left: offsetX }); } + this.trigger(_events2.default.MEDIACONTROL_MOUSEMOVE_SEEKBAR, event); }; - Flash.prototype.volume = function volume(value) { - var _this4 = this; + MediaControl.prototype.mouseleaveOnSeekBar = function mouseleaveOnSeekBar(event) { + this.trigger(_events2.default.MEDIACONTROL_MOUSELEAVE_SEEKBAR, event); + }; - if (this.isReady) { - this.el.playerVolume(value); - } else { - this.listenToOnce(this, _events2.default.PLAYBACK_BUFFERFULL, function () { - return _this4.volume(value); - }); - } + MediaControl.prototype.onVolumeClick = function onVolumeClick(event) { + this.setVolume(this.getVolumeFromUIEvent(event)); }; - Flash.prototype.pause = function pause() { - this._currentState = 'PAUSED'; - this.el.playerPause(); - this.trigger(_events2.default.PLAYBACK_PAUSE, this.name); + MediaControl.prototype.mousemoveOnVolumeBar = function mousemoveOnVolumeBar(event) { + if (this.draggingVolumeBar) { + this.setVolume(this.getVolumeFromUIEvent(event)); + } }; - Flash.prototype.stop = function stop() { - this.el.playerStop(); - this.trigger(_events2.default.PLAYBACK_STOP); - this.trigger(_events2.default.PLAYBACK_TIMEUPDATE, { current: 0, total: 0 }, this.name); + MediaControl.prototype.playerResize = function playerResize(size) { + this.$fullscreenToggle.html(''); + if (_utils.Fullscreen.isFullscreen()) { + this.$fullscreenToggle.append(_shrink2.default); + } else { + this.$fullscreenToggle.append(_expand2.default); + } + this.applyButtonStyle(this.$fullscreenToggle); + this.$el.removeClass('w320'); + if (size.width <= 320 || this.options.hideVolumeBar) { + this.$el.addClass('w320'); + } }; - Flash.prototype.isPlaying = function isPlaying() { - return !!(this.isReady && this._currentState.indexOf('PLAYING') > -1); + MediaControl.prototype.toggleClosedCaptions = function toggleClosedCaptions() { + if (this.container.playback.el.textTracks[0].mode === 'showing') { + this.container.playback.el.textTracks[0].mode = 'hidden'; + this.$ccButton.removeClass('enabled'); + } else { + this.container.playback.el.textTracks[0].mode = 'showing'; + this.$ccButton.addClass('enabled'); + } }; - Flash.prototype.getDuration = function getDuration() { - return this.el.getDuration(); + MediaControl.prototype.togglePlayPause = function togglePlayPause() { + if (this.container.isPlaying()) { + this.container.pause(); + } else { + this.container.play(); + } + return false; }; - Flash.prototype.seekPercentage = function seekPercentage(percentage) { - var _this5 = this; - - if (this.el.getDuration() > 0) { - var seekSeconds = this.el.getDuration() * (percentage / 100); - this.seek(seekSeconds); + MediaControl.prototype.togglePlayStop = function togglePlayStop() { + if (this.container.isPlaying()) { + this.container.stop(); } else { - this.listenToOnce(this, _events2.default.PLAYBACK_BUFFERFULL, function () { - return _this5.seekPercentage(percentage); - }); + this.container.play(); } }; - Flash.prototype.seek = function seek(time) { - var _this6 = this; - - if (this.isReady && this.el.playerSeek) { - this.el.playerSeek(time); - this.trigger(_events2.default.PLAYBACK_TIMEUPDATE, { current: time, total: this.el.getDuration() }, this.name); - if (this._currentState === 'PAUSED') { - this.el.playerPause(); - } - } else { - this.listenToOnce(this, _events2.default.PLAYBACK_BUFFERFULL, function () { - return _this6.seek(time); - }); + MediaControl.prototype.startSeekDrag = function startSeekDrag(event) { + if (!this.settings.seekEnabled) return; + this.draggingSeekBar = true; + this.$el.addClass('dragging'); + this.$seekBarLoaded.addClass('media-control-notransition'); + this.$seekBarPosition.addClass('media-control-notransition'); + this.$seekBarScrubber.addClass('media-control-notransition'); + if (event) { + event.preventDefault(); } }; - Flash.prototype.destroy = function destroy() { - clearInterval(this.bootstrapId); - _BaseFlashPlayback.prototype.stopListening.call(this); - this.$el.remove(); + MediaControl.prototype.startVolumeDrag = function startVolumeDrag(event) { + this.draggingVolumeBar = true; + this.$el.addClass('dragging'); + if (event) { + event.preventDefault(); + } }; - _createClass(Flash, [{ - key: 'isReady', - get: function get() { - return this._isReadyState; + MediaControl.prototype.stopDrag = function stopDrag(event) { + if (this.draggingSeekBar) { + this.seek(event); } - }]); + this.$el.removeClass('dragging'); + this.$seekBarLoaded.removeClass('media-control-notransition'); + this.$seekBarPosition.removeClass('media-control-notransition'); + this.$seekBarScrubber.removeClass('media-control-notransition dragging'); + this.draggingSeekBar = false; + this.draggingVolumeBar = false; + }; - return Flash; -}(_base_flash_playback2.default); + MediaControl.prototype.updateDrag = function updateDrag(event) { + if (this.draggingSeekBar) { + event.preventDefault(); + var offsetX = event.pageX - this.$seekBarContainer.offset().left; + var pos = offsetX / this.$seekBarContainer.width() * 100; + pos = Math.min(100, Math.max(pos, 0)); + this.setSeekPercentage(pos); + } else if (this.draggingVolumeBar) { + event.preventDefault(); + this.setVolume(this.getVolumeFromUIEvent(event)); + } + }; -exports.default = Flash; + MediaControl.prototype.getVolumeFromUIEvent = function getVolumeFromUIEvent(event) { + var offsetY = event.pageX - this.$volumeBarContainer.offset().left; + var volumeFromUI = offsetY / this.$volumeBarContainer.width() * 100; + return volumeFromUI; + }; + MediaControl.prototype.toggleMute = function toggleMute() { + this.setVolume(this.muted ? 100 : 0); + }; -Flash.canPlay = function (resource) { - if (!_browser2.default.hasFlash || !resource || resource.constructor !== String) { - return false; - } else { - var resourceParts = resource.split('?')[0].match(/.*\.(.*)$/) || []; - return resourceParts.length > 1 && !_browser2.default.isMobile && resourceParts[1].toLowerCase().match(/^(mp4|mov|f4v|3gpp|3gp)$/); - } -}; -module.exports = exports['default']; + MediaControl.prototype.setVolume = function setVolume(value) { + var _this2 = this; -/***/ }), -/* 50 */ -/***/ (function(module, exports, __webpack_require__) { + value = Math.min(100, Math.max(value, 0)); + // this will hold the intended volume + // it may not actually get set to this straight away + // if the container is not ready etc + this.intendedVolume = value; + this.persistConfig && _utils.Config.persist('volume', value); + var setWhenContainerReady = function setWhenContainerReady() { + if (_this2.container.isReady) { + _this2.container.setVolume(value); + } else { + _this2.listenToOnce(_this2.container, _events2.default.CONTAINER_READY, function () { + _this2.container.setVolume(value); + }); + } + }; -"use strict"; + if (!this.container) { + this.listenToOnce(this, _events2.default.MEDIACONTROL_CONTAINERCHANGED, function () { + setWhenContainerReady(); + }); + } else { + setWhenContainerReady(); + } + }; + MediaControl.prototype.toggleFullscreen = function toggleFullscreen() { + this.trigger(_events2.default.MEDIACONTROL_FULLSCREEN, this.name); + this.container.fullscreen(); + this.resetUserKeepVisible(); + }; -Object.defineProperty(exports, "__esModule", { - value: true -}); + MediaControl.prototype.setContainer = function setContainer(container) { + if (this.container) { + this.stopListening(this.container); + this.fullScreenOnVideoTagSupported = null; + } + _mediator2.default.off(this.options.playerId + ':' + _events2.default.PLAYER_RESIZE, this.playerResize, this); + this.container = container; + // set the new container to match the volume of the last one + this.setVolume(this.intendedVolume); + this.changeTogglePlay(); + this.addEventListeners(); + this.settingsUpdate(); + this.container.trigger(_events2.default.CONTAINER_PLAYBACKDVRSTATECHANGED, this.container.isDvrInUse()); + if (this.container.mediaControlDisabled) { + this.disable(); + } + this.trigger(_events2.default.MEDIACONTROL_CONTAINERCHANGED); + }; -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; }; }(); + MediaControl.prototype.showVolumeBar = function showVolumeBar() { + if (this.hideVolumeId) { + clearTimeout(this.hideVolumeId); + } + this.$volumeBarContainer.removeClass('volume-bar-hide'); + }; -var _base_flash_playback = __webpack_require__(18); + MediaControl.prototype.hideVolumeBar = function hideVolumeBar() { + var _this3 = this; -var _base_flash_playback2 = _interopRequireDefault(_base_flash_playback); + var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 400; -var _events = __webpack_require__(0); + if (!this.$volumeBarContainer) return; + if (this.draggingVolumeBar) { + this.hideVolumeId = setTimeout(function () { + return _this3.hideVolumeBar(); + }, timeout); + } else { + if (this.hideVolumeId) { + clearTimeout(this.hideVolumeId); + } + this.hideVolumeId = setTimeout(function () { + return _this3.$volumeBarContainer.addClass('volume-bar-hide'); + }, timeout); + } + }; -var _events2 = _interopRequireDefault(_events); + MediaControl.prototype.ended = function ended() { + this.changeTogglePlay(); + }; -var _template = __webpack_require__(5); + MediaControl.prototype.updateProgressBar = function updateProgressBar(progress) { + var loadedStart = progress.start / progress.total * 100; + var loadedEnd = progress.current / progress.total * 100; + this.$seekBarLoaded.css({ left: loadedStart + '%', width: loadedEnd - loadedStart + '%' }); + }; -var _template2 = _interopRequireDefault(_template); + MediaControl.prototype.onTimeUpdate = function onTimeUpdate(timeProgress) { + if (this.draggingSeekBar) return; + // TODO why should current time ever be negative? + var position = timeProgress.current < 0 ? timeProgress.total : timeProgress.current; -var _playback = __webpack_require__(2); + this.currentPositionValue = position; + this.currentDurationValue = timeProgress.total; + this.renderSeekBar(); + }; -var _playback2 = _interopRequireDefault(_playback); + MediaControl.prototype.renderSeekBar = function renderSeekBar() { + if (this.currentPositionValue === null || this.currentDurationValue === null) { + // this will be triggered as soon as these beocome available + return; + } -var _mediator = __webpack_require__(10); + // default to 100% + this.currentSeekBarPercentage = 100; + if (this.container.getPlaybackType() !== _playback2.default.LIVE || this.container.isDvrInUse()) { + this.currentSeekBarPercentage = this.currentPositionValue / this.currentDurationValue * 100; + } + this.setSeekPercentage(this.currentSeekBarPercentage); -var _mediator2 = _interopRequireDefault(_mediator); + var newPosition = (0, _utils.formatTime)(this.currentPositionValue); + var newDuration = (0, _utils.formatTime)(this.currentDurationValue); + if (newPosition !== this.displayedPosition) { + this.$position.text(newPosition); + this.displayedPosition = newPosition; + } + if (newDuration !== this.displayedDuration) { + this.$duration.text(newDuration); + this.displayedDuration = newDuration; + } + }; -var _browser = __webpack_require__(7); + MediaControl.prototype.seek = function seek(event) { + if (!this.settings.seekEnabled) return; + var offsetX = event.pageX - this.$seekBarContainer.offset().left; + var pos = offsetX / this.$seekBarContainer.width() * 100; + pos = Math.min(100, Math.max(pos, 0)); + this.container.seekPercentage(pos); + this.setSeekPercentage(pos); + return false; + }; -var _browser2 = _interopRequireDefault(_browser); + MediaControl.prototype.setKeepVisible = function setKeepVisible() { + this.keepVisible = true; + }; -var _flashls_events = __webpack_require__(51); + MediaControl.prototype.resetKeepVisible = function resetKeepVisible() { + this.keepVisible = false; + }; -var _flashls_events2 = _interopRequireDefault(_flashls_events); + MediaControl.prototype.setUserKeepVisible = function setUserKeepVisible() { + this.userKeepVisible = true; + }; -var _HLSPlayer = __webpack_require__(117); + MediaControl.prototype.resetUserKeepVisible = function resetUserKeepVisible() { + this.userKeepVisible = false; + }; -var _HLSPlayer2 = _interopRequireDefault(_HLSPlayer); + MediaControl.prototype.isVisible = function isVisible() { + return !this.$el.hasClass('media-control-hide'); + }; -var _clapprZepto = __webpack_require__(3); + MediaControl.prototype.show = function show(event) { + var _this4 = this; -var _clapprZepto2 = _interopRequireDefault(_clapprZepto); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(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; } // Copyright 2014 Globo.com Player authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. + if (this.disabled) { + return; + } + var timeout = 2000; + if (!event || event.clientX !== this.lastMouseX && event.clientY !== this.lastMouseY || navigator.userAgent.match(/firefox/i)) { + clearTimeout(this.hideId); + this.$el.show(); + this.trigger(_events2.default.MEDIACONTROL_SHOW, this.name); + this.$el.removeClass('media-control-hide'); + this.hideId = setTimeout(function () { + return _this4.hide(); + }, timeout); + if (event) { + this.lastMouseX = event.clientX; + this.lastMouseY = event.clientY; + } + } + }; -var MAX_ATTEMPTS = 60; -var AUTO = -1; + MediaControl.prototype.hide = function hide() { + var _this5 = this; -var FlasHLS = function (_BaseFlashPlayback) { - _inherits(FlasHLS, _BaseFlashPlayback); + var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; - _createClass(FlasHLS, [{ - key: 'name', - get: function get() { - return 'flashls'; + if (!this.isVisible() || _browser2.default.isMobile && !this.container.isPlaying()) { + return; } - }, { - key: 'swfPath', - get: function get() { - return (0, _template2.default)(_HLSPlayer2.default)({ baseUrl: this._baseUrl }); + var timeout = delay || 2000; + clearTimeout(this.hideId); + if (!this.disabled && this.options.hideMediaControl === false) { + return; } - }, { - key: 'levels', - get: function get() { - return this._levels || []; + if (!this.disabled && (delay || this.userKeepVisible || this.keepVisible || this.draggingSeekBar || this.draggingVolumeBar)) { + this.hideId = setTimeout(function () { + return _this5.hide(); + }, timeout); + } else { + this.trigger(_events2.default.MEDIACONTROL_HIDE, this.name); + this.$el.addClass('media-control-hide'); + this.hideVolumeBar(0); } - }, { - key: 'currentLevel', - get: function get() { - if (this._currentLevel === null || this._currentLevel === undefined) { - return AUTO; - } else { - return this._currentLevel; //0 is a valid level ID - } - }, - set: function set(id) { - this._currentLevel = id; - this.trigger(_events2.default.PLAYBACK_LEVEL_SWITCH_START); - this.el.playerSetCurrentLevel(id); + }; + + MediaControl.prototype.settingsUpdate = function settingsUpdate() { + var newSettings = this.getSettings(); + if (newSettings && !this.fullScreenOnVideoTagSupported && !_utils.Fullscreen.fullscreenEnabled()) { + // remove fullscreen from settings if it is present + newSettings.default && (0, _utils.removeArrayItem)(newSettings.default, 'fullscreen'); + newSettings.left && (0, _utils.removeArrayItem)(newSettings.left, 'fullscreen'); + newSettings.right && (0, _utils.removeArrayItem)(newSettings.right, 'fullscreen'); + } + var settingsChanged = (0, _stringify2.default)(this.settings) !== (0, _stringify2.default)(newSettings); + if (settingsChanged) { + this.settings = newSettings; + this.render(); } + }; - /** - * Determine if the playback has ended. - * @property ended - * @type Boolean - */ + MediaControl.prototype.getSettings = function getSettings() { + return _clapprZepto2.default.extend(true, {}, this.container.settings); + }; - }, { - key: 'ended', - get: function get() { - return this._hasEnded; - } + MediaControl.prototype.highDefinitionUpdate = function highDefinitionUpdate(isHD) { + var method = isHD ? 'addClass' : 'removeClass'; + this.$hdIndicator[method]('enabled'); + }; - /** - * Determine if the playback is buffering. - * This is related to the PLAYBACK_BUFFERING and PLAYBACK_BUFFERFULL events - * @property buffering - * @type Boolean - */ + MediaControl.prototype.ccAvailable = function ccAvailable(hasCC) { + var method = hasCC ? 'addClass' : 'removeClass'; + this.$ccButton[method]('available'); + }; - }, { - key: 'buffering', - get: function get() { - return !!this._bufferingState && !this._hasEnded; - } - }]); + MediaControl.prototype.createCachedElements = function createCachedElements() { + var $layer = this.$el.find('.media-control-layer'); + this.$duration = $layer.find('.media-control-indicator[data-duration]'); + this.$fullscreenToggle = $layer.find('button.media-control-button[data-fullscreen]'); + this.$playPauseToggle = $layer.find('button.media-control-button[data-playpause]'); + this.$playStopToggle = $layer.find('button.media-control-button[data-playstop]'); + this.$position = $layer.find('.media-control-indicator[data-position]'); + this.$seekBarContainer = $layer.find('.bar-container[data-seekbar]'); + this.$seekBarHover = $layer.find('.bar-hover[data-seekbar]'); + this.$seekBarLoaded = $layer.find('.bar-fill-1[data-seekbar]'); + this.$seekBarPosition = $layer.find('.bar-fill-2[data-seekbar]'); + this.$seekBarScrubber = $layer.find('.bar-scrubber[data-seekbar]'); + this.$volumeBarContainer = $layer.find('.bar-container[data-volume]'); + this.$volumeContainer = $layer.find('.drawer-container[data-volume]'); + this.$volumeIcon = $layer.find('.drawer-icon[data-volume]'); + this.$volumeBarBackground = this.$el.find('.bar-background[data-volume]'); + this.$volumeBarFill = this.$el.find('.bar-fill-1[data-volume]'); + this.$volumeBarScrubber = this.$el.find('.bar-scrubber[data-volume]'); + this.$hdIndicator = this.$el.find('button.media-control-button[data-hd-indicator]'); + this.$ccButton = this.$el.find('button.media-control-button[data-cc-button]'); + this.resetIndicators(); + this.initializeIcons(); + }; - function FlasHLS() { - _classCallCheck(this, FlasHLS); + MediaControl.prototype.resetIndicators = function resetIndicators() { + this.displayedPosition = this.$position.text(); + this.displayedDuration = this.$duration.text(); + }; - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; + MediaControl.prototype.initializeIcons = function initializeIcons() { + var $layer = this.$el.find('.media-control-layer'); + $layer.find('button.media-control-button[data-play]').append(_play2.default); + $layer.find('button.media-control-button[data-pause]').append(_pause2.default); + $layer.find('button.media-control-button[data-stop]').append(_stop2.default); + this.$playPauseToggle.append(_play2.default); + this.$playStopToggle.append(_play2.default); + this.$volumeIcon.append(_volume2.default); + this.$fullscreenToggle.append(_expand2.default); + this.$hdIndicator.append(_hd2.default); + this.$ccButton.append(_cc2.default); + }; + + MediaControl.prototype.setSeekPercentage = function setSeekPercentage(value) { + value = Math.max(Math.min(value, 100.0), 0); + if (this.displayedSeekBarPercentage === value) { + // not changed since last update + return; } + this.displayedSeekBarPercentage = value; - var _this = _possibleConstructorReturn(this, _BaseFlashPlayback.call.apply(_BaseFlashPlayback, [this].concat(args))); + this.$seekBarPosition.removeClass('media-control-notransition'); + this.$seekBarScrubber.removeClass('media-control-notransition'); + this.$seekBarPosition.css({ width: value + '%' }); + this.$seekBarScrubber.css({ left: value + '%' }); + }; - _this._src = _this.options.src; - _this._baseUrl = _this.options.baseUrl; - _this._initHlsParameters(_this.options); - // TODO can this be private? - _this.highDefinition = false; - _this._autoPlay = _this.options.autoPlay; - _this._loop = _this.options.loop; - _this._defaultSettings = { - left: ['playstop'], - default: ['seekbar'], - right: ['fullscreen', 'volume', 'hd-indicator'], - seekEnabled: false - }; - _this.settings = _clapprZepto2.default.extend({}, _this._defaultSettings); - _this._playbackType = _playback2.default.LIVE; - _this._hasEnded = false; - _this._addListeners(); - return _this; - } + MediaControl.prototype.seekRelative = function seekRelative(delta) { + if (!this.settings.seekEnabled) return; + var currentTime = this.container.getCurrentTime(); + var duration = this.container.getDuration(); + var position = Math.min(Math.max(currentTime + delta, 0), duration); + position = Math.min(position * 100 / duration, 100); + this.container.seekPercentage(position); + }; - FlasHLS.prototype._initHlsParameters = function _initHlsParameters(options) { - this._autoStartLoad = options.autoStartLoad === undefined ? true : options.autoStartLoad; - this._capLevelToStage = options.capLevelToStage === undefined ? false : options.capLevelToStage; - this._maxLevelCappingMode = options.maxLevelCappingMode === undefined ? 'downscale' : options.maxLevelCappingMode; - this._minBufferLength = options.minBufferLength === undefined ? -1 : options.minBufferLength; - this._minBufferLengthCapping = options.minBufferLengthCapping === undefined ? -1 : options.minBufferLengthCapping; - this._maxBufferLength = options.maxBufferLength === undefined ? 120 : options.maxBufferLength; - this._maxBackBufferLength = options.maxBackBufferLength === undefined ? 30 : options.maxBackBufferLength; - this._lowBufferLength = options.lowBufferLength === undefined ? 3 : options.lowBufferLength; - this._mediaTimePeriod = options.mediaTimePeriod === undefined ? 100 : options.mediaTimePeriod; - this._fpsDroppedMonitoringPeriod = options.fpsDroppedMonitoringPeriod === undefined ? 5000 : options.fpsDroppedMonitoringPeriod; - this._fpsDroppedMonitoringThreshold = options.fpsDroppedMonitoringThreshold === undefined ? 0.2 : options.fpsDroppedMonitoringThreshold; - this._capLevelonFPSDrop = options.capLevelonFPSDrop === undefined ? false : options.capLevelonFPSDrop; - this._smoothAutoSwitchonFPSDrop = options.smoothAutoSwitchonFPSDrop === undefined ? this.capLevelonFPSDrop : options.smoothAutoSwitchonFPSDrop; - this._switchDownOnLevelError = options.switchDownOnLevelError === undefined ? true : options.switchDownOnLevelError; - this._seekMode = options.seekMode === undefined ? 'ACCURATE' : options.seekMode; - this._keyLoadMaxRetry = options.keyLoadMaxRetry === undefined ? 3 : options.keyLoadMaxRetry; - this._keyLoadMaxRetryTimeout = options.keyLoadMaxRetryTimeout === undefined ? 64000 : options.keyLoadMaxRetryTimeout; - this._fragmentLoadMaxRetry = options.fragmentLoadMaxRetry === undefined ? 3 : options.fragmentLoadMaxRetry; - this._fragmentLoadMaxRetryTimeout = options.fragmentLoadMaxRetryTimeout === undefined ? 4000 : options.fragmentLoadMaxRetryTimeout; - this._fragmentLoadSkipAfterMaxRetry = options.fragmentLoadSkipAfterMaxRetry === undefined ? true : options.fragmentLoadSkipAfterMaxRetry; - this._maxSkippedFragments = options.maxSkippedFragments === undefined ? 5 : options.maxSkippedFragments; - this._flushLiveURLCache = options.flushLiveURLCache === undefined ? false : options.flushLiveURLCache; - this._initialLiveManifestSize = options.initialLiveManifestSize === undefined ? 1 : options.initialLiveManifestSize; - this._manifestLoadMaxRetry = options.manifestLoadMaxRetry === undefined ? 3 : options.manifestLoadMaxRetry; - this._manifestLoadMaxRetryTimeout = options.manifestLoadMaxRetryTimeout === undefined ? 64000 : options.manifestLoadMaxRetryTimeout; - this._manifestRedundantLoadmaxRetry = options.manifestRedundantLoadmaxRetry === undefined ? 3 : options.manifestRedundantLoadmaxRetry; - this._startFromBitrate = options.startFromBitrate === undefined ? -1 : options.startFromBitrate; - this._startFromLevel = options.startFromLevel === undefined ? -1 : options.startFromLevel; - this._autoStartMaxDuration = options.autoStartMaxDuration === undefined ? -1 : options.autoStartMaxDuration; - this._seekFromLevel = options.seekFromLevel === undefined ? -1 : options.seekFromLevel; - this._useHardwareVideoDecoder = options.useHardwareVideoDecoder === undefined ? false : options.useHardwareVideoDecoder; - this._hlsLogEnabled = options.hlsLogEnabled === undefined ? true : options.hlsLogEnabled; - this._logDebug = options.logDebug === undefined ? false : options.logDebug; - this._logDebug2 = options.logDebug2 === undefined ? false : options.logDebug2; - this._logWarn = options.logWarn === undefined ? true : options.logWarn; - this._logError = options.logError === undefined ? true : options.logError; - this._hlsMinimumDvrSize = options.hlsMinimumDvrSize === undefined ? 60 : options.hlsMinimumDvrSize; + MediaControl.prototype.bindKeyAndShow = function bindKeyAndShow(key, cb) { + var _this6 = this; + + this.kibo.down(key, function () { + _this6.show(); + return cb(); + }); }; - FlasHLS.prototype._addListeners = function _addListeners() { - var _this2 = this; + MediaControl.prototype.bindKeyEvents = function bindKeyEvents() { + var _this7 = this; - _mediator2.default.on(this.cid + ':flashready', function () { - return _this2._bootstrap(); + this.unbindKeyEvents(); + this.kibo = new _vendor.Kibo(this.options.focusElement); + + this.bindKeyAndShow('space', function () { + return _this7.togglePlayPause(); }); - _mediator2.default.on(this.cid + ':timeupdate', function (timeMetrics) { - return _this2._updateTime(timeMetrics); + this.bindKeyAndShow('left', function () { + return _this7.seekRelative(-5); }); - _mediator2.default.on(this.cid + ':playbackstate', function (state) { - return _this2._setPlaybackState(state); + this.bindKeyAndShow('right', function () { + return _this7.seekRelative(5); }); - _mediator2.default.on(this.cid + ':levelchanged', function (level) { - return _this2._levelChanged(level); + this.bindKeyAndShow('shift left', function () { + return _this7.seekRelative(-10); }); - _mediator2.default.on(this.cid + ':error', function (code, url, message) { - return _this2._flashPlaybackError(code, url, message); + this.bindKeyAndShow('shift right', function () { + return _this7.seekRelative(10); }); - _mediator2.default.on(this.cid + ':fragmentloaded', function (loadmetrics) { - return _this2._onFragmentLoaded(loadmetrics); + this.bindKeyAndShow('shift ctrl left', function () { + return _this7.seekRelative(-15); }); - _mediator2.default.on(this.cid + ':levelendlist', function (level) { - return _this2._onLevelEndlist(level); + this.bindKeyAndShow('shift ctrl right', function () { + return _this7.seekRelative(15); + }); + // this.kibo.down(['']) // should it be here? + var keys = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']; + keys.forEach(function (i) { + _this7.bindKeyAndShow(i, function () { + return _this7.settings.seekEnabled && _this7.container.seekPercentage(i * 10); + }); }); }; - FlasHLS.prototype.stopListening = function stopListening() { - _BaseFlashPlayback.prototype.stopListening.call(this); - _mediator2.default.off(this.cid + ':flashready'); - _mediator2.default.off(this.cid + ':timeupdate'); - _mediator2.default.off(this.cid + ':playbackstate'); - _mediator2.default.off(this.cid + ':levelchanged'); - _mediator2.default.off(this.cid + ':playbackerror'); - _mediator2.default.off(this.cid + ':fragmentloaded'); - _mediator2.default.off(this.cid + ':manifestloaded'); - _mediator2.default.off(this.cid + ':levelendlist'); + MediaControl.prototype.unbindKeyEvents = function unbindKeyEvents() { + if (this.kibo) { + this.kibo.off('space'); + this.kibo.off('left'); + this.kibo.off('right'); + this.kibo.off('shift left'); + this.kibo.off('shift right'); + this.kibo.off('shift ctrl left'); + this.kibo.off('shift ctrl right'); + this.kibo.off(['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']); + } }; - FlasHLS.prototype._bootstrap = function _bootstrap() { - var _this3 = this; - - if (this.el.playerLoad) { - this.el.width = '100%'; - this.el.height = '100%'; - this._isReadyState = true; - this._srcLoaded = false; - this._currentState = 'IDLE'; - this._setFlashSettings(); - this._updatePlaybackType(); - if (this._autoPlay || this._shouldPlayOnManifestLoaded) { - this.play(); - } - this.trigger(_events2.default.PLAYBACK_READY, this.name); - } else { - this._bootstrapAttempts = this._bootstrapAttempts || 0; - if (++this._bootstrapAttempts <= MAX_ATTEMPTS) { - setTimeout(function () { - return _this3._bootstrap(); - }, 50); - } else { - this.trigger(_events2.default.PLAYBACK_ERROR, { message: 'Max number of attempts reached' }, this.name); - } + MediaControl.prototype.parseColors = function parseColors() { + if (this.options.mediacontrol) { + this.buttonsColor = this.options.mediacontrol.buttons; + var seekbarColor = this.options.mediacontrol.seekbar; + this.$el.find('.bar-fill-2[data-seekbar]').css('background-color', seekbarColor); + this.$el.find('.media-control-icon svg path').css('fill', this.buttonsColor); + this.$el.find('.segmented-bar-element[data-volume]').css('boxShadow', 'inset 2px 0 0 ' + this.buttonsColor); } }; - FlasHLS.prototype._setFlashSettings = function _setFlashSettings() { - this.el.playerSetAutoStartLoad(this._autoStartLoad); - this.el.playerSetCapLevelToStage(this._capLevelToStage); - this.el.playerSetMaxLevelCappingMode(this._maxLevelCappingMode); - this.el.playerSetMinBufferLength(this._minBufferLength); - this.el.playerSetMinBufferLengthCapping(this._minBufferLengthCapping); - this.el.playerSetMaxBufferLength(this._maxBufferLength); - this.el.playerSetMaxBackBufferLength(this._maxBackBufferLength); - this.el.playerSetLowBufferLength(this._lowBufferLength); - this.el.playerSetMediaTimePeriod(this._mediaTimePeriod); - this.el.playerSetFpsDroppedMonitoringPeriod(this._fpsDroppedMonitoringPeriod); - this.el.playerSetFpsDroppedMonitoringThreshold(this._fpsDroppedMonitoringThreshold); - this.el.playerSetCapLevelonFPSDrop(this._capLevelonFPSDrop); - this.el.playerSetSmoothAutoSwitchonFPSDrop(this._smoothAutoSwitchonFPSDrop); - this.el.playerSetSwitchDownOnLevelError(this._switchDownOnLevelError); - this.el.playerSetSeekMode(this._seekMode); - this.el.playerSetKeyLoadMaxRetry(this._keyLoadMaxRetry); - this.el.playerSetKeyLoadMaxRetryTimeout(this._keyLoadMaxRetryTimeout); - this.el.playerSetFragmentLoadMaxRetry(this._fragmentLoadMaxRetry); - this.el.playerSetFragmentLoadMaxRetryTimeout(this._fragmentLoadMaxRetryTimeout); - this.el.playerSetFragmentLoadSkipAfterMaxRetry(this._fragmentLoadSkipAfterMaxRetry); - this.el.playerSetMaxSkippedFragments(this._maxSkippedFragments); - this.el.playerSetFlushLiveURLCache(this._flushLiveURLCache); - this.el.playerSetInitialLiveManifestSize(this._initialLiveManifestSize); - this.el.playerSetManifestLoadMaxRetry(this._manifestLoadMaxRetry); - this.el.playerSetManifestLoadMaxRetryTimeout(this._manifestLoadMaxRetryTimeout); - this.el.playerSetManifestRedundantLoadmaxRetry(this._manifestRedundantLoadmaxRetry); - this.el.playerSetStartFromBitrate(this._startFromBitrate); - this.el.playerSetStartFromLevel(this._startFromLevel); - this.el.playerSetAutoStartMaxDuration(this._autoStartMaxDuration); - this.el.playerSetSeekFromLevel(this._seekFromLevel); - this.el.playerSetUseHardwareVideoDecoder(this._useHardwareVideoDecoder); - this.el.playerSetLogInfo(this._hlsLogEnabled); - this.el.playerSetLogDebug(this._logDebug); - this.el.playerSetLogDebug2(this._logDebug2); - this.el.playerSetLogWarn(this._logWarn); - this.el.playerSetLogError(this._logError); + MediaControl.prototype.applyButtonStyle = function applyButtonStyle(element) { + if (this.buttonsColor && element) { + (0, _clapprZepto2.default)(element).find('svg path').css('fill', this.buttonsColor); + } }; - FlasHLS.prototype.setAutoStartLoad = function setAutoStartLoad(autoStartLoad) { - this._autoStartLoad = autoStartLoad; - this.el.playerSetAutoStartLoad(this._autoStartLoad); + MediaControl.prototype.destroy = function destroy() { + this.remove(); + (0, _clapprZepto2.default)(document).unbind('mouseup', this.stopDragHandler); + (0, _clapprZepto2.default)(document).unbind('mousemove', this.updateDragHandler); + this.unbindKeyEvents(); }; - FlasHLS.prototype.setCapLevelToStage = function setCapLevelToStage(capLevelToStage) { - this._capLevelToStage = capLevelToStage; - this.el.playerSetCapLevelToStage(this._capLevelToStage); - }; + MediaControl.prototype.render = function render() { + var _this8 = this; - FlasHLS.prototype.setMaxLevelCappingMode = function setMaxLevelCappingMode(maxLevelCappingMode) { - this._maxLevelCappingMode = maxLevelCappingMode; - this.el.playerSetMaxLevelCappingMode(this._maxLevelCappingMode); - }; + var timeout = 1000; + this.$el.html(this.template({ settings: this.settings })); + this.$el.append(this.stylesheet); + this.createCachedElements(); + this.$playPauseToggle.addClass('paused'); + this.$playStopToggle.addClass('stopped'); - FlasHLS.prototype.setSetMinBufferLength = function setSetMinBufferLength(minBufferLength) { - this._minBufferLength = minBufferLength; - this.el.playerSetMinBufferLength(this._minBufferLength); - }; + this.changeTogglePlay(); + this.hideId = setTimeout(function () { + return _this8.hide(); + }, timeout); + if (this.disabled) { + this.hide(); + } - FlasHLS.prototype.setMinBufferLengthCapping = function setMinBufferLengthCapping(minBufferLengthCapping) { - this._minBufferLengthCapping = minBufferLengthCapping; - this.el.playerSetMinBufferLengthCapping(this._minBufferLengthCapping); - }; + // Video volume cannot be changed with Safari on mobile devices + // Display mute/unmute icon only if Safari version >= 10 + if (_browser2.default.isSafari && _browser2.default.isMobile) { + if (_browser2.default.version < 10) { + this.$volumeContainer.css('display', 'none'); + } else { + this.$volumeBarContainer.css('display', 'none'); + } + } - FlasHLS.prototype.setMaxBufferLength = function setMaxBufferLength(maxBufferLength) { - this._maxBufferLength = maxBufferLength; - this.el.playerSetMaxBufferLength(this._maxBufferLength); - }; + this.$seekBarPosition.addClass('media-control-notransition'); + this.$seekBarScrubber.addClass('media-control-notransition'); - FlasHLS.prototype.setMaxBackBufferLength = function setMaxBackBufferLength(maxBackBufferLength) { - this._maxBackBufferLength = maxBackBufferLength; - this.el.playerSetMaxBackBufferLength(this._maxBackBufferLength); - }; + var previousSeekPercentage = 0; + if (this.displayedSeekBarPercentage) { + previousSeekPercentage = this.displayedSeekBarPercentage; + } + this.displayedSeekBarPercentage = null; + this.setSeekPercentage(previousSeekPercentage); - FlasHLS.prototype.setLowBufferLength = function setLowBufferLength(lowBufferLength) { - this._lowBufferLength = lowBufferLength; - this.el.playerSetLowBufferLength(this._lowBufferLength); - }; + process.nextTick(function () { + if (!_this8.settings.seekEnabled) { + _this8.$seekBarContainer.addClass('seek-disabled'); + } + if (!_browser2.default.isMobile && !_this8.options.disableKeyboardShortcuts) { + _this8.bindKeyEvents(); + } + _this8.playerResize({ width: _this8.options.width, height: _this8.options.height }); + _this8.hideVolumeBar(0); + }); - FlasHLS.prototype.setMediaTimePeriod = function setMediaTimePeriod(mediaTimePeriod) { - this._mediaTimePeriod = mediaTimePeriod; - this.el.playerSetMediaTimePeriod(this._mediaTimePeriod); - }; + this.parseColors(); + this.highDefinitionUpdate(); + this.ccAvailable(false); - FlasHLS.prototype.setFpsDroppedMonitoringPeriod = function setFpsDroppedMonitoringPeriod(fpsDroppedMonitoringPeriod) { - this._fpsDroppedMonitoringPeriod = fpsDroppedMonitoringPeriod; - this.el.playerSetFpsDroppedMonitoringPeriod(this._fpsDroppedMonitoringPeriod); + this.rendered = true; + this.updateVolumeUI(); + this.trigger(_events2.default.MEDIACONTROL_RENDERED); + return this; }; - FlasHLS.prototype.setFpsDroppedMonitoringThreshold = function setFpsDroppedMonitoringThreshold(fpsDroppedMonitoringThreshold) { - this._fpsDroppedMonitoringThreshold = fpsDroppedMonitoringThreshold; - this.el.playerSetFpsDroppedMonitoringThreshold(this._fpsDroppedMonitoringThreshold); - }; + return MediaControl; +}(_ui_object2.default); // Copyright 2014 Globo.com Player authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. - FlasHLS.prototype.setCapLevelonFPSDrop = function setCapLevelonFPSDrop(capLevelonFPSDrop) { - this._capLevelonFPSDrop = capLevelonFPSDrop; - this.el.playerSetCapLevelonFPSDrop(this._capLevelonFPSDrop); - }; +/** + * The MediaControl is responsible for displaying the Player controls. + */ - FlasHLS.prototype.setSmoothAutoSwitchonFPSDrop = function setSmoothAutoSwitchonFPSDrop(smoothAutoSwitchonFPSDrop) { - this._smoothAutoSwitchonFPSDrop = smoothAutoSwitchonFPSDrop; - this.el.playerSetSmoothAutoSwitchonFPSDrop(this._smoothAutoSwitchonFPSDrop); - }; +exports.default = MediaControl; - FlasHLS.prototype.setSwitchDownOnLevelError = function setSwitchDownOnLevelError(switchDownOnLevelError) { - this._switchDownOnLevelError = switchDownOnLevelError; - this.el.playerSetSwitchDownOnLevelError(this._switchDownOnLevelError); - }; - FlasHLS.prototype.setSeekMode = function setSeekMode(seekMode) { - this._seekMode = seekMode; - this.el.playerSetSeekMode(this._seekMode); - }; +MediaControl.extend = function (properties) { + return (0, _utils.extend)(MediaControl, properties); +}; +module.exports = exports['default']; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58))) - FlasHLS.prototype.setKeyLoadMaxRetry = function setKeyLoadMaxRetry(keyLoadMaxRetry) { - this._keyLoadMaxRetry = keyLoadMaxRetry; - this.el.playerSetKeyLoadMaxRetry(this._keyLoadMaxRetry); - }; +/***/ }), +/* 95 */ +/***/ (function(module, exports, __webpack_require__) { - FlasHLS.prototype.setKeyLoadMaxRetryTimeout = function setKeyLoadMaxRetryTimeout(keyLoadMaxRetryTimeout) { - this._keyLoadMaxRetryTimeout = keyLoadMaxRetryTimeout; - this.el.playerSetKeyLoadMaxRetryTimeout(this._keyLoadMaxRetryTimeout); - }; +"use strict"; - FlasHLS.prototype.setFragmentLoadMaxRetry = function setFragmentLoadMaxRetry(fragmentLoadMaxRetry) { - this._fragmentLoadMaxRetry = fragmentLoadMaxRetry; - this.el.playerSetFragmentLoadMaxRetry(this._fragmentLoadMaxRetry); - }; - FlasHLS.prototype.setFragmentLoadMaxRetryTimeout = function setFragmentLoadMaxRetryTimeout(fragmentLoadMaxRetryTimeout) { - this._fragmentLoadMaxRetryTimeout = fragmentLoadMaxRetryTimeout; - this.el.playerSetFragmentLoadMaxRetryTimeout(this._fragmentLoadMaxRetryTimeout); - }; +Object.defineProperty(exports, "__esModule", { + value: true +}); - FlasHLS.prototype.setFragmentLoadSkipAfterMaxRetry = function setFragmentLoadSkipAfterMaxRetry(fragmentLoadSkipAfterMaxRetry) { - this._fragmentLoadSkipAfterMaxRetry = fragmentLoadSkipAfterMaxRetry; - this.el.playerSetFragmentLoadSkipAfterMaxRetry(this._fragmentLoadSkipAfterMaxRetry); - }; +var _player = __webpack_require__(86); - FlasHLS.prototype.setMaxSkippedFragments = function setMaxSkippedFragments(maxSkippedFragments) { - this._maxSkippedFragments = maxSkippedFragments; - this.el.playerSetMaxSkippedFragments(this._maxSkippedFragments); - }; +var _player2 = _interopRequireDefault(_player); - FlasHLS.prototype.setFlushLiveURLCache = function setFlushLiveURLCache(flushLiveURLCache) { - this._flushLiveURLCache = flushLiveURLCache; - this.el.playerSetFlushLiveURLCache(this._flushLiveURLCache); - }; +var _utils = __webpack_require__(5); - FlasHLS.prototype.setInitialLiveManifestSize = function setInitialLiveManifestSize(initialLiveManifestSize) { - this._initialLiveManifestSize = initialLiveManifestSize; - this.el.playerSetInitialLiveManifestSize(this._initialLiveManifestSize); - }; +var _utils2 = _interopRequireDefault(_utils); - FlasHLS.prototype.setManifestLoadMaxRetry = function setManifestLoadMaxRetry(manifestLoadMaxRetry) { - this._manifestLoadMaxRetry = manifestLoadMaxRetry; - this.el.playerSetManifestLoadMaxRetry(this._manifestLoadMaxRetry); - }; +var _events = __webpack_require__(4); - FlasHLS.prototype.setManifestLoadMaxRetryTimeout = function setManifestLoadMaxRetryTimeout(manifestLoadMaxRetryTimeout) { - this._manifestLoadMaxRetryTimeout = manifestLoadMaxRetryTimeout; - this.el.playerSetManifestLoadMaxRetryTimeout(this._manifestLoadMaxRetryTimeout); - }; +var _events2 = _interopRequireDefault(_events); - FlasHLS.prototype.setManifestRedundantLoadmaxRetry = function setManifestRedundantLoadmaxRetry(manifestRedundantLoadmaxRetry) { - this._manifestRedundantLoadmaxRetry = manifestRedundantLoadmaxRetry; - this.el.playerSetManifestRedundantLoadmaxRetry(this._manifestRedundantLoadmaxRetry); - }; +var _playback = __webpack_require__(7); - FlasHLS.prototype.setStartFromBitrate = function setStartFromBitrate(startFromBitrate) { - this._startFromBitrate = startFromBitrate; - this.el.playerSetStartFromBitrate(this._startFromBitrate); - }; +var _playback2 = _interopRequireDefault(_playback); - FlasHLS.prototype.setStartFromLevel = function setStartFromLevel(startFromLevel) { - this._startFromLevel = startFromLevel; - this.el.playerSetStartFromLevel(this._startFromLevel); - }; +var _container_plugin = __webpack_require__(31); - FlasHLS.prototype.setAutoStartMaxDuration = function setAutoStartMaxDuration(autoStartMaxDuration) { - this._autoStartMaxDuration = autoStartMaxDuration; - this.el.playerSetAutoStartMaxDuration(this._autoStartMaxDuration); - }; +var _container_plugin2 = _interopRequireDefault(_container_plugin); - FlasHLS.prototype.setSeekFromLevel = function setSeekFromLevel(seekFromLevel) { - this._seekFromLevel = seekFromLevel; - this.el.playerSetSeekFromLevel(this._seekFromLevel); - }; +var _core_plugin = __webpack_require__(25); - FlasHLS.prototype.setUseHardwareVideoDecoder = function setUseHardwareVideoDecoder(useHardwareVideoDecoder) { - this._useHardwareVideoDecoder = useHardwareVideoDecoder; - this.el.playerSetUseHardwareVideoDecoder(this._useHardwareVideoDecoder); - }; +var _core_plugin2 = _interopRequireDefault(_core_plugin); - FlasHLS.prototype.setSetLogInfo = function setSetLogInfo(hlsLogEnabled) { - this._hlsLogEnabled = hlsLogEnabled; - this.el.playerSetLogInfo(this._hlsLogEnabled); - }; +var _ui_core_plugin = __webpack_require__(38); - FlasHLS.prototype.setLogDebug = function setLogDebug(logDebug) { - this._logDebug = logDebug; - this.el.playerSetLogDebug(this._logDebug); - }; +var _ui_core_plugin2 = _interopRequireDefault(_ui_core_plugin); - FlasHLS.prototype.setLogDebug2 = function setLogDebug2(logDebug2) { - this._logDebug2 = logDebug2; - this.el.playerSetLogDebug2(this._logDebug2); - }; +var _ui_container_plugin = __webpack_require__(32); - FlasHLS.prototype.setLogWarn = function setLogWarn(logWarn) { - this._logWarn = logWarn; - this.el.playerSetLogWarn(this._logWarn); - }; +var _ui_container_plugin2 = _interopRequireDefault(_ui_container_plugin); - FlasHLS.prototype.setLogError = function setLogError(logError) { - this._logError = logError; - this.el.playerSetLogError(this._logError); - }; +var _base_object = __webpack_require__(14); - FlasHLS.prototype._levelChanged = function _levelChanged(level) { - var currentLevel = this.el.getLevels()[level]; - if (currentLevel) { - this.highDefinition = currentLevel.height >= 720 || currentLevel.bitrate / 1000 >= 2000; - this.trigger(_events2.default.PLAYBACK_HIGHDEFINITIONUPDATE, this.highDefinition); +var _base_object2 = _interopRequireDefault(_base_object); - if (!this._levels || this._levels.length === 0) this._fillLevels(); +var _ui_object = __webpack_require__(18); - this.trigger(_events2.default.PLAYBACK_BITRATE, { - height: currentLevel.height, - width: currentLevel.width, - bandwidth: currentLevel.bitrate, - bitrate: currentLevel.bitrate, - level: level - }); - this.trigger(_events2.default.PLAYBACK_LEVEL_SWITCH_END); - } - }; +var _ui_object2 = _interopRequireDefault(_ui_object); - FlasHLS.prototype._updateTime = function _updateTime(timeMetrics) { - if (this._currentState === 'IDLE') { - return; - } +var _browser = __webpack_require__(13); - var duration = this._normalizeDuration(timeMetrics.duration); - var position = Math.min(Math.max(timeMetrics.position, 0), duration); - var previousDVRStatus = this._dvrEnabled; - var livePlayback = this._playbackType === _playback2.default.LIVE; - this._dvrEnabled = livePlayback && duration > this._hlsMinimumDvrSize; +var _browser2 = _interopRequireDefault(_browser); - if (duration === 100 || livePlayback === undefined) { - return; - } +var _container = __webpack_require__(60); - if (this._dvrEnabled !== previousDVRStatus) { - this._updateSettings(); - this.trigger(_events2.default.PLAYBACK_SETTINGSUPDATE, this.name); - } +var _container2 = _interopRequireDefault(_container); - if (livePlayback && (!this._dvrEnabled || !this._dvrInUse)) { - position = duration; - } +var _core = __webpack_require__(61); - this.trigger(_events2.default.PLAYBACK_TIMEUPDATE, { current: position, total: duration }, this.name); - }; +var _core2 = _interopRequireDefault(_core); - FlasHLS.prototype.play = function play() { - this.trigger(_events2.default.PLAYBACK_PLAY_INTENT); - if (this._currentState === 'PAUSED') { - this.el.playerResume(); - } else if (!this._srcLoaded && this._currentState !== 'PLAYING') { - this._firstPlay(); - } else { - this.el.playerPlay(); - } - }; +var _loader = __webpack_require__(62); - FlasHLS.prototype.getPlaybackType = function getPlaybackType() { - return this._playbackType ? this._playbackType : null; - }; +var _loader2 = _interopRequireDefault(_loader); - FlasHLS.prototype.getCurrentLevelIndex = function getCurrentLevelIndex() { - return this._currentLevel; - }; +var _mediator = __webpack_require__(22); - FlasHLS.prototype.getCurrentLevel = function getCurrentLevel() { - return this.levels[this.currentLevel]; - }; +var _mediator2 = _interopRequireDefault(_mediator); - FlasHLS.prototype.getCurrentBitrate = function getCurrentBitrate() { - return this.levels[this.currentLevel].bitrate; - }; +var _media_control = __webpack_require__(63); - FlasHLS.prototype.setCurrentLevel = function setCurrentLevel(level) { - this.currentLevel = level; - }; +var _media_control2 = _interopRequireDefault(_media_control); - FlasHLS.prototype.isHighDefinitionInUse = function isHighDefinitionInUse() { - return this.highDefinition; - }; +var _player_info = __webpack_require__(33); - FlasHLS.prototype.getLevels = function getLevels() { - return this.levels; - }; +var _player_info2 = _interopRequireDefault(_player_info); - FlasHLS.prototype._setPlaybackState = function _setPlaybackState(state) { - if (['PLAYING_BUFFERING', 'PAUSED_BUFFERING'].indexOf(state) >= 0) { - this._bufferingState = true; - this.trigger(_events2.default.PLAYBACK_BUFFERING, this.name); - this._updateCurrentState(state); - } else if (['PLAYING', 'PAUSED'].indexOf(state) >= 0) { - if (['PLAYING_BUFFERING', 'PAUSED_BUFFERING', 'IDLE'].indexOf(this._currentState) >= 0) { - this._bufferingState = false; - this.trigger(_events2.default.PLAYBACK_BUFFERFULL, this.name); - } - this._updateCurrentState(state); - } else if (state === 'IDLE') { - this._srcLoaded = false; - if (this._loop && ['PLAYING_BUFFERING', 'PLAYING'].indexOf(this._currentState) >= 0) { - this.play(); - this.seek(0); - } else { - this._updateCurrentState(state); - this._hasEnded = true; - this.trigger(_events2.default.PLAYBACK_TIMEUPDATE, { current: 0, total: this.getDuration() }, this.name); - this.trigger(_events2.default.PLAYBACK_ENDED, this.name); - } - } - }; +var _base_flash_playback = __webpack_require__(39); - FlasHLS.prototype._updateCurrentState = function _updateCurrentState(state) { - this._currentState = state; - if (state !== 'IDLE') { - this._hasEnded = false; - } - this._updatePlaybackType(); - if (state === 'PLAYING') { - this.trigger(_events2.default.PLAYBACK_PLAY, this.name); - } else if (state === 'PAUSED') { - this.trigger(_events2.default.PLAYBACK_PAUSE, this.name); - } - }; +var _base_flash_playback2 = _interopRequireDefault(_base_flash_playback); - FlasHLS.prototype._updatePlaybackType = function _updatePlaybackType() { - this._playbackType = this.el.getType(); - if (this._playbackType) { - this._playbackType = this._playbackType.toLowerCase(); - if (this._playbackType === _playback2.default.VOD) { - this._startReportingProgress(); - } else { - this._stopReportingProgress(); - } - } - this.trigger(_events2.default.PLAYBACK_PLAYBACKSTATE, { type: this._playbackType }); - }; +var _flash = __webpack_require__(64); - FlasHLS.prototype._startReportingProgress = function _startReportingProgress() { - if (!this._reportingProgress) { - this._reportingProgress = true; - } - }; +var _flash2 = _interopRequireDefault(_flash); - FlasHLS.prototype._stopReportingProgress = function _stopReportingProgress() { - this._reportingProgress = false; - }; +var _flashls = __webpack_require__(65); - FlasHLS.prototype._onFragmentLoaded = function _onFragmentLoaded(loadmetrics) { - this.trigger(_events2.default.PLAYBACK_FRAGMENT_LOADED, loadmetrics); - if (this._reportingProgress && this.el.getPosition) { - var buffered = this.el.getPosition() + this.el.getbufferLength(); - this.trigger(_events2.default.PLAYBACK_PROGRESS, { - start: this.el.getPosition(), - current: buffered, - total: this.el.getDuration() - }); - } - }; +var _flashls2 = _interopRequireDefault(_flashls); - FlasHLS.prototype._onLevelEndlist = function _onLevelEndlist() { - this._updatePlaybackType(); - }; +var _hls = __webpack_require__(66); - FlasHLS.prototype._firstPlay = function _firstPlay() { - var _this4 = this; +var _hls2 = _interopRequireDefault(_hls); - this._shouldPlayOnManifestLoaded = true; - if (this.el.playerLoad) { - _mediator2.default.once(this.cid + ':manifestloaded', function (duration, loadmetrics) { - return _this4._manifestLoaded(duration, loadmetrics); - }); - this._setFlashSettings(); //ensure flushLiveURLCache will work (#327) - this.el.playerLoad(this._src); - this._srcLoaded = true; - } - }; +var _html5_audio = __webpack_require__(67); - FlasHLS.prototype.volume = function volume(value) { - var _this5 = this; +var _html5_audio2 = _interopRequireDefault(_html5_audio); - if (this.isReady) { - this.el.playerVolume(value); - } else { - this.listenToOnce(this, _events2.default.PLAYBACK_BUFFERFULL, function () { - return _this5.volume(value); - }); - } - }; +var _html5_video = __webpack_require__(34); - FlasHLS.prototype.pause = function pause() { - if (this._playbackType !== _playback2.default.LIVE || this._dvrEnabled) { - this.el.playerPause(); - if (this._playbackType === _playback2.default.LIVE && this._dvrEnabled) { - this._updateDvr(true); - } - } - }; - - FlasHLS.prototype.stop = function stop() { - this._srcLoaded = false; - this.el.playerStop(); - this.trigger(_events2.default.PLAYBACK_STOP); - this.trigger(_events2.default.PLAYBACK_TIMEUPDATE, { current: 0, total: 0 }, this.name); - }; - - FlasHLS.prototype.isPlaying = function isPlaying() { - if (this._currentState) { - return !!this._currentState.match(/playing/i); - } - return false; - }; - - FlasHLS.prototype.getDuration = function getDuration() { - return this._normalizeDuration(this.el.getDuration()); - }; +var _html5_video2 = _interopRequireDefault(_html5_video); - FlasHLS.prototype._normalizeDuration = function _normalizeDuration(duration) { - if (this._playbackType === _playback2.default.LIVE) { - // estimate 10 seconds of buffer time for live streams for seek positions - duration = Math.max(0, duration - 10); - } - return duration; - }; +var _html_img = __webpack_require__(68); - FlasHLS.prototype.seekPercentage = function seekPercentage(percentage) { - var duration = this.el.getDuration(); - var time = 0; - if (percentage > 0) { - time = duration * percentage / 100; - } - this.seek(time); - }; +var _html_img2 = _interopRequireDefault(_html_img); - FlasHLS.prototype.seek = function seek(time) { - var duration = this.getDuration(); - if (this._playbackType === _playback2.default.LIVE) { - // seek operations to a time within 3 seconds from live stream will position playhead back to live - var dvrInUse = duration - time > 3; - this._updateDvr(dvrInUse); - } - this.el.playerSeek(time); - this.trigger(_events2.default.PLAYBACK_TIMEUPDATE, { current: time, total: duration }, this.name); - }; +var _no_op = __webpack_require__(69); - FlasHLS.prototype._updateDvr = function _updateDvr(dvrInUse) { - var previousDvrInUse = !!this._dvrInUse; - this._dvrInUse = dvrInUse; - if (this._dvrInUse !== previousDvrInUse) { - this._updateSettings(); - this.trigger(_events2.default.PLAYBACK_DVR, this._dvrInUse); - this.trigger(_events2.default.PLAYBACK_STATS_ADD, { 'dvr': this._dvrInUse }); - } - }; +var _no_op2 = _interopRequireDefault(_no_op); - FlasHLS.prototype._flashPlaybackError = function _flashPlaybackError(code, url, message) { - this.trigger(_events2.default.PLAYBACK_ERROR, { code: code, url: url, message: message }); - this.trigger(_events2.default.PLAYBACK_STOP); - }; +var _poster = __webpack_require__(70); - FlasHLS.prototype._manifestLoaded = function _manifestLoaded(duration, loadmetrics) { - if (this._shouldPlayOnManifestLoaded) { - this._shouldPlayOnManifestLoaded = false; - // this method initialises the player (and starts playback) - // this needs to happen before PLAYBACK_LOADEDMETADATA is fired - // as the user may call seek() in a LOADEDMETADATA listener. - /// when playerPlay() is called the player seeks to 0 - this.el.playerPlay(); - } +var _poster2 = _interopRequireDefault(_poster); - this._fillLevels(); - this.trigger(_events2.default.PLAYBACK_LOADEDMETADATA, { duration: duration, data: loadmetrics }); - }; +var _log = __webpack_require__(40); - FlasHLS.prototype._fillLevels = function _fillLevels() { - var levels = this.el.getLevels(); - var levelsLength = levels.length; - this._levels = []; +var _log2 = _interopRequireDefault(_log); - for (var index = 0; index < levelsLength; index++) { - this._levels.push({ id: index, label: levels[index].height + 'p', level: levels[index] }); - } - this.trigger(_events2.default.PLAYBACK_LEVELS_AVAILABLE, this._levels); - }; +var _styler = __webpack_require__(8); - FlasHLS.prototype.destroy = function destroy() { - this.stopListening(); - this.$el.remove(); - }; +var _styler2 = _interopRequireDefault(_styler); - FlasHLS.prototype._updateSettings = function _updateSettings() { - this.settings = _clapprZepto2.default.extend({}, this._defaultSettings); - if (this._playbackType === _playback2.default.VOD || this._dvrInUse) { - this.settings.left = ['playpause', 'position', 'duration']; - this.settings.seekEnabled = true; - } else if (this._dvrEnabled) { - this.settings.left = ['playpause']; - this.settings.seekEnabled = true; - } else { - this.settings.seekEnabled = false; - } - }; +var _vendor = __webpack_require__(41); - FlasHLS.prototype._createCallbacks = function _createCallbacks() { - var _this6 = this; +var _vendor2 = _interopRequireDefault(_vendor); - if (!window.Clappr) { - window.Clappr = {}; - } - if (!window.Clappr.flashlsCallbacks) { - window.Clappr.flashlsCallbacks = {}; - } - this.flashlsEvents = new _flashls_events2.default(this.cid); - window.Clappr.flashlsCallbacks[this.cid] = function (eventName, args) { - _this6.flashlsEvents[eventName].apply(_this6.flashlsEvents, args); - }; - }; +var _template = __webpack_require__(9); - FlasHLS.prototype.render = function render() { - _BaseFlashPlayback.prototype.render.call(this); - this._createCallbacks(); - return this; - }; +var _template2 = _interopRequireDefault(_template); - _createClass(FlasHLS, [{ - key: 'isReady', - get: function get() { - return this._isReadyState; - } - }, { - key: 'dvrEnabled', - get: function get() { - return !!this._dvrEnabled; - } - }]); +var _clapprZepto = __webpack_require__(6); - return FlasHLS; -}(_base_flash_playback2.default); +var _clapprZepto2 = _interopRequireDefault(_clapprZepto); -exports.default = FlasHLS; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var version = "0.2.67"; // Copyright 2014 Globo.com Player authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. -FlasHLS.canPlay = function (resource, mimeType) { - var resourceParts = resource.split('?')[0].match(/.*\.(.*)$/) || []; - return _browser2.default.hasFlash && (resourceParts.length > 1 && resourceParts[1].toLowerCase() === 'm3u8' || mimeType === 'application/x-mpegURL' || mimeType === 'application/vnd.apple.mpegurl'); +exports.default = { + Player: _player2.default, + Mediator: _mediator2.default, + Events: _events2.default, + Browser: _browser2.default, + PlayerInfo: _player_info2.default, + MediaControl: _media_control2.default, + ContainerPlugin: _container_plugin2.default, + UIContainerPlugin: _ui_container_plugin2.default, + CorePlugin: _core_plugin2.default, + UICorePlugin: _ui_core_plugin2.default, + Playback: _playback2.default, + Container: _container2.default, + Core: _core2.default, + Loader: _loader2.default, + BaseObject: _base_object2.default, + UIObject: _ui_object2.default, + Utils: _utils2.default, + BaseFlashPlayback: _base_flash_playback2.default, + Flash: _flash2.default, + FlasHLS: _flashls2.default, + HLS: _hls2.default, + HTML5Audio: _html5_audio2.default, + HTML5Video: _html5_video2.default, + HTMLImg: _html_img2.default, + NoOp: _no_op2.default, + Poster: _poster2.default, + Log: _log2.default, + Styler: _styler2.default, + Vendor: _vendor2.default, + version: version, + template: _template2.default, + $: _clapprZepto2.default }; module.exports = exports['default']; /***/ }), -/* 51 */ +/* 96 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -11686,941 +9355,590 @@ Object.defineProperty(exports, "__esModule", { value: true }); -var _mediator = __webpack_require__(10); +var _classCallCheck2 = __webpack_require__(0); -var _mediator2 = _interopRequireDefault(_mediator); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _createClass2 = __webpack_require__(3); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +var _createClass3 = _interopRequireDefault(_createClass2); -var HLSEvents = function () { - function HLSEvents(instanceId) { - _classCallCheck(this, HLSEvents); +var _possibleConstructorReturn2 = __webpack_require__(2); - this.instanceId = instanceId; - } +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - HLSEvents.prototype.ready = function ready() { - _mediator2.default.trigger(this.instanceId + ':flashready'); - }; +var _inherits2 = __webpack_require__(1); - HLSEvents.prototype.videoSize = function videoSize(width, height) { - _mediator2.default.trigger(this.instanceId + ':videosizechanged', width, height); - }; +var _inherits3 = _interopRequireDefault(_inherits2); - HLSEvents.prototype.complete = function complete() { - _mediator2.default.trigger(this.instanceId + ':complete'); - }; +var _playback = __webpack_require__(7); - HLSEvents.prototype.error = function error(code, url, message) { - _mediator2.default.trigger(this.instanceId + ':error', code, url, message); - }; +var _playback2 = _interopRequireDefault(_playback); - HLSEvents.prototype.manifest = function manifest(duration, loadmetrics) { - _mediator2.default.trigger(this.instanceId + ':manifestloaded', duration, loadmetrics); - }; +var _styler = __webpack_require__(8); - HLSEvents.prototype.audioLevelLoaded = function audioLevelLoaded(loadmetrics) { - _mediator2.default.trigger(this.instanceId + ':audiolevelloaded', loadmetrics); - }; +var _styler2 = _interopRequireDefault(_styler); - HLSEvents.prototype.levelLoaded = function levelLoaded(loadmetrics) { - _mediator2.default.trigger(this.instanceId + ':levelloaded', loadmetrics); - }; +var _template = __webpack_require__(9); - HLSEvents.prototype.levelEndlist = function levelEndlist(level) { - _mediator2.default.trigger(this.instanceId + ':levelendlist', level); - }; +var _template2 = _interopRequireDefault(_template); - HLSEvents.prototype.fragmentLoaded = function fragmentLoaded(loadmetrics) { - _mediator2.default.trigger(this.instanceId + ':fragmentloaded', loadmetrics); - }; +var _browser = __webpack_require__(13); - HLSEvents.prototype.fragmentPlaying = function fragmentPlaying(playmetrics) { - _mediator2.default.trigger(this.instanceId + ':fragmentplaying', playmetrics); - }; +var _browser2 = _interopRequireDefault(_browser); - HLSEvents.prototype.position = function position(timemetrics) { - _mediator2.default.trigger(this.instanceId + ':timeupdate', timemetrics); - }; +var _flash = __webpack_require__(191); - HLSEvents.prototype.state = function state(newState) { - _mediator2.default.trigger(this.instanceId + ':playbackstate', newState); - }; +var _flash2 = _interopRequireDefault(_flash); - HLSEvents.prototype.seekState = function seekState(newState) { - _mediator2.default.trigger(this.instanceId + ':seekstate', newState); - }; +var _flash3 = __webpack_require__(180); - HLSEvents.prototype.switch = function _switch(newLevel) { - _mediator2.default.trigger(this.instanceId + ':levelchanged', newLevel); - }; +var _flash4 = _interopRequireDefault(_flash3); - HLSEvents.prototype.audioTracksListChange = function audioTracksListChange(trackList) { - _mediator2.default.trigger(this.instanceId + ':audiotracklistchanged', trackList); - }; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - HLSEvents.prototype.audioTrackChange = function audioTrackChange(trackId) { - _mediator2.default.trigger(this.instanceId + ':audiotrackchanged', trackId); - }; +// Copyright 2015 Globo.com Player authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. - return HLSEvents; -}(); +var IE_CLASSID = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000'; -exports.default = HLSEvents; -module.exports = exports['default']; +var BaseFlashPlayback = function (_Playback) { + (0, _inherits3.default)(BaseFlashPlayback, _Playback); -/***/ }), -/* 52 */ -/***/ (function(module, exports, __webpack_require__) { + function BaseFlashPlayback() { + (0, _classCallCheck3.default)(this, BaseFlashPlayback); + return (0, _possibleConstructorReturn3.default)(this, _Playback.apply(this, arguments)); + } -"use strict"; + BaseFlashPlayback.prototype.setElement = function setElement(element) { + this.$el = element; + this.el = element[0]; + }; + + BaseFlashPlayback.prototype._setupFirefox = function _setupFirefox() { + var $el = this.$('embed'); + $el.attr('data-flash-playback', this.name); + $el.addClass(this.attributes.class); + this.setElement($el); + }; + + BaseFlashPlayback.prototype.render = function render() { + this.$el.html(this.template({ + cid: this.cid, + swfPath: this.swfPath, + baseUrl: this.baseUrl, + playbackId: this.uniqueId, + wmode: this.wmode, + callbackName: 'window.Clappr.flashlsCallbacks.' + this.cid })); + + if (_browser2.default.isIE) { + this.$('embed').remove(); + + if (_browser2.default.isLegacyIE) { + this.$el.attr('classid', IE_CLASSID); + } + } + + if (_browser2.default.isFirefox) { + this._setupFirefox(); + } + + this.el.id = this.cid; + this.$el.append(_styler2.default.getStyleFor(_flash4.default)); + + return this; + }; + + (0, _createClass3.default)(BaseFlashPlayback, [{ + key: 'tagName', + get: function get() { + return 'object'; + } + }, { + key: 'swfPath', + get: function get() { + return ''; + } + }, { + key: 'wmode', + get: function get() { + return 'transparent'; + } + }, { + key: 'template', + get: function get() { + return (0, _template2.default)(_flash2.default); + } + }, { + key: 'attributes', + get: function get() { + var type = 'application/x-shockwave-flash'; + + if (_browser2.default.isLegacyIE) { + type = ''; + } + + return { + class: 'clappr-flash-playback', + type: type, + width: '100%', + height: '100%', + 'data-flash-playback': this.name + }; + } + }]); + return BaseFlashPlayback; +}(_playback2.default); + +exports.default = BaseFlashPlayback; +module.exports = exports['default']; + +/***/ }), +/* 97 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; Object.defineProperty(exports, "__esModule", { value: 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 _classCallCheck2 = __webpack_require__(0); -var _html5_video = __webpack_require__(16); +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); -var _html5_video2 = _interopRequireDefault(_html5_video); +var _possibleConstructorReturn2 = __webpack_require__(2); -var _hls = __webpack_require__(94); +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); -var _hls2 = _interopRequireDefault(_hls); +var _createClass2 = __webpack_require__(3); -var _lodash = __webpack_require__(104); +var _createClass3 = _interopRequireDefault(_createClass2); -var _lodash2 = _interopRequireDefault(_lodash); +var _inherits2 = __webpack_require__(1); -var _events = __webpack_require__(0); +var _inherits3 = _interopRequireDefault(_inherits2); -var _events2 = _interopRequireDefault(_events); +var _utils = __webpack_require__(5); -var _playback = __webpack_require__(2); +var _base_flash_playback = __webpack_require__(39); -var _playback2 = _interopRequireDefault(_playback); +var _base_flash_playback2 = _interopRequireDefault(_base_flash_playback); -var _browser = __webpack_require__(7); +var _browser = __webpack_require__(13); var _browser2 = _interopRequireDefault(_browser); -var _utils = __webpack_require__(1); +var _mediator = __webpack_require__(22); -var _log = __webpack_require__(19); +var _mediator2 = _interopRequireDefault(_mediator); -var _log2 = _interopRequireDefault(_log); +var _template = __webpack_require__(9); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _template2 = _interopRequireDefault(_template); -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } +var _clapprZepto = __webpack_require__(6); -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +var _clapprZepto2 = _interopRequireDefault(_clapprZepto); -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } +var _events = __webpack_require__(4); -function _inherits(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; } // Copyright 2014 Globo.com Player authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. +var _events2 = _interopRequireDefault(_events); -var AUTO = -1; +var _playback = __webpack_require__(7); -var HLS = function (_HTML5VideoPlayback) { - _inherits(HLS, _HTML5VideoPlayback); +var _playback2 = _interopRequireDefault(_playback); + +var _Player = __webpack_require__(206); + +var _Player2 = _interopRequireDefault(_Player); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var MAX_ATTEMPTS = 60; // Copyright 2014 Globo.com Player authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. - _createClass(HLS, [{ +var Flash = function (_BaseFlashPlayback) { + (0, _inherits3.default)(Flash, _BaseFlashPlayback); + (0, _createClass3.default)(Flash, [{ key: 'name', get: function get() { - return 'hls'; - } - }, { - key: 'levels', - get: function get() { - return this._levels || []; - } - }, { - key: 'currentLevel', - get: function get() { - if (this._currentLevel === null || this._currentLevel === undefined) { - return AUTO; - } else { - return this._currentLevel; //0 is a valid level ID - } - }, - set: function set(id) { - this._currentLevel = id; - this.trigger(_events2.default.PLAYBACK_LEVEL_SWITCH_START); - this._hls.currentLevel = this._currentLevel; - } - }, { - key: '_startTime', - get: function get() { - if (this._playbackType === _playback2.default.LIVE && this._playlistType !== 'EVENT') { - return this._extrapolatedStartTime; - } - return this._playableRegionStartTime; - } - }, { - key: '_now', - get: function get() { - return (0, _utils.now)(); + return 'flash'; } - - // the time in the video element which should represent the start of the sliding window - // extrapolated to increase in real time (instead of jumping as the early segments are removed) - }, { - key: '_extrapolatedStartTime', + key: 'swfPath', get: function get() { - if (!this._localStartTimeCorrelation) { - return this._playableRegionStartTime; - } - var corr = this._localStartTimeCorrelation; - var timePassed = this._now - corr.local; - var extrapolatedWindowStartTime = (corr.remote + timePassed) / 1000; - // cap at the end of the extrapolated window duration - return Math.min(extrapolatedWindowStartTime, this._playableRegionStartTime + this._extrapolatedWindowDuration); + return (0, _template2.default)(_Player2.default)({ baseUrl: this._baseUrl }); } - // the time in the video element which should represent the end of the content - // extrapolated to increase in real time (instead of jumping as segments are added) + /** + * Determine if the playback has ended. + * @property ended + * @type Boolean + */ }, { - key: '_extrapolatedEndTime', - get: function get() { - var actualEndTime = this._playableRegionStartTime + this._playableRegionDuration; - if (!this._localEndTimeCorrelation) { - return actualEndTime; - } - var corr = this._localEndTimeCorrelation; - var timePassed = this._now - corr.local; - var extrapolatedEndTime = (corr.remote + timePassed) / 1000; - return Math.max(actualEndTime - this._extrapolatedWindowDuration, Math.min(extrapolatedEndTime, actualEndTime)); - } - }, { - key: '_duration', + key: 'ended', get: function get() { - return this._extrapolatedEndTime - this._startTime; + return this._currentState === 'ENDED'; } - // Returns the duration (seconds) of the window that the extrapolated start time is allowed - // to move in before being capped. - // The extrapolated start time should never reach the cap at the end of the window as the - // window should slide as chunks are removed from the start. - // This also applies to the extrapolated end time in the same way. - // - // If chunks aren't being removed for some reason that the start time will reach and remain fixed at - // playableRegionStartTime + extrapolatedWindowDuration - // - // <-- window duration --> - // I.e playableRegionStartTime |-----------------------| - // | --> . . . - // . --> | --> . . - // . . --> | --> . - // . . . --> | - // . . . . - // extrapolatedStartTime + /** + * Determine if the playback is buffering. + * This is related to the PLAYBACK_BUFFERING and PLAYBACK_BUFFERFULL events + * @property buffering + * @type Boolean + */ }, { - key: '_extrapolatedWindowDuration', + key: 'buffering', get: function get() { - if (this._segmentTargetDuration === null) { - return 0; - } - return this._extrapolatedWindowNumSegments * this._segmentTargetDuration; + return !!this._bufferingState && this._currentState !== 'ENDED'; } }]); - function HLS() { - _classCallCheck(this, HLS); + function Flash() { + (0, _classCallCheck3.default)(this, Flash); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } - // backwards compatibility (TODO: remove on 0.3.0) - var _this = _possibleConstructorReturn(this, _HTML5VideoPlayback.call.apply(_HTML5VideoPlayback, [this].concat(args))); + var _this = (0, _possibleConstructorReturn3.default)(this, _BaseFlashPlayback.call.apply(_BaseFlashPlayback, [this].concat(args))); - _this.options.playback || (_this.options.playback = _this.options); - _this._minDvrSize = typeof _this.options.hlsMinimumDvrSize === 'undefined' ? 60 : _this.options.hlsMinimumDvrSize; - // The size of the start time extrapolation window measured as a multiple of segments. - // Should be 2 or higher, or 0 to disable. Should only need to be increased above 2 if more than one segment is - // removed from the start of the playlist at a time. E.g if the playlist is cached for 10 seconds and new chunks are - // added/removed every 5. - _this._extrapolatedWindowNumSegments = !_this.options.playback || typeof _this.options.playback.extrapolatedWindowNumSegments === 'undefined' ? 2 : _this.options.playback.extrapolatedWindowNumSegments; + _this._src = _this.options.src; + _this._baseUrl = _this.options.baseUrl; + _this._autoPlay = _this.options.autoPlay; + _this.settings = { default: ['seekbar'] }; + _this.settings.left = ['playpause', 'position', 'duration']; + _this.settings.right = ['fullscreen', 'volume']; + _this.settings.seekEnabled = true; + _this._isReadyState = false; + _this._addListeners(); + return _this; + } - _this._playbackType = _playback2.default.VOD; - _this._lastTimeUpdate = null; - _this._lastDuration = null; - // for hls streams which have dvr with a sliding window, - // the content at the start of the playlist is removed as new - // content is appended at the end. - // this means the actual playable start time will increase as the - // start content is deleted - // For streams with dvr where the entire recording is kept from the - // beginning this should stay as 0 - _this._playableRegionStartTime = 0; - // {local, remote} remote is the time in the video element that should represent 0 - // local is the system time when the 'remote' measurment took place - _this._localStartTimeCorrelation = null; - // {local, remote} remote is the time in the video element that should represents the end - // local is the system time when the 'remote' measurment took place - _this._localEndTimeCorrelation = null; - // if content is removed from the beginning then this empty area should - // be ignored. "playableRegionDuration" excludes the empty area - _this._playableRegionDuration = 0; - // true when the actual duration is longer than hlsjs's live sync point - // when this is false playableRegionDuration will be the actual duration - // when this is true playableRegionDuration will exclude the time after the sync point - _this._durationExcludesAfterLiveSyncPoint = false; - // #EXT-X-TARGETDURATION - _this._segmentTargetDuration = null; - // #EXT-X-PLAYLIST-TYPE - _this._playlistType = null; - _this._recoverAttemptsRemaining = _this.options.hlsRecoverAttempts || 16; - _this._startTimeUpdateTimer(); - return _this; - } - - HLS.prototype._setupHls = function _setupHls() { + Flash.prototype._bootstrap = function _bootstrap() { var _this2 = this; - this._hls = new _hls2.default(this.options.playback.hlsjsConfig || {}); - this._hls.on(_hls2.default.Events.MEDIA_ATTACHED, function () { - return _this2._hls.loadSource(_this2.options.src); - }); - this._hls.on(_hls2.default.Events.LEVEL_LOADED, function (evt, data) { - return _this2._updatePlaybackType(evt, data); - }); - this._hls.on(_hls2.default.Events.LEVEL_UPDATED, function (evt, data) { - return _this2._onLevelUpdated(evt, data); - }); - this._hls.on(_hls2.default.Events.LEVEL_SWITCH, function (evt, data) { - return _this2._onLevelSwitch(evt, data); - }); - this._hls.on(_hls2.default.Events.FRAG_LOADED, function (evt, data) { - return _this2._onFragmentLoaded(evt, data); - }); - this._hls.on(_hls2.default.Events.ERROR, function (evt, data) { - return _this2._onHLSJSError(evt, data); - }); - this._hls.attachMedia(this.el); - }; - - HLS.prototype._recover = function _recover(evt, data) { - if (!this._recoveredDecodingError) { - this._recoveredDecodingError = true; - this._hls.recoverMediaError(); - } else if (!this._recoveredAudioCodecError) { - this._recoveredAudioCodecError = true; - this._hls.swapAudioCodec(); - this._hls.recoverMediaError(); + if (this.el.playerPlay) { + this.el.width = '100%'; + this.el.height = '100%'; + if (this._currentState === 'PLAYING') { + this._firstPlay(); + } else { + this._currentState = 'IDLE'; + this._autoPlay && this.play(); + } + (0, _clapprZepto2.default)('
').insertAfter(this.$el); + if (this.getDuration() > 0) { + this._metadataLoaded(); + } else { + _mediator2.default.once(this.uniqueId + ':timeupdate', this._metadataLoaded, this); + } } else { - _log2.default.error('hlsjs: failed to recover'); - this.trigger(_events2.default.PLAYBACK_ERROR, 'hlsjs: could not recover from error, evt ' + evt + ', data ' + data + ' ', this.name); + this._attempts = this._attempts || 0; + if (++this._attempts <= MAX_ATTEMPTS) { + setTimeout(function () { + return _this2._bootstrap(); + }, 50); + } else { + this.trigger(_events2.default.PLAYBACK_ERROR, { message: 'Max number of attempts reached' }, this.name); + } } }; - // override - - - HLS.prototype._setupSrc = function _setupSrc(srcUrl) {// eslint-disable-line no-unused-vars - // this playback manages the src on the video element itself + Flash.prototype._metadataLoaded = function _metadataLoaded() { + this._isReadyState = true; + this.trigger(_events2.default.PLAYBACK_READY, this.name); + this.trigger(_events2.default.PLAYBACK_SETTINGSUPDATE, this.name); }; - HLS.prototype._startTimeUpdateTimer = function _startTimeUpdateTimer() { - var _this3 = this; - - this._timeUpdateTimer = setInterval(function () { - _this3._onDurationChange(); - _this3._onTimeUpdate(); - }, 100); + Flash.prototype.getPlaybackType = function getPlaybackType() { + return _playback2.default.VOD; }; - HLS.prototype._stopTimeUpdateTimer = function _stopTimeUpdateTimer() { - clearInterval(this._timeUpdateTimer); + Flash.prototype.isHighDefinitionInUse = function isHighDefinitionInUse() { + return false; }; - // the duration on the video element itself should not be used - // as this does not necesarily represent the duration of the stream - // https://github.com/clappr/clappr/issues/668#issuecomment-157036678 - - - HLS.prototype.getDuration = function getDuration() { - return this._duration; + Flash.prototype._updateTime = function _updateTime() { + this.trigger(_events2.default.PLAYBACK_TIMEUPDATE, { current: this.el.getPosition(), total: this.el.getDuration() }, this.name); }; - HLS.prototype.getCurrentTime = function getCurrentTime() { - // e.g. can be < 0 if user pauses near the start - // eventually they will then be kicked to the end by hlsjs if they run out of buffer - // before the official start time - return Math.max(0, this.el.currentTime - this._startTime); + Flash.prototype._addListeners = function _addListeners() { + _mediator2.default.on(this.uniqueId + ':progress', this._progress, this); + _mediator2.default.on(this.uniqueId + ':timeupdate', this._updateTime, this); + _mediator2.default.on(this.uniqueId + ':statechanged', this._checkState, this); + _mediator2.default.on(this.uniqueId + ':flashready', this._bootstrap, this); }; - // the time that "0" now represents relative to when playback started - // for a stream with a sliding window this will increase as content is - // removed from the beginning - - - HLS.prototype.getStartTimeOffset = function getStartTimeOffset() { - return this._startTime; + Flash.prototype.stopListening = function stopListening() { + _BaseFlashPlayback.prototype.stopListening.call(this); + _mediator2.default.off(this.uniqueId + ':progress'); + _mediator2.default.off(this.uniqueId + ':timeupdate'); + _mediator2.default.off(this.uniqueId + ':statechanged'); + _mediator2.default.off(this.uniqueId + ':flashready'); }; - HLS.prototype.seekPercentage = function seekPercentage(percentage) { - var seekTo = this._duration; - if (percentage > 0) { - seekTo = this._duration * (percentage / 100); + Flash.prototype._checkState = function _checkState() { + if (this._isIdle || this._currentState === 'PAUSED') { + return; + } else if (this._currentState !== 'PLAYING_BUFFERING' && this.el.getState() === 'PLAYING_BUFFERING') { + this._bufferingState = true; + this.trigger(_events2.default.PLAYBACK_BUFFERING, this.name); + this._currentState = 'PLAYING_BUFFERING'; + } else if (this.el.getState() === 'PLAYING') { + this._bufferingState = false; + this.trigger(_events2.default.PLAYBACK_BUFFERFULL, this.name); + this._currentState = 'PLAYING'; + } else if (this.el.getState() === 'IDLE') { + this._currentState = 'IDLE'; + } else if (this.el.getState() === 'ENDED') { + this.trigger(_events2.default.PLAYBACK_ENDED, this.name); + this.trigger(_events2.default.PLAYBACK_TIMEUPDATE, { current: 0, total: this.el.getDuration() }, this.name); + this._currentState = 'ENDED'; + this._isIdle = true; } - this.seek(seekTo); }; - HLS.prototype.seek = function seek(time) { - if (time < 0) { - _log2.default.warn('Attempt to seek to a negative time. Resetting to live point. Use seekToLivePoint() to seek to the live point.'); - time = this.getDuration(); + Flash.prototype._progress = function _progress() { + if (this._currentState !== 'IDLE' && this._currentState !== 'ENDED') { + this.trigger(_events2.default.PLAYBACK_PROGRESS, { + start: 0, + current: this.el.getBytesLoaded(), + total: this.el.getBytesTotal() + }); } - // assume live if time within 3 seconds of end of stream - this.dvrEnabled && this._updateDvr(time < this.getDuration() - 3); - time += this._startTime; - _HTML5VideoPlayback.prototype.seek.call(this, time); }; - HLS.prototype.seekToLivePoint = function seekToLivePoint() { - this.seek(this.getDuration()); + Flash.prototype._firstPlay = function _firstPlay() { + var _this3 = this; + + if (this.el.playerPlay) { + this._isIdle = false; + this.el.playerPlay(this._src); + this.listenToOnce(this, _events2.default.PLAYBACK_BUFFERFULL, function () { + return _this3._checkInitialSeek(); + }); + this._currentState = 'PLAYING'; + } else { + this.listenToOnce(this, _events2.default.PLAYBACK_READY, this._firstPlay); + } }; - HLS.prototype._updateDvr = function _updateDvr(status) { - this.trigger(_events2.default.PLAYBACK_DVR, status); - this.trigger(_events2.default.PLAYBACK_STATS_ADD, { 'dvr': status }); + Flash.prototype._checkInitialSeek = function _checkInitialSeek() { + var seekTime = (0, _utils.seekStringToSeconds)(window.location.href); + if (seekTime !== 0) { + this.seekSeconds(seekTime); + } }; - HLS.prototype._updateSettings = function _updateSettings() { - if (this._playbackType === _playback2.default.VOD) { - this.settings.left = ['playpause', 'position', 'duration']; - } else if (this.dvrEnabled) { - this.settings.left = ['playpause']; - } else { - this.settings.left = ['playstop']; + Flash.prototype.play = function play() { + this.trigger(_events2.default.PLAYBACK_PLAY_INTENT); + if (this._currentState === 'PAUSED' || this._currentState === 'PLAYING_BUFFERING') { + this._currentState = 'PLAYING'; + this.el.playerResume(); + this.trigger(_events2.default.PLAYBACK_PLAY, this.name); + } else if (this._currentState !== 'PLAYING') { + this._firstPlay(); + this.trigger(_events2.default.PLAYBACK_PLAY, this.name); } - this.settings.seekEnabled = this.isSeekEnabled(); - this.trigger(_events2.default.PLAYBACK_SETTINGSUPDATE); }; - HLS.prototype._onHLSJSError = function _onHLSJSError(evt, data) { - // only report/handle errors if they are fatal - // hlsjs should automatically handle non fatal errors - if (data.fatal) { - if (this._recoverAttemptsRemaining > 0) { - this._recoverAttemptsRemaining -= 1; - switch (data.type) { - case _hls2.default.ErrorTypes.NETWORK_ERROR: - _log2.default.warn('hlsjs: trying to recover from network error, evt ' + evt + ', data ' + data + ' '); - this._hls.startLoad(); - break; - case _hls2.default.ErrorTypes.MEDIA_ERROR: - _log2.default.warn('hlsjs: trying to recover from media error, evt ' + evt + ', data ' + data + ' '); - this._recover(evt, data); - break; - default: - _log2.default.error('hlsjs: trying to recover from error, evt ' + evt + ', data ' + data + ' '); - this.trigger(_events2.default.PLAYBACK_ERROR, 'hlsjs: could not recover from error, evt ' + evt + ', data ' + data + ' ', this.name); - break; - } - } else { - _log2.default.error('hlsjs: could not recover from error after maximum number of attempts, evt ' + evt + ', data ' + data + ' '); - this.trigger(_events2.default.PLAYBACK_ERROR, { evt: evt, data: data }, this.name); - } + Flash.prototype.volume = function volume(value) { + var _this4 = this; + + if (this.isReady) { + this.el.playerVolume(value); } else { - _log2.default.warn('hlsjs: non-fatal error occurred, evt ' + evt + ', data ' + data + ' '); + this.listenToOnce(this, _events2.default.PLAYBACK_BUFFERFULL, function () { + return _this4.volume(value); + }); } }; - HLS.prototype._onTimeUpdate = function _onTimeUpdate() { - var update = { current: this.getCurrentTime(), total: this.getDuration() }; - if ((0, _lodash2.default)(update, this._lastTimeUpdate)) { - return; - } - this._lastTimeUpdate = update; - this.trigger(_events2.default.PLAYBACK_TIMEUPDATE, update, this.name); + Flash.prototype.pause = function pause() { + this._currentState = 'PAUSED'; + this.el.playerPause(); + this.trigger(_events2.default.PLAYBACK_PAUSE, this.name); }; - HLS.prototype._onDurationChange = function _onDurationChange() { - var duration = this.getDuration(); - if (this._lastDuration === duration) { - return; - } - this._lastDuration = duration; - _HTML5VideoPlayback.prototype._onDurationChange.call(this); + Flash.prototype.stop = function stop() { + this.el.playerStop(); + this.trigger(_events2.default.PLAYBACK_STOP); + this.trigger(_events2.default.PLAYBACK_TIMEUPDATE, { current: 0, total: 0 }, this.name); }; - HLS.prototype._onProgress = function _onProgress() { - if (!this.el.buffered.length) { - return; - } - var buffered = []; - var bufferedPos = 0; - for (var i = 0; i < this.el.buffered.length; i++) { - buffered = [].concat(_toConsumableArray(buffered), [{ - // for a stream with sliding window dvr something that is buffered my slide off the start of the timeline - start: Math.max(0, this.el.buffered.start(i) - this._playableRegionStartTime), - end: Math.max(0, this.el.buffered.end(i) - this._playableRegionStartTime) - }]); - if (this.el.currentTime >= buffered[i].start && this.el.currentTime <= buffered[i].end) { - bufferedPos = i; - } - } - var progress = { - start: buffered[bufferedPos].start, - current: buffered[bufferedPos].end, - total: this.getDuration() - }; - this.trigger(_events2.default.PLAYBACK_PROGRESS, progress, buffered); + Flash.prototype.isPlaying = function isPlaying() { + return !!(this.isReady && this._currentState.indexOf('PLAYING') > -1); }; - HLS.prototype.play = function play() { - if (!this._hls) { - this._setupHls(); - } - _HTML5VideoPlayback.prototype.play.call(this); + Flash.prototype.getDuration = function getDuration() { + return this.el.getDuration(); }; - HLS.prototype.pause = function pause() { - if (!this._hls) { - return; - } - _HTML5VideoPlayback.prototype.pause.call(this); - if (this.dvrEnabled) { - this._updateDvr(true); - } - }; + Flash.prototype.seekPercentage = function seekPercentage(percentage) { + var _this5 = this; - HLS.prototype.stop = function stop() { - if (this._hls) { - _HTML5VideoPlayback.prototype.stop.call(this); - this._hls.destroy(); - delete this._hls; + if (this.el.getDuration() > 0) { + var seekSeconds = this.el.getDuration() * (percentage / 100); + this.seek(seekSeconds); + } else { + this.listenToOnce(this, _events2.default.PLAYBACK_BUFFERFULL, function () { + return _this5.seekPercentage(percentage); + }); } }; - HLS.prototype.destroy = function destroy() { - this._stopTimeUpdateTimer(); - if (this._hls) { - this._hls.destroy(); - delete this._hls; + Flash.prototype.seek = function seek(time) { + var _this6 = this; + + if (this.isReady && this.el.playerSeek) { + this.el.playerSeek(time); + this.trigger(_events2.default.PLAYBACK_TIMEUPDATE, { current: time, total: this.el.getDuration() }, this.name); + if (this._currentState === 'PAUSED') { + this.el.playerPause(); + } + } else { + this.listenToOnce(this, _events2.default.PLAYBACK_BUFFERFULL, function () { + return _this6.seek(time); + }); } - _HTML5VideoPlayback.prototype.destroy.call(this); }; - HLS.prototype._updatePlaybackType = function _updatePlaybackType(evt, data) { - this._playbackType = data.details.live ? _playback2.default.LIVE : _playback2.default.VOD; - this._fillLevels(); - this._onLevelUpdated(evt, data); + Flash.prototype.destroy = function destroy() { + clearInterval(this.bootstrapId); + _BaseFlashPlayback.prototype.stopListening.call(this); + this.$el.remove(); }; - HLS.prototype._fillLevels = function _fillLevels() { - this._levels = this._hls.levels.map(function (level, index) { - return { id: index, level: level, label: level.bitrate / 1000 + 'Kbps' }; - }); - this.trigger(_events2.default.PLAYBACK_LEVELS_AVAILABLE, this._levels); - }; + (0, _createClass3.default)(Flash, [{ + key: 'isReady', + get: function get() { + return this._isReadyState; + } + }]); + return Flash; +}(_base_flash_playback2.default); - HLS.prototype._onLevelUpdated = function _onLevelUpdated(evt, data) { - this._segmentTargetDuration = data.details.targetduration; - this._playlistType = data.details.type || null; +exports.default = Flash; - var startTimeChanged = false; - var durationChanged = false; - var fragments = data.details.fragments; - var previousPlayableRegionStartTime = this._playableRegionStartTime; - var previousPlayableRegionDuration = this._playableRegionDuration; - if (fragments.length === 0) { - return; - } +Flash.canPlay = function (resource) { + if (!_browser2.default.hasFlash || !resource || resource.constructor !== String) { + return false; + } else { + var resourceParts = resource.split('?')[0].match(/.*\.(.*)$/) || []; + return resourceParts.length > 1 && !_browser2.default.isMobile && resourceParts[1].toLowerCase().match(/^(mp4|mov|f4v|3gpp|3gp)$/); + } +}; +module.exports = exports['default']; - if (this._playableRegionStartTime !== fragments[0].start) { - startTimeChanged = true; - this._playableRegionStartTime = fragments[0].start; - } +/***/ }), +/* 98 */ +/***/ (function(module, exports, __webpack_require__) { - if (startTimeChanged) { - if (!this._localStartTimeCorrelation) { - // set the correlation to map to middle of the extrapolation window - this._localStartTimeCorrelation = { - local: this._now, - remote: (fragments[0].start + this._extrapolatedWindowDuration / 2) * 1000 - }; - } else { - // check if the correlation still works - var corr = this._localStartTimeCorrelation; - var timePassed = this._now - corr.local; - // this should point to a time within the extrapolation window - var startTime = (corr.remote + timePassed) / 1000; - if (startTime < fragments[0].start) { - // our start time is now earlier than the first chunk - // (maybe the chunk was removed early) - // reset correlation so that it sits at the beginning of the first available chunk - this._localStartTimeCorrelation = { - local: this._now, - remote: fragments[0].start * 1000 - }; - } else if (startTime > previousPlayableRegionStartTime + this._extrapolatedWindowDuration) { - // start time was past the end of the old extrapolation window (so would have been capped) - // see if now that time would be inside the window, and if it would be set the correlation - // so that it resumes from the time it was at at the end of the old window - // update the correlation so that the time starts counting again from the value it's on now - this._localStartTimeCorrelation = { - local: this._now, - remote: Math.max(fragments[0].start, previousPlayableRegionStartTime + this._extrapolatedWindowDuration) * 1000 - }; - } - } - } +"use strict"; - var newDuration = data.details.totalduration; - // if it's a live stream then shorten the duration to remove access - // to the area after hlsjs's live sync point - // seeks to areas after this point sometimes have issues - if (this._playbackType === _playback2.default.LIVE) { - var fragmentTargetDuration = data.details.targetduration; - var hlsjsConfig = this.options.playback || {}; - var liveSyncDurationCount = hlsjsConfig.liveSyncDurationCount || _hls2.default.DefaultConfig.liveSyncDurationCount; - var hiddenAreaDuration = fragmentTargetDuration * liveSyncDurationCount; - if (hiddenAreaDuration <= newDuration) { - newDuration -= hiddenAreaDuration; - this._durationExcludesAfterLiveSyncPoint = true; - } else { - this._durationExcludesAfterLiveSyncPoint = false; - } - } - if (newDuration !== this._playableRegionDuration) { - durationChanged = true; - this._playableRegionDuration = newDuration; - } +Object.defineProperty(exports, "__esModule", { + value: true +}); - // Note the end time is not the playableRegionDuration - // The end time will always increase even if content is removed from the beginning - var endTime = fragments[0].start + newDuration; - var previousEndTime = previousPlayableRegionStartTime + previousPlayableRegionDuration; - var endTimeChanged = endTime !== previousEndTime; - if (endTimeChanged) { - if (!this._localEndTimeCorrelation) { - // set the correlation to map to the end - this._localEndTimeCorrelation = { - local: this._now, - remote: endTime * 1000 - }; - } else { - // check if the correlation still works - var _corr = this._localEndTimeCorrelation; - var _timePassed = this._now - _corr.local; - // this should point to a time within the extrapolation window from the end - var extrapolatedEndTime = (_corr.remote + _timePassed) / 1000; - if (extrapolatedEndTime > endTime) { - this._localEndTimeCorrelation = { - local: this._now, - remote: endTime * 1000 - }; - } else if (extrapolatedEndTime < endTime - this._extrapolatedWindowDuration) { - // our extrapolated end time is now earlier than the extrapolation window from the actual end time - // (maybe a chunk became available early) - // reset correlation so that it sits at the beginning of the extrapolation window from the end time - this._localEndTimeCorrelation = { - local: this._now, - remote: (endTime - this._extrapolatedWindowDuration) * 1000 - }; - } else if (extrapolatedEndTime > previousEndTime) { - // end time was past the old end time (so would have been capped) - // set the correlation so that it resumes from the time it was at at the end of the old window - this._localEndTimeCorrelation = { - local: this._now, - remote: previousEndTime * 1000 - }; - } - } - } +var _classCallCheck2 = __webpack_require__(0); - // now that the values have been updated call any methods that use on them so they get the updated values - // immediately - durationChanged && this._onDurationChange(); - startTimeChanged && this._onProgress(); - }; +var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - HLS.prototype._onFragmentLoaded = function _onFragmentLoaded(evt, data) { - this.trigger(_events2.default.PLAYBACK_FRAGMENT_LOADED, data); - }; +var _possibleConstructorReturn2 = __webpack_require__(2); - HLS.prototype._onLevelSwitch = function _onLevelSwitch(evt, data) { - if (!this.levels.length) { - this._fillLevels(); - } - this.trigger(_events2.default.PLAYBACK_LEVEL_SWITCH_END); - this.trigger(_events2.default.PLAYBACK_LEVEL_SWITCH, data); - var currentLevel = this._hls.levels[data.level]; - if (currentLevel) { - // TODO should highDefinition be private and maybe have a read only accessor if it's used somewhere - this.highDefinition = currentLevel.height >= 720 || currentLevel.bitrate / 1000 >= 2000; - this.trigger(_events2.default.PLAYBACK_HIGHDEFINITIONUPDATE, this.highDefinition); - this.trigger(_events2.default.PLAYBACK_BITRATE, { - height: currentLevel.height, - width: currentLevel.width, - bandwidth: currentLevel.bitrate, - bitrate: currentLevel.bitrate, - level: data.level - }); - } - }; +var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - HLS.prototype.getPlaybackType = function getPlaybackType() { - return this._playbackType; - }; +var _createClass2 = __webpack_require__(3); - HLS.prototype.isSeekEnabled = function isSeekEnabled() { - return this._playbackType === _playback2.default.VOD || this.dvrEnabled; - }; +var _createClass3 = _interopRequireDefault(_createClass2); - _createClass(HLS, [{ - key: 'dvrEnabled', - get: function get() { - // enabled when: - // - the duration does not include content after hlsjs's live sync point - // - the playable region duration is longer than the configured duration to enable dvr after - // - the playback type is LIVE. - return this._durationExcludesAfterLiveSyncPoint && this._duration >= this._minDvrSize && this.getPlaybackType() === _playback2.default.LIVE; - } - }]); - - return HLS; -}(_html5_video2.default); - -exports.default = HLS; - - -HLS.canPlay = function (resource, mimeType) { - var resourceParts = resource.split('?')[0].match(/.*\.(.*)$/) || []; - var isHls = resourceParts.length > 1 && resourceParts[1].toLowerCase() === 'm3u8' || mimeType === 'application/x-mpegURL' || mimeType === 'application/vnd.apple.mpegurl'; - - return !!(_hls2.default.isSupported() && isHls); -}; -module.exports = exports['default']; - -/***/ }), -/* 53 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +var _inherits2 = __webpack_require__(1); +var _inherits3 = _interopRequireDefault(_inherits2); -Object.defineProperty(exports, "__esModule", { - value: true -}); +var _base_flash_playback = __webpack_require__(39); -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 _base_flash_playback2 = _interopRequireDefault(_base_flash_playback); -var _events = __webpack_require__(0); +var _events = __webpack_require__(4); var _events2 = _interopRequireDefault(_events); -var _playback = __webpack_require__(2); - -var _playback2 = _interopRequireDefault(_playback); - -var _html5_video = __webpack_require__(16); - -var _html5_video2 = _interopRequireDefault(_html5_video); - -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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(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; } // Copyright 2014 Globo.com Player authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// TODO: remove this playback and change HTML5Video to HTML5Playback (breaking change, only after 0.3.0) -var HTML5Audio = function (_HTML5Video) { - _inherits(HTML5Audio, _HTML5Video); - - function HTML5Audio() { - _classCallCheck(this, HTML5Audio); - - return _possibleConstructorReturn(this, _HTML5Video.apply(this, arguments)); - } - - HTML5Audio.prototype.updateSettings = function updateSettings() { - this.settings.left = ['playpause', 'position', 'duration']; - this.settings.seekEnabled = this.isSeekEnabled(); - this.trigger(_events2.default.PLAYBACK_SETTINGSUPDATE); - }; - - HTML5Audio.prototype.getPlaybackType = function getPlaybackType() { - return _playback2.default.AOD; - }; - - _createClass(HTML5Audio, [{ - key: 'name', - get: function get() { - return 'html5_audio'; - } - }, { - key: 'tagName', - get: function get() { - return 'audio'; - } - }, { - key: 'isAudioOnly', - get: function get() { - return true; - } - }]); - - return HTML5Audio; -}(_html5_video2.default); - -exports.default = HTML5Audio; - - -HTML5Audio.canPlay = function (resourceUrl, mimeType) { - var mimetypes = { - 'wav': ['audio/wav'], - 'mp3': ['audio/mp3', 'audio/mpeg;codecs="mp3"'], - 'aac': ['audio/mp4;codecs="mp4a.40.5"'], - 'oga': ['audio/ogg'] - }; - return _html5_video2.default._canPlay('audio', mimetypes, resourceUrl, mimeType); -}; -module.exports = exports['default']; - -/***/ }), -/* 54 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(process) { - -Object.defineProperty(exports, "__esModule", { - value: 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 _template = __webpack_require__(9); -var _utils = __webpack_require__(1); +var _template2 = _interopRequireDefault(_template); -var _playback = __webpack_require__(2); +var _playback = __webpack_require__(7); var _playback2 = _interopRequireDefault(_playback); -var _styler = __webpack_require__(4); +var _mediator = __webpack_require__(22); -var _styler2 = _interopRequireDefault(_styler); +var _mediator2 = _interopRequireDefault(_mediator); -var _browser = __webpack_require__(7); +var _browser = __webpack_require__(13); var _browser2 = _interopRequireDefault(_browser); -var _events = __webpack_require__(0); +var _flashls_events = __webpack_require__(99); -var _events2 = _interopRequireDefault(_events); +var _flashls_events2 = _interopRequireDefault(_flashls_events); -var _style = __webpack_require__(86); +var _HLSPlayer = __webpack_require__(207); -var _style2 = _interopRequireDefault(_style); +var _HLSPlayer2 = _interopRequireDefault(_HLSPlayer); -var _clapprZepto = __webpack_require__(3); +var _clapprZepto = __webpack_require__(6); var _clapprZepto2 = _interopRequireDefault(_clapprZepto); 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"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(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; } - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } // Copyright 2014 Globo.com Player authors. All rights reserved. +var MAX_ATTEMPTS = 60; // Copyright 2014 Globo.com Player authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -var MIMETYPES = { - 'mp4': ['avc1.42E01E', 'avc1.58A01E', 'avc1.4D401E', 'avc1.64001E', 'mp4v.20.8', 'mp4v.20.240', 'mp4a.40.2'].map(function (codec) { - return 'video/mp4; codecs="' + codec + ', mp4a.40.2"'; - }), - 'ogg': ['video/ogg; codecs="theora, vorbis"', 'video/ogg; codecs="dirac"', 'video/ogg; codecs="theora, speex"'], - '3gpp': ['video/3gpp; codecs="mp4v.20.8, samr"'], - 'webm': ['video/webm; codecs="vp8, vorbis"'], - 'mkv': ['video/x-matroska; codecs="theora, vorbis"'], - 'm3u8': ['application/x-mpegurl'] -}; -MIMETYPES['ogv'] = MIMETYPES['ogg']; -MIMETYPES['3gp'] = MIMETYPES['3gpp']; - -var AUDIO_MIMETYPES = { - 'wav': ['audio/wav'], - 'mp3': ['audio/mp3', 'audio/mpeg;codecs="mp3"'], - 'aac': ['audio/mp4;codecs="mp4a.40.5"'], - 'oga': ['audio/ogg'] -}; - -var KNOWN_AUDIO_MIMETYPES = Object.keys(AUDIO_MIMETYPES).reduce(function (acc, k) { - return [].concat(_toConsumableArray(acc), _toConsumableArray(AUDIO_MIMETYPES[k])); -}, []); - -// TODO: rename this Playback to HTML5Playback (breaking change, only after 0.3.0) - -var HTML5Video = function (_Playback) { - _inherits(HTML5Video, _Playback); +var AUTO = -1; - _createClass(HTML5Video, [{ +var FlasHLS = function (_BaseFlashPlayback) { + (0, _inherits3.default)(FlasHLS, _BaseFlashPlayback); + (0, _createClass3.default)(FlasHLS, [{ key: 'name', get: function get() { - return 'html5_video'; - } - }, { - key: 'tagName', - get: function get() { - return this.isAudioOnly ? 'audio' : 'video'; + return 'flashls'; } }, { - key: 'isAudioOnly', + key: 'swfPath', get: function get() { - var resourceUrl = this.options.src; - var mimeTypes = HTML5Video._mimeTypesForUrl(resourceUrl, AUDIO_MIMETYPES, this.options.mimeType); - return this.options.playback && this.options.playback.audioOnly || this.options.audioOnly || KNOWN_AUDIO_MIMETYPES.indexOf(mimeTypes[0]) >= 0; + return (0, _template2.default)(_HLSPlayer2.default)({ baseUrl: this._baseUrl }); } }, { - key: 'attributes', + key: 'levels', get: function get() { - return { - 'data-html5-video': '' - }; + return this._levels || []; } }, { - key: 'events', + key: 'currentLevel', get: function get() { - return { - 'canplay': '_onCanPlay', - 'canplaythrough': '_handleBufferingEvents', - 'durationchange': '_onDurationChange', - 'ended': '_onEnded', - 'error': '_onError', - 'loadeddata': '_onLoadedData', - 'loadedmetadata': '_onLoadedMetadata', - 'pause': '_onPause', - 'playing': '_onPlaying', - 'progress': '_onProgress', - 'seeked': '_handleBufferingEvents', - 'seeking': '_handleBufferingEvents', - 'stalled': '_handleBufferingEvents', - 'timeupdate': '_onTimeUpdate', - 'waiting': '_onWaiting' - }; + if (this._currentLevel === null || this._currentLevel === undefined) { + return AUTO; + } else { + return this._currentLevel; //0 is a valid level ID + } + }, + set: function set(id) { + this._currentLevel = id; + this.trigger(_events2.default.PLAYBACK_LEVEL_SWITCH_START); + this.el.playerSetCurrentLevel(id); } /** @@ -12632,12 +9950,11 @@ var HTML5Video = function (_Playback) { }, { key: 'ended', get: function get() { - return this.el.ended; + return this._hasEnded; } /** - * Determine if the playback is having to buffer in order for - * playback to be smooth. + * Determine if the playback is buffering. * This is related to the PLAYBACK_BUFFERING and PLAYBACK_BUFFERFULL events * @property buffering * @type Boolean @@ -12646,689 +9963,808 @@ var HTML5Video = function (_Playback) { }, { key: 'buffering', get: function get() { - return !!this._bufferingState; + return !!this._bufferingState && !this._hasEnded; } }]); - function HTML5Video() { - _classCallCheck(this, HTML5Video); + function FlasHLS() { + (0, _classCallCheck3.default)(this, FlasHLS); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } - var _this = _possibleConstructorReturn(this, _Playback.call.apply(_Playback, [this].concat(args))); - - _this._destroyed = false; - _this._loadStarted = false; - _this._playheadMoving = false; - _this._playheadMovingTimer = null; - _this._stopped = false; - _this._setupSrc(_this.options.src); - // backwards compatibility (TODO: remove on 0.3.0) - _this.options.playback || (_this.options.playback = _this.options || {}); - _this.options.playback.disableContextMenu = _this.options.playback.disableContextMenu || _this.options.disableVideoTagContextMenu; - - var playbackConfig = _this.options.playback; - var preload = playbackConfig.preload || (_browser2.default.isSafari ? 'auto' : _this.options.preload); - - var posterUrl = void 0; // FIXME: poster plugin should always convert poster to object with expected properties ? - if (_this.options.poster) { - if (typeof _this.options.poster === 'string') { - posterUrl = _this.options.poster; - } else if (typeof _this.options.poster.url === 'string') { - posterUrl = _this.options.poster.url; - } - } - - _clapprZepto2.default.extend(_this.el, { - loop: _this.options.loop, - poster: posterUrl, - preload: preload || 'metadata', - controls: (playbackConfig.controls || _this.options.useVideoTagDefaultControls) && 'controls', - crossOrigin: playbackConfig.crossOrigin, - 'x-webkit-playsinline': playbackConfig.playInline - }); + var _this = (0, _possibleConstructorReturn3.default)(this, _BaseFlashPlayback.call.apply(_BaseFlashPlayback, [this].concat(args))); - playbackConfig.playInline && _this.$el.attr({ playsinline: 'playsinline' }); + _this._src = _this.options.src; + _this._baseUrl = _this.options.baseUrl; + _this._initHlsParameters(_this.options); + // TODO can this be private? + _this.highDefinition = false; + _this._autoPlay = _this.options.autoPlay; + _this._loop = _this.options.loop; + _this._defaultSettings = { + left: ['playstop'], + default: ['seekbar'], + right: ['fullscreen', 'volume', 'hd-indicator'], + seekEnabled: false + }; + _this.settings = _clapprZepto2.default.extend({}, _this._defaultSettings); + _this._playbackType = _playback2.default.LIVE; + _this._hasEnded = false; + _this._addListeners(); + return _this; + } - // TODO should settings be private? - _this.settings = { default: ['seekbar'] }; - _this.settings.left = ['playpause', 'position', 'duration']; - _this.settings.right = ['fullscreen', 'volume', 'hd-indicator']; + FlasHLS.prototype._initHlsParameters = function _initHlsParameters(options) { + this._autoStartLoad = options.autoStartLoad === undefined ? true : options.autoStartLoad; + this._capLevelToStage = options.capLevelToStage === undefined ? false : options.capLevelToStage; + this._maxLevelCappingMode = options.maxLevelCappingMode === undefined ? 'downscale' : options.maxLevelCappingMode; + this._minBufferLength = options.minBufferLength === undefined ? -1 : options.minBufferLength; + this._minBufferLengthCapping = options.minBufferLengthCapping === undefined ? -1 : options.minBufferLengthCapping; + this._maxBufferLength = options.maxBufferLength === undefined ? 120 : options.maxBufferLength; + this._maxBackBufferLength = options.maxBackBufferLength === undefined ? 30 : options.maxBackBufferLength; + this._lowBufferLength = options.lowBufferLength === undefined ? 3 : options.lowBufferLength; + this._mediaTimePeriod = options.mediaTimePeriod === undefined ? 100 : options.mediaTimePeriod; + this._fpsDroppedMonitoringPeriod = options.fpsDroppedMonitoringPeriod === undefined ? 5000 : options.fpsDroppedMonitoringPeriod; + this._fpsDroppedMonitoringThreshold = options.fpsDroppedMonitoringThreshold === undefined ? 0.2 : options.fpsDroppedMonitoringThreshold; + this._capLevelonFPSDrop = options.capLevelonFPSDrop === undefined ? false : options.capLevelonFPSDrop; + this._smoothAutoSwitchonFPSDrop = options.smoothAutoSwitchonFPSDrop === undefined ? this.capLevelonFPSDrop : options.smoothAutoSwitchonFPSDrop; + this._switchDownOnLevelError = options.switchDownOnLevelError === undefined ? true : options.switchDownOnLevelError; + this._seekMode = options.seekMode === undefined ? 'ACCURATE' : options.seekMode; + this._keyLoadMaxRetry = options.keyLoadMaxRetry === undefined ? 3 : options.keyLoadMaxRetry; + this._keyLoadMaxRetryTimeout = options.keyLoadMaxRetryTimeout === undefined ? 64000 : options.keyLoadMaxRetryTimeout; + this._fragmentLoadMaxRetry = options.fragmentLoadMaxRetry === undefined ? 3 : options.fragmentLoadMaxRetry; + this._fragmentLoadMaxRetryTimeout = options.fragmentLoadMaxRetryTimeout === undefined ? 4000 : options.fragmentLoadMaxRetryTimeout; + this._fragmentLoadSkipAfterMaxRetry = options.fragmentLoadSkipAfterMaxRetry === undefined ? true : options.fragmentLoadSkipAfterMaxRetry; + this._maxSkippedFragments = options.maxSkippedFragments === undefined ? 5 : options.maxSkippedFragments; + this._flushLiveURLCache = options.flushLiveURLCache === undefined ? false : options.flushLiveURLCache; + this._initialLiveManifestSize = options.initialLiveManifestSize === undefined ? 1 : options.initialLiveManifestSize; + this._manifestLoadMaxRetry = options.manifestLoadMaxRetry === undefined ? 3 : options.manifestLoadMaxRetry; + this._manifestLoadMaxRetryTimeout = options.manifestLoadMaxRetryTimeout === undefined ? 64000 : options.manifestLoadMaxRetryTimeout; + this._manifestRedundantLoadmaxRetry = options.manifestRedundantLoadmaxRetry === undefined ? 3 : options.manifestRedundantLoadmaxRetry; + this._startFromBitrate = options.startFromBitrate === undefined ? -1 : options.startFromBitrate; + this._startFromLevel = options.startFromLevel === undefined ? -1 : options.startFromLevel; + this._autoStartMaxDuration = options.autoStartMaxDuration === undefined ? -1 : options.autoStartMaxDuration; + this._seekFromLevel = options.seekFromLevel === undefined ? -1 : options.seekFromLevel; + this._useHardwareVideoDecoder = options.useHardwareVideoDecoder === undefined ? false : options.useHardwareVideoDecoder; + this._hlsLogEnabled = options.hlsLogEnabled === undefined ? true : options.hlsLogEnabled; + this._logDebug = options.logDebug === undefined ? false : options.logDebug; + this._logDebug2 = options.logDebug2 === undefined ? false : options.logDebug2; + this._logWarn = options.logWarn === undefined ? true : options.logWarn; + this._logError = options.logError === undefined ? true : options.logError; + this._hlsMinimumDvrSize = options.hlsMinimumDvrSize === undefined ? 60 : options.hlsMinimumDvrSize; + }; - // https://github.com/clappr/clappr/issues/1076 - _this.options.autoPlay && process.nextTick(function () { - return !_this._destroyed && _this.play(); + FlasHLS.prototype._addListeners = function _addListeners() { + var _this2 = this; + + _mediator2.default.on(this.cid + ':flashready', function () { + return _this2._bootstrap(); }); - return _this; - } + _mediator2.default.on(this.cid + ':timeupdate', function (timeMetrics) { + return _this2._updateTime(timeMetrics); + }); + _mediator2.default.on(this.cid + ':playbackstate', function (state) { + return _this2._setPlaybackState(state); + }); + _mediator2.default.on(this.cid + ':levelchanged', function (level) { + return _this2._levelChanged(level); + }); + _mediator2.default.on(this.cid + ':error', function (code, url, message) { + return _this2._flashPlaybackError(code, url, message); + }); + _mediator2.default.on(this.cid + ':fragmentloaded', function (loadmetrics) { + return _this2._onFragmentLoaded(loadmetrics); + }); + _mediator2.default.on(this.cid + ':levelendlist', function (level) { + return _this2._onLevelEndlist(level); + }); + }; - /** - * Sets the source url on the