From 904101aa2c7f198390dca4df1bf8a5c3358ba986 Mon Sep 17 00:00:00 2001 From: Chewbaka69 Date: Thu, 21 Feb 2019 22:05:10 +0100 Subject: [PATCH] update web player --- public/assets/js/clappr.js | 49905 +++++++++++++++++++++++-------- public/assets/js/clappr.min.js | 3 +- 2 files changed, 37663 insertions(+), 12245 deletions(-) diff --git a/public/assets/js/clappr.js b/public/assets/js/clappr.js index c77446f..ece30cf 100644 --- a/public/assets/js/clappr.js +++ b/public/assets/js/clappr.js @@ -1,12690 +1,38109 @@ -!function (t, e) { - "object" == typeof exports && "object" == typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? exports.Clappr = e() : t.Clappr = e() -}(this, function () { - return function (t) { - function e(n) { - if (i[n]) return i[n].exports; - var r = i[n] = {i: n, l: !1, exports: {}}; - return t[n].call(r.exports, r, r.exports, e), r.l = !0, r.exports - } +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["Clappr"] = factory(); + else + root["Clappr"] = factory(); +})(typeof self !== 'undefined' ? self : this, function() { + return /******/ (function(modules) { // webpackBootstrap + /******/ // The module cache + /******/ var installedModules = {}; + /******/ + /******/ // The require function + /******/ function __webpack_require__(moduleId) { + /******/ + /******/ // Check if module is in cache + /******/ if(installedModules[moduleId]) { + /******/ return installedModules[moduleId].exports; + /******/ } + /******/ // Create a new module (and put it into the cache) + /******/ var module = installedModules[moduleId] = { + /******/ i: moduleId, + /******/ l: false, + /******/ exports: {} + /******/ }; + /******/ + /******/ // Execute the module function + /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + /******/ + /******/ // Flag the module as loaded + /******/ module.l = true; + /******/ + /******/ // Return the exports of the module + /******/ return module.exports; + /******/ } + /******/ + /******/ + /******/ // expose the modules object (__webpack_modules__) + /******/ __webpack_require__.m = modules; + /******/ + /******/ // expose the module cache + /******/ __webpack_require__.c = installedModules; + /******/ + /******/ // define getter function for harmony exports + /******/ __webpack_require__.d = function(exports, name, getter) { + /******/ if(!__webpack_require__.o(exports, name)) { + /******/ Object.defineProperty(exports, name, { + /******/ configurable: false, + /******/ enumerable: true, + /******/ get: getter + /******/ }); + /******/ } + /******/ }; + /******/ + /******/ // getDefaultExport function for compatibility with non-harmony modules + /******/ __webpack_require__.n = function(module) { + /******/ var getter = module && module.__esModule ? + /******/ function getDefault() { return module['default']; } : + /******/ function getModuleExports() { return module; }; + /******/ __webpack_require__.d(getter, 'a', getter); + /******/ return getter; + /******/ }; + /******/ + /******/ // Object.prototype.hasOwnProperty.call + /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; + /******/ + /******/ // __webpack_public_path__ + /******/ __webpack_require__.p = ""; + /******/ + /******/ // Load entry module and return exports + /******/ return __webpack_require__(__webpack_require__.s = 100); + /******/ }) + /************************************************************************/ + /******/ ([ + /* 0 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + + exports.__esModule = true; + + exports.default = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + }; - var i = {}; - return e.m = t, e.c = i, e.d = function (t, i, n) { - e.o(t, i) || Object.defineProperty(t, i, {configurable: !1, enumerable: !0, get: n}) - }, e.n = function (t) { - var i = t && t.__esModule ? function () { - return t.default - } : function () { - return t - }; - return e.d(i, "a", i), i - }, e.o = function (t, e) { - return Object.prototype.hasOwnProperty.call(t, e) - }, e.p = "", e(e.s = 93) - }([function (t, e, i) { - "use strict"; - e.__esModule = !0, e.default = function (t, e) { - if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function") - } - }, function (t, e, i) { - "use strict"; - e.__esModule = !0; - var n = i(32), r = function (t) { - return t && t.__esModule ? t : {default: t} - }(n); - e.default = function (t, e) { - if (!t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - return !e || "object" !== (void 0 === e ? "undefined" : (0, r.default)(e)) && "function" != typeof e ? t : e - } - }, function (t, e, i) { - "use strict"; + /***/ }), + /* 1 */ + /***/ (function(module, exports, __webpack_require__) { - function n(t) { - return t && t.__esModule ? t : {default: t} - } + "use strict"; - e.__esModule = !0; - var r = i(125), a = n(r), o = i(72), s = n(o), l = i(32), u = n(l); - e.default = function (t, e) { - if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function, not " + (void 0 === e ? "undefined" : (0, u.default)(e))); - t.prototype = (0, s.default)(e && e.prototype, { - constructor: { - value: t, - enumerable: !1, - writable: !0, - configurable: !0 - } - }), e && (a.default ? (0, a.default)(t, e) : t.__proto__ = e) - } - }, function (t, e, i) { - "use strict"; - e.__esModule = !0; - var n = i(71), r = function (t) { - return t && t.__esModule ? t : {default: t} - }(n); - e.default = function () { - function t(t, e) { - for (var i = 0; i < e.length; i++) { - var n = e[i]; - n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), (0, r.default)(t, n.key, n) + + exports.__esModule = true; + + var _typeof2 = __webpack_require__(39); + + 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 function (e, i, n) { - return i && t(e.prototype, i), n && t(e, n), e - } - }() - }, function (t, e, i) { - "use strict"; + return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self; + }; - function n(t) { - return t && t.__esModule ? t : {default: t} - } + /***/ }), + /* 2 */ + /***/ (function(module, exports, __webpack_require__) { - Object.defineProperty(e, "__esModule", {value: !0}); - var r = i(38), a = n(r), o = i(0), s = n(o), l = i(32), u = n(l), c = i(55), d = n(c), h = i(5), - f = Array.prototype.slice, p = /\s+/, g = function (t, e, i, n) { - if (!i) return !0; - if ("object" === (void 0 === i ? "undefined" : (0, u.default)(i))) { - for (var r in i) t[e].apply(t, [r, i[r]].concat(n)); - return !1 - } - if (p.test(i)) { - for (var a = i.split(p), o = 0, s = a.length; o < s; o++) t[e].apply(t, [a[o]].concat(n)); - return !1 - } - return !0 - }, y = function (t, e, i, n) { - function r() { - try { - switch (e.length) { - case 0: - for (; ++o < s;) (a = t[o]).callback.call(a.ctx); - return; - case 1: - for (; ++o < s;) (a = t[o]).callback.call(a.ctx, l); - return; - case 2: - for (; ++o < s;) (a = t[o]).callback.call(a.ctx, l, u); - return; - case 3: - for (; ++o < s;) (a = t[o]).callback.call(a.ctx, l, u, c); - return; - default: - for (; ++o < s;) (a = t[o]).callback.apply(a.ctx, e); - return - } - } catch (t) { - d.default.error.apply(d.default, [i, "error on event", n, "trigger", "-", t]), r() - } - } - - var a = void 0, o = -1, s = t.length, l = e[0], u = e[1], c = e[2]; - r() - }, m = function () { - function t() { - (0, s.default)(this, t) - } - - return t.prototype.on = function (t, e, i) { - return g(this, "on", t, [e, i]) && e ? (this._events || (this._events = {}), (this._events[t] || (this._events[t] = [])).push({ - callback: e, - context: i, - ctx: i || this - }), this) : this - }, t.prototype.once = function (t, e, i) { - var n = this, r = void 0; - if (!g(this, "once", t, [e, i]) || !e) return this; - var a = function () { - return n.off(t, r) - }; - return r = function () { - a(), e.apply(this, arguments) - }, this.on(t, r, i) - }, t.prototype.off = function (t, e, i) { - var n = void 0, r = void 0, o = void 0, s = void 0, l = void 0, u = void 0, c = void 0, d = void 0; - if (!this._events || !g(this, "off", t, [e, i])) return this; - if (!t && !e && !i) return this._events = void 0, this; - for (s = t ? [t] : (0, a.default)(this._events), l = 0, u = s.length; l < u; l++) if (t = s[l], o = this._events[t]) { - if (this._events[t] = n = [], e || i) for (c = 0, d = o.length; c < d; c++) r = o[c], (e && e !== r.callback && e !== r.callback._callback || i && i !== r.context) && n.push(r); - n.length || delete this._events[t] - } - return this - }, t.prototype.trigger = function (t) { - var e = this.name || this.constructor.name; - if (d.default.debug.apply(d.default, [e].concat(Array.prototype.slice.call(arguments))), !this._events) return this; - var i = f.call(arguments, 1); - if (!g(this, "trigger", t, i)) return this; - var n = this._events[t], r = this._events.all; - return n && y(n, i, e, t), r && y(r, arguments, e, t), this - }, t.prototype.stopListening = function (t, e, i) { - var n = this._listeningTo; - if (!n) return this; - var r = !e && !i; - i || "object" !== (void 0 === e ? "undefined" : (0, u.default)(e)) || (i = this), t && ((n = {})[t._listenId] = t); - for (var o in n) t = n[o], t.off(e, i, this), (r || 0 === (0, a.default)(t._events).length) && delete this._listeningTo[o]; - return this - }, t.register = function (e) { - t.Custom || (t.Custom = {}); - var i = "string" == typeof e && e.toUpperCase().trim(); - i && !t.Custom[i] ? t.Custom[i] = i.toLowerCase().split("_").map(function (t, e) { - return 0 === e ? t : t = t[0].toUpperCase() + t.slice(1) - }).join("") : d.default.error("Events", "Error when register event: " + e) - }, t.listAvailableCustomEvents = function () { - return t.Custom || (t.Custom = {}), (0, a.default)(t.Custom).filter(function (e) { - return "string" == typeof t.Custom[e] - }) - }, t - }(); - e.default = m; - var v = {listenTo: "on", listenToOnce: "once"}; - (0, a.default)(v).forEach(function (t) { - m.prototype[t] = function (e, i, n) { - return (this._listeningTo || (this._listeningTo = {}))[e._listenId || (e._listenId = (0, h.uniqueId)("l"))] = e, n || "object" !== (void 0 === i ? "undefined" : (0, u.default)(i)) || (n = this), e[v[t]](i, n, this), this - } - }), m.PLAYER_READY = "ready", m.PLAYER_RESIZE = "resize", m.PLAYER_FULLSCREEN = "fullscreen", m.PLAYER_PLAY = "play", m.PLAYER_PAUSE = "pause", m.PLAYER_STOP = "stop", m.PLAYER_ENDED = "ended", m.PLAYER_SEEK = "seek", m.PLAYER_ERROR = "error", m.PLAYER_TIMEUPDATE = "timeupdate", m.PLAYER_VOLUMEUPDATE = "volumeupdate", m.PLAYER_SUBTITLE_AVAILABLE = "subtitleavailable", m.PLAYBACK_PROGRESS = "playback:progress", m.PLAYBACK_TIMEUPDATE = "playback:timeupdate", m.PLAYBACK_READY = "playback:ready", m.PLAYBACK_BUFFERING = "playback:buffering", m.PLAYBACK_BUFFERFULL = "playback:bufferfull", m.PLAYBACK_SETTINGSUPDATE = "playback:settingsupdate", m.PLAYBACK_LOADEDMETADATA = "playback:loadedmetadata", m.PLAYBACK_HIGHDEFINITIONUPDATE = "playback:highdefinitionupdate", m.PLAYBACK_BITRATE = "playback:bitrate", m.PLAYBACK_LEVELS_AVAILABLE = "playback:levels:available", m.PLAYBACK_LEVEL_SWITCH_START = "playback:levels:switch:start", m.PLAYBACK_LEVEL_SWITCH_END = "playback:levels:switch:end", m.PLAYBACK_PLAYBACKSTATE = "playback:playbackstate", m.PLAYBACK_DVR = "playback:dvr", m.PLAYBACK_MEDIACONTROL_DISABLE = "playback:mediacontrol:disable", m.PLAYBACK_MEDIACONTROL_ENABLE = "playback:mediacontrol:enable", m.PLAYBACK_ENDED = "playback:ended", m.PLAYBACK_PLAY_INTENT = "playback:play:intent", m.PLAYBACK_PLAY = "playback:play", m.PLAYBACK_PAUSE = "playback:pause", m.PLAYBACK_SEEK = "playback:seek", m.PLAYBACK_SEEKED = "playback:seeked", m.PLAYBACK_STOP = "playback:stop", m.PLAYBACK_ERROR = "playback:error", m.PLAYBACK_STATS_ADD = "playback:stats:add", m.PLAYBACK_FRAGMENT_LOADED = "playback:fragment:loaded", m.PLAYBACK_LEVEL_SWITCH = "playback:level:switch", m.PLAYBACK_SUBTITLE_AVAILABLE = "playback:subtitle:available", m.PLAYBACK_SUBTITLE_CHANGED = "playback:subtitle:changed", m.CORE_CONTAINERS_CREATED = "core:containers:created", m.CORE_OPTIONS_CHANGE = "core:options:change", m.CORE_READY = "core:ready", m.CORE_FULLSCREEN = "core:fullscreen", m.CORE_SCREEN_ORIENTATION_CHANGED = "core:screen:orientation:changed", m.CONTAINER_PLAYBACKSTATE = "container:playbackstate", m.CONTAINER_PLAYBACKDVRSTATECHANGED = "container:dvr", m.CONTAINER_BITRATE = "container:bitrate", m.CONTAINER_STATS_REPORT = "container:stats:report", m.CONTAINER_DESTROYED = "container:destroyed", m.CONTAINER_READY = "container:ready", m.CONTAINER_ERROR = "container:error", m.CONTAINER_LOADEDMETADATA = "container:loadedmetadata", m.CONTAINER_SUBTITLE_AVAILABLE = "container:subtitle:available", m.CONTAINER_SUBTITLE_CHANGED = "container:subtitle:changed", m.CONTAINER_TIMEUPDATE = "container:timeupdate", m.CONTAINER_PROGRESS = "container:progress", m.CONTAINER_PLAY = "container:play", m.CONTAINER_STOP = "container:stop", m.CONTAINER_PAUSE = "container:pause", m.CONTAINER_ENDED = "container:ended", m.CONTAINER_CLICK = "container:click", m.CONTAINER_DBLCLICK = "container:dblclick", m.CONTAINER_CONTEXTMENU = "container:contextmenu", m.CONTAINER_MOUSE_ENTER = "container:mouseenter", m.CONTAINER_MOUSE_LEAVE = "container:mouseleave", m.CONTAINER_SEEK = "container:seek", m.CONTAINER_SEEKED = "container:seeked", m.CONTAINER_VOLUME = "container:volume", m.CONTAINER_FULLSCREEN = "container:fullscreen", m.CONTAINER_STATE_BUFFERING = "container:state:buffering", m.CONTAINER_STATE_BUFFERFULL = "container:state:bufferfull", m.CONTAINER_SETTINGSUPDATE = "container:settingsupdate", m.CONTAINER_HIGHDEFINITIONUPDATE = "container:highdefinitionupdate", m.CONTAINER_MEDIACONTROL_SHOW = "container:mediacontrol:show", m.CONTAINER_MEDIACONTROL_HIDE = "container:mediacontrol:hide", m.CONTAINER_MEDIACONTROL_DISABLE = "container:mediacontrol:disable", m.CONTAINER_MEDIACONTROL_ENABLE = "container:mediacontrol:enable", m.CONTAINER_STATS_ADD = "container:stats:add", m.CONTAINER_OPTIONS_CHANGE = "container:options:change", m.MEDIACONTROL_RENDERED = "mediacontrol:rendered", m.MEDIACONTROL_FULLSCREEN = "mediacontrol:fullscreen", m.MEDIACONTROL_SHOW = "mediacontrol:show", m.MEDIACONTROL_HIDE = "mediacontrol:hide", m.MEDIACONTROL_MOUSEMOVE_SEEKBAR = "mediacontrol:mousemove:seekbar", m.MEDIACONTROL_MOUSELEAVE_SEEKBAR = "mediacontrol:mouseleave:seekbar", m.MEDIACONTROL_PLAYING = "mediacontrol:playing", m.MEDIACONTROL_NOTPLAYING = "mediacontrol:notplaying", m.MEDIACONTROL_CONTAINERCHANGED = "mediacontrol:containerchanged", t.exports = e.default - }, function (t, e, i) { - "use strict"; + "use strict"; - function n(t) { - return t && t.__esModule ? t : {default: t} - } - function r(t, e) { - if (e) for (var i in e) { - var n = (0, L.default)(e, i); - n ? (0, A.default)(t, i, n) : t[i] = e[i] - } - return t - } + exports.__esModule = true; - function a(t, e) { - var i = function (t) { - function i() { - (0, m.default)(this, i); - for (var n = arguments.length, r = Array(n), a = 0; a < n; a++) r[a] = arguments[a]; - var o = (0, b.default)(this, t.call.apply(t, [this].concat(r))); - return e.initialize && e.initialize.apply(o, r), o - } + var _setPrototypeOf = __webpack_require__(134); - return (0, E.default)(i, t), i - }(t); - return r(i.prototype, e), i - } + var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf); - function o(t, e) { - if (!isFinite(t)) return "--:--"; - t *= 1e3, t = parseInt(t / 1e3); - var i = t % 60; - t = parseInt(t / 60); - var n = t % 60; - t = parseInt(t / 60); - var r = t % 24, a = parseInt(t / 24), o = ""; - return a && a > 0 && (o += a + ":", r < 1 && (o += "00:")), (r && r > 0 || e) && (o += ("0" + r).slice(-2) + ":"), o += ("0" + n).slice(-2) + ":", o += ("0" + i).slice(-2), o.trim() - } + var _create = __webpack_require__(76); + + var _create2 = _interopRequireDefault(_create); + + var _typeof2 = __webpack_require__(39); - function s() { - var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "t", e = 0, - i = O.params[t] || O.hashParams[t] || "", n = i.match(/[0-9]+[hms]+/g) || []; - return n.length > 0 ? function () { - var t = {h: 3600, m: 60, s: 1}; - n.forEach(function (i) { - if (i) { - var n = i[i.length - 1], r = parseInt(i.slice(0, i.length - 1), 10); - e += r * t[n] + 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 } - }) - }() : i && (e = parseInt(i, 10)), e - } + }); + if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass; + }; - function l(t) { - return P[t] || (P[t] = 0), t + ++P[t] - } + /***/ }), + /* 3 */ + /***/ (function(module, exports, __webpack_require__) { - function u(t) { - return t - parseFloat(t) + 1 >= 0 - } + "use strict"; - function c() { - var t = document.getElementsByTagName("script"); - return t.length ? t[t.length - 1].src : "" - } - function d() { - return window.navigator && window.navigator.language - } + exports.__esModule = true; - function h() { - return window.performance && window.performance.now ? performance.now() : Date.now() - } + var _defineProperty = __webpack_require__(75); - function f(t, e) { - var i = t.indexOf(e); - i >= 0 && t.splice(i, 1) - } + var _defineProperty2 = _interopRequireDefault(_defineProperty); - Object.defineProperty(e, "__esModule", {value: !0}), e.DomRecycler = e.cancelAnimationFrame = e.requestAnimationFrame = e.QueryString = e.Config = e.Fullscreen = void 0; - var p = i(3), g = n(p), y = i(0), m = n(y), v = i(1), b = n(v), _ = i(2), E = n(_), T = i(71), A = n(T), - S = i(131), L = n(S); - e.assign = r, e.extend = a, e.formatTime = o, e.seekStringToSeconds = s, e.uniqueId = l, e.isNumber = u, e.currentScriptUrl = c, e.getBrowserLanguage = d, e.now = h, e.removeArrayItem = f, i(134); - var R = i(13), k = n(R), C = i(6), w = n(C), I = e.Fullscreen = { - isFullscreen: function () { - return !!(document.webkitFullscreenElement || document.webkitIsFullScreen || document.mozFullScreen || document.msFullscreenElement) - }, requestFullscreen: function (t) { - t.requestFullscreen ? t.requestFullscreen() : t.webkitRequestFullscreen ? t.webkitRequestFullscreen() : t.mozRequestFullScreen ? t.mozRequestFullScreen() : t.msRequestFullscreen ? t.msRequestFullscreen() : t.querySelector && t.querySelector("video") && t.querySelector("video").webkitEnterFullScreen ? t.querySelector("video").webkitEnterFullScreen() : t.webkitEnterFullScreen && t.webkitEnterFullScreen() - }, cancelFullscreen: function () { - var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : document; - t.exitFullscreen ? t.exitFullscreen() : t.webkitCancelFullScreen ? t.webkitCancelFullScreen() : t.webkitExitFullscreen ? t.webkitExitFullscreen() : t.mozCancelFullScreen ? t.mozCancelFullScreen() : t.msExitFullscreen && t.msExitFullscreen() - }, fullscreenEnabled: function () { - return !!(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled) - } - }, D = e.Config = function () { - function t() { - (0, m.default)(this, t) - } - - return t._defaultConfig = function () { - return {volume: {value: 100, parse: parseInt}} - }, t._defaultValueFor = function (t) { - try { - return this._defaultConfig()[t].parse(this._defaultConfig()[t].value) - } catch (t) { - return - } - }, t._createKeyspace = function (t) { - return "clappr." + document.domain + "." + t - }, t.restore = function (t) { - return k.default.hasLocalstorage && localStorage[this._createKeyspace(t)] ? this._defaultConfig()[t].parse(localStorage[this._createKeyspace(t)]) : this._defaultValueFor(t) - }, t.persist = function (t, e) { - if (k.default.hasLocalstorage) try { - return localStorage[this._createKeyspace(t)] = e, !0 - } catch (t) { - return !1 - } - }, t - }(), O = e.QueryString = function () { - function t() { - (0, m.default)(this, t) - } - - return t.parse = function (t) { - for (var e = void 0, i = /\+/g, n = /([^&=]+)=?([^&]*)/g, r = function (t) { - return decodeURIComponent(t.replace(i, " ")) - }, a = {}; e = n.exec(t);) a[r(e[1]).toLowerCase()] = r(e[2]); - return a - }, (0, g.default)(t, null, [{ - key: "params", get: function () { - var t = window.location.search.substring(1); - return t !== this.query && (this._urlParams = this.parse(t), this.query = t), this._urlParams + 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); } - }, { - key: "hashParams", get: function () { - var t = window.location.hash.substring(1); - return t !== this.hash && (this._hashParams = this.parse(t), this.hash = t), this._hashParams - } - }]), t - }(), P = {}, - x = e.requestAnimationFrame = (window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || function (t) { - window.setTimeout(t, 1e3 / 60) - }).bind(window), - N = e.cancelAnimationFrame = (window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.clearTimeout).bind(window), - M = [], F = e.DomRecycler = function () { - function t() { - (0, m.default)(this, t) - } - - return t.configure = function (t) { - this.options = w.default.extend(this.options, t) - }, t.create = function (t) { - return this.options.recycleVideo && "video" === t && M.length > 0 ? M.shift() : (0, w.default)("<" + t + ">") - }, t.garbage = function (t) { - this.options.recycleVideo && "VIDEO" === t[0].tagName.toUpperCase() && (t.children().remove(), M.push(t)) - }, t + } + + return function (Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; }(); - F.options = {recycleVideo: !1}, e.default = { - Config: D, - Fullscreen: I, - QueryString: O, - DomRecycler: F, - extend: a, - formatTime: o, - seekStringToSeconds: s, - uniqueId: l, - currentScriptUrl: c, - isNumber: u, - requestAnimationFrame: x, - cancelAnimationFrame: N, - getBrowserLanguage: d, - now: h, - removeArrayItem: f - } - }, function (t, e) { - var i = function () { - function t(t) { - return null == t ? String(t) : W[q.call(t)] || "object" - } - function e(e) { - return "function" == t(e) - } + /***/ }), + /* 4 */ + /***/ (function(module, exports, __webpack_require__) { - function i(t) { - return null != t && t == t.window - } + "use strict"; - function n(t) { - return null != t && t.nodeType == t.DOCUMENT_NODE - } - function r(e) { - return "object" == t(e) - } + Object.defineProperty(exports, "__esModule", { + value: true + }); - function a(t) { - return r(t) && !i(t) && Object.getPrototypeOf(t) == Object.prototype - } + var _keys = __webpack_require__(53); - function o(t) { - var e = !!t && "length" in t && t.length, n = S.type(t); - return "function" != n && !i(t) && ("array" == n || 0 === e || "number" == typeof e && e > 0 && e - 1 in t) - } + var _keys2 = _interopRequireDefault(_keys); - function s(t) { - return I.call(t, function (t) { - return null != t - }) - } + var _classCallCheck2 = __webpack_require__(0); - function l(t) { - return t.length > 0 ? S.fn.concat.apply([], t) : t - } + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - function u(t) { - return t.replace(/::/g, "/").replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2").replace(/([a-z\d])([A-Z])/g, "$1_$2").replace(/_/g, "-").toLowerCase() - } + var _typeof2 = __webpack_require__(39); - function c(t) { - return t in x ? x[t] : x[t] = new RegExp("(^|\\s)" + t + "(\\s|$)") - } + var _typeof3 = _interopRequireDefault(_typeof2); - function d(t, e) { - return "number" != typeof e || N[u(t)] ? e : e + "px" - } + var _log = __webpack_require__(29); - function h(t) { - var e, i; - return P[t] || (e = O.createElement(t), O.body.appendChild(e), i = getComputedStyle(e, "").getPropertyValue("display"), e.parentNode.removeChild(e), "none" == i && (i = "block"), P[t] = i), P[t] - } + var _log2 = _interopRequireDefault(_log); - function f(t) { - return "children" in t ? D.call(t.children) : S.map(t.childNodes, function (t) { - if (1 == t.nodeType) return t - }) - } + var _utils = __webpack_require__(5); - function p(t, e) { - var i, n = t ? t.length : 0; - for (i = 0; i < n; i++) this[i] = t[i]; - this.length = n, this.selector = e || "" - } + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - function g(t, e, i) { - for (A in e) i && (a(e[A]) || Q(e[A])) ? (a(e[A]) && !a(t[A]) && (t[A] = {}), Q(e[A]) && !Q(t[A]) && (t[A] = []), g(t[A], e[A], i)) : e[A] !== T && (t[A] = e[A]) - } +// 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. - function y(t, e) { - return null == e ? S(t) : S(t).filter(e) - } + var slice = Array.prototype.slice; - function m(t, i, n, r) { - return e(i) ? i.call(t, n, r) : i - } + var eventSplitter = /\s+/; - function v(t, e, i) { - null == i ? t.removeAttribute(e) : t.setAttribute(e, i) - } + var eventsApi = function eventsApi(obj, action, name, rest) { + if (!name) return true; - function b(t, e) { - var i = t.className || "", n = i && i.baseVal !== T; - if (e === T) return n ? i.baseVal : i; - n ? i.baseVal = e : t.className = e - } + // Handle event maps. + if ((typeof name === 'undefined' ? 'undefined' : (0, _typeof3.default)(name)) === 'object') { + for (var key in name) { + obj[action].apply(obj, [key, name[key]].concat(rest)); + }return false; + } - function _(t) { - try { - return t ? "true" == t || "false" != t && ("null" == t ? null : +t + "" == t ? +t : /^[\[\{]/.test(t) ? S.parseJSON(t) : t) : t - } catch (e) { - return t + // Handle space separated event names. + if (eventSplitter.test(name)) { + var names = name.split(eventSplitter); + for (var i = 0, l = names.length; i < l; i++) { + obj[action].apply(obj, [names[i]].concat(rest)); + }return false; } - } - function E(t, e) { - e(t); - for (var i = 0, n = t.childNodes.length; i < n; i++) E(t.childNodes[i], e) - } + return true; + }; - var T, A, S, L, R, k, C = [], w = C.concat, I = C.filter, D = C.slice, O = window.document, P = {}, x = {}, - N = { - "column-count": 1, - columns: 1, - "font-weight": 1, - "line-height": 1, - opacity: 1, - "z-index": 1, - zoom: 1 - }, M = /^\s*<(\w+|!)[^>]*>/, F = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, - B = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, U = /^(?:body|html)$/i, - G = /([A-Z])/g, K = ["val", "css", "html", "text", "data", "width", "height", "offset"], - V = ["after", "prepend", "before", "append"], j = O.createElement("table"), Y = O.createElement("tr"), - H = { - tr: O.createElement("tbody"), - tbody: j, - thead: j, - tfoot: j, - td: Y, - th: Y, - "*": O.createElement("div") - }, $ = /complete|loaded|interactive/, z = /^[\w-]*$/, W = {}, q = W.toString, X = {}, - Z = O.createElement("div"), J = { - tabindex: "tabIndex", - readonly: "readOnly", - for: "htmlFor", - class: "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, Q = Array.isArray || function (t) { - return t instanceof Array - }; - return X.matches = function (t, e) { - if (!e || !t || 1 !== t.nodeType) return !1; - var i = t.matches || t.webkitMatchesSelector || t.mozMatchesSelector || t.oMatchesSelector || t.matchesSelector; - if (i) return i.call(t, e); - var n, r = t.parentNode, a = !r; - return a && (r = Z).appendChild(t), n = ~X.qsa(r, e).indexOf(t), a && Z.removeChild(t), n - }, R = function (t) { - return t.replace(/-+(.)?/g, function (t, e) { - return e ? e.toUpperCase() : "" - }) - }, k = function (t) { - return I.call(t, function (e, i) { - return t.indexOf(e) == i - }) - }, X.fragment = function (t, e, i) { - var n, r, o; - return F.test(t) && (n = S(O.createElement(RegExp.$1))), n || (t.replace && (t = t.replace(B, "<$1>")), e === T && (e = M.test(t) && RegExp.$1), e in H || (e = "*"), o = H[e], o.innerHTML = "" + t, n = S.each(D.call(o.childNodes), function () { - o.removeChild(this) - })), a(i) && (r = S(n), S.each(i, function (t, e) { - K.indexOf(t) > -1 ? r[t](e) : r.attr(t, e) - })), n - }, X.Z = function (t, e) { - return new p(t, e) - }, X.isZ = function (t) { - return t instanceof X.Z - }, X.init = function (t, i) { - var n; - if (!t) return X.Z(); - if ("string" == typeof t) if (t = t.trim(), "<" == t[0] && M.test(t)) n = X.fragment(t, RegExp.$1, i), t = null; else { - if (i !== T) return S(i).find(t); - n = X.qsa(O, t) - } else { - if (e(t)) return S(O).ready(t); - if (X.isZ(t)) return t; - if (Q(t)) n = s(t); else if (r(t)) n = [t], t = null; else if (M.test(t)) n = X.fragment(t.trim(), RegExp.$1, i), t = null; else { - if (i !== T) return S(i).find(t); - n = X.qsa(O, t) - } - } - return X.Z(n, t) - }, S = function (t, e) { - return X.init(t, e) - }, S.extend = function (t) { - var e, i = D.call(arguments, 1); - return "boolean" == typeof t && (e = t, t = i.shift()), i.forEach(function (i) { - g(t, i, e) - }), t - }, X.qsa = function (t, e) { - var i, n = "#" == e[0], r = !n && "." == e[0], a = n || r ? e.slice(1) : e, o = z.test(a); - return t.getElementById && o && n ? (i = t.getElementById(a)) ? [i] : [] : 1 !== t.nodeType && 9 !== t.nodeType && 11 !== t.nodeType ? [] : D.call(o && !n && t.getElementsByClassName ? r ? t.getElementsByClassName(a) : t.getElementsByTagName(e) : t.querySelectorAll(e)) - }, S.contains = O.documentElement.contains ? function (t, e) { - return t !== e && t.contains(e) - } : function (t, e) { - for (; e && (e = e.parentNode);) if (e === t) return !0; - return !1 - }, S.type = t, S.isFunction = e, S.isWindow = i, S.isArray = Q, S.isPlainObject = a, S.isEmptyObject = function (t) { - var e; - for (e in t) return !1; - return !0 - }, S.isNumeric = function (t) { - var e = Number(t), i = typeof t; - return null != t && "boolean" != i && ("string" != i || t.length) && !isNaN(e) && isFinite(e) || !1 - }, S.inArray = function (t, e, i) { - return C.indexOf.call(e, t, i) - }, S.camelCase = R, S.trim = function (t) { - return null == t ? "" : String.prototype.trim.call(t) - }, S.uuid = 0, S.support = {}, S.expr = {}, S.noop = function () { - }, S.map = function (t, e) { - var i, n, r, a = []; - if (o(t)) for (n = 0; n < t.length; n++) null != (i = e(t[n], n)) && a.push(i); else for (r in t) null != (i = e(t[r], r)) && a.push(i); - return l(a) - }, S.each = function (t, e) { - var i, n; - if (o(t)) { - for (i = 0; i < t.length; i++) if (!1 === e.call(t[i], i, t[i])) return t - } else for (n in t) if (!1 === e.call(t[n], n, t[n])) return t; - return t - }, S.grep = function (t, e) { - return I.call(t, e) - }, window.JSON && (S.parseJSON = JSON.parse), S.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function (t, e) { - W["[object " + e + "]"] = e.toLowerCase() - }), S.fn = { - constructor: X.Z, - length: 0, - forEach: C.forEach, - reduce: C.reduce, - push: C.push, - sort: C.sort, - splice: C.splice, - indexOf: C.indexOf, - concat: function () { - var t, e, i = []; - for (t = 0; t < arguments.length; t++) e = arguments[t], i[t] = X.isZ(e) ? e.toArray() : e; - return w.apply(X.isZ(this) ? this.toArray() : this, i) - }, - map: function (t) { - return S(S.map(this, function (e, i) { - return t.call(e, i, e) - })) - }, - slice: function () { - return S(D.apply(this, arguments)) - }, - ready: function (t) { - return $.test(O.readyState) && O.body ? t(S) : O.addEventListener("DOMContentLoaded", function () { - t(S) - }, !1), this - }, - get: function (t) { - return t === T ? D.call(this) : this[t >= 0 ? t : t + this.length] - }, - toArray: function () { - return this.get() - }, - size: function () { - return this.length - }, - remove: function () { - return this.each(function () { - null != this.parentNode && this.parentNode.removeChild(this) - }) - }, - each: function (t) { - return C.every.call(this, function (e, i) { - return !1 !== t.call(e, i, e) - }), this - }, - filter: function (t) { - return e(t) ? this.not(this.not(t)) : S(I.call(this, function (e) { - return X.matches(e, t) - })) - }, - add: function (t, e) { - return S(k(this.concat(S(t, e)))) - }, - is: function (t) { - return this.length > 0 && X.matches(this[0], t) - }, - not: function (t) { - var i = []; - if (e(t) && t.call !== T) this.each(function (e) { - t.call(this, e) || i.push(this) - }); else { - var n = "string" == typeof t ? this.filter(t) : o(t) && e(t.item) ? D.call(t) : S(t); - this.forEach(function (t) { - n.indexOf(t) < 0 && i.push(t) - }) - } - return S(i) - }, - has: function (t) { - return this.filter(function () { - return r(t) ? S.contains(this, t) : S(this).find(t).size() - }) - }, - eq: function (t) { - return -1 === t ? this.slice(t) : this.slice(t, +t + 1) - }, - first: function () { - var t = this[0]; - return t && !r(t) ? t : S(t) - }, - last: function () { - var t = this[this.length - 1]; - return t && !r(t) ? t : S(t) - }, - find: function (t) { - var e = this; - return t ? "object" == typeof t ? S(t).filter(function () { - var t = this; - return C.some.call(e, function (e) { - return S.contains(e, t) - }) - }) : 1 == this.length ? S(X.qsa(this[0], t)) : this.map(function () { - return X.qsa(this, t) - }) : S() - }, - closest: function (t, e) { - var i = [], r = "object" == typeof t && S(t); - return this.each(function (a, o) { - for (; o && !(r ? r.indexOf(o) >= 0 : X.matches(o, t));) o = o !== e && !n(o) && o.parentNode; - o && i.indexOf(o) < 0 && i.push(o) - }), S(i) - }, - parents: function (t) { - for (var e = [], i = this; i.length > 0;) i = S.map(i, function (t) { - if ((t = t.parentNode) && !n(t) && e.indexOf(t) < 0) return e.push(t), t - }); - return y(e, t) - }, - parent: function (t) { - return y(k(this.pluck("parentNode")), t) - }, - children: function (t) { - return y(this.map(function () { - return f(this) - }), t) - }, - contents: function () { - return this.map(function () { - return this.contentDocument || D.call(this.childNodes) - }) - }, - siblings: function (t) { - return y(this.map(function (t, e) { - return I.call(f(e.parentNode), function (t) { - return t !== e - }) - }), t) - }, - empty: function () { - return this.each(function () { - this.innerHTML = "" - }) - }, - pluck: function (t) { - return S.map(this, function (e) { - return e[t] - }) - }, - show: function () { - return this.each(function () { - "none" == this.style.display && (this.style.display = ""), "none" == getComputedStyle(this, "").getPropertyValue("display") && (this.style.display = h(this.nodeName)) - }) - }, - replaceWith: function (t) { - return this.before(t).remove() - }, - wrap: function (t) { - var i = e(t); - if (this[0] && !i) var n = S(t).get(0), r = n.parentNode || this.length > 1; - return this.each(function (e) { - S(this).wrapAll(i ? t.call(this, e) : r ? n.cloneNode(!0) : n) - }) - }, - wrapAll: function (t) { - if (this[0]) { - S(this[0]).before(t = S(t)); - for (var e; (e = t.children()).length;) t = e.first(); - S(t).append(this) - } - return this - }, - wrapInner: function (t) { - var i = e(t); - return this.each(function (e) { - var n = S(this), r = n.contents(), a = i ? t.call(this, e) : t; - r.length ? r.wrapAll(a) : n.append(a) - }) - }, - unwrap: function () { - return this.parent().each(function () { - S(this).replaceWith(S(this).children()) - }), this - }, - clone: function () { - return this.map(function () { - return this.cloneNode(!0) - }) - }, - hide: function () { - return this.css("display", "none") - }, - toggle: function (t) { - return this.each(function () { - var e = S(this); - (t === T ? "none" == e.css("display") : t) ? e.show() : e.hide() - }) - }, - prev: function (t) { - return S(this.pluck("previousElementSibling")).filter(t || "*") - }, - next: function (t) { - return S(this.pluck("nextElementSibling")).filter(t || "*") - }, - html: function (t) { - return 0 in arguments ? this.each(function (e) { - var i = this.innerHTML; - S(this).empty().append(m(this, t, e, i)) - }) : 0 in this ? this[0].innerHTML : null - }, - text: function (t) { - return 0 in arguments ? this.each(function (e) { - var i = m(this, t, e, this.textContent); - this.textContent = null == i ? "" : "" + i - }) : 0 in this ? this.pluck("textContent").join("") : null - }, - attr: function (t, e) { - var i; - return "string" != typeof t || 1 in arguments ? this.each(function (i) { - if (1 === this.nodeType) if (r(t)) for (A in t) v(this, A, t[A]); else v(this, t, m(this, e, i, this.getAttribute(t))) - }) : 0 in this && 1 == this[0].nodeType && null != (i = this[0].getAttribute(t)) ? i : T - }, - removeAttr: function (t) { - return this.each(function () { - 1 === this.nodeType && t.split(" ").forEach(function (t) { - v(this, t) - }, this) - }) - }, - prop: function (t, e) { - return t = J[t] || t, 1 in arguments ? this.each(function (i) { - this[t] = m(this, e, i, this[t]) - }) : this[0] && this[0][t] - }, - removeProp: function (t) { - return t = J[t] || t, this.each(function () { - delete this[t] - }) - }, - data: function (t, e) { - var i = "data-" + t.replace(G, "-$1").toLowerCase(), - n = 1 in arguments ? this.attr(i, e) : this.attr(i); - return null !== n ? _(n) : T - }, - val: function (t) { - return 0 in arguments ? (null == t && (t = ""), this.each(function (e) { - this.value = m(this, t, e, this.value) - })) : this[0] && (this[0].multiple ? S(this[0]).find("option").filter(function () { - return this.selected - }).pluck("value") : this[0].value) - }, - offset: function (t) { - if (t) return this.each(function (e) { - var i = S(this), n = m(this, t, e, i.offset()), r = i.offsetParent().offset(), - a = {top: n.top - r.top, left: n.left - r.left}; - "static" == i.css("position") && (a.position = "relative"), i.css(a) - }); - if (!this.length) return null; - if (O.documentElement !== this[0] && !S.contains(O.documentElement, this[0])) return { - top: 0, - left: 0 - }; - var e = this[0].getBoundingClientRect(); - return { - left: e.left + window.pageXOffset, - top: e.top + window.pageYOffset, - width: Math.round(e.width), - height: Math.round(e.height) - } - }, - css: function (e, i) { - if (arguments.length < 2) { - var n = this[0]; - if ("string" == typeof e) { - if (!n) return; - return n.style[R(e)] || getComputedStyle(n, "").getPropertyValue(e) - } - if (Q(e)) { - if (!n) return; - var r = {}, a = getComputedStyle(n, ""); - return S.each(e, function (t, e) { - r[e] = n.style[R(e)] || a.getPropertyValue(e) - }), r - } - } - var o = ""; - if ("string" == t(e)) i || 0 === i ? o = u(e) + ":" + d(e, i) : this.each(function () { - this.style.removeProperty(u(e)) - }); else for (A in e) e[A] || 0 === e[A] ? o += u(A) + ":" + d(A, e[A]) + ";" : this.each(function () { - this.style.removeProperty(u(A)) - }); - return this.each(function () { - this.style.cssText += ";" + o - }) - }, - index: function (t) { - return t ? this.indexOf(S(t)[0]) : this.parent().children().indexOf(this[0]) - }, - hasClass: function (t) { - return !!t && C.some.call(this, function (t) { - return this.test(b(t)) - }, c(t)) - }, - addClass: function (t) { - return t ? this.each(function (e) { - if ("className" in this) { - L = []; - var i = b(this); - m(this, t, e, i).split(/\s+/g).forEach(function (t) { - S(this).hasClass(t) || L.push(t) - }, this), L.length && b(this, i + (i ? " " : "") + L.join(" ")) - } - }) : this - }, - removeClass: function (t) { - return this.each(function (e) { - if ("className" in this) { - if (t === T) return b(this, ""); - L = b(this), m(this, t, e, L).split(/\s+/g).forEach(function (t) { - L = L.replace(c(t), " ") - }), b(this, L.trim()) - } - }) - }, - toggleClass: function (t, e) { - return t ? this.each(function (i) { - var n = S(this); - m(this, t, i, b(this)).split(/\s+/g).forEach(function (t) { - (e === T ? !n.hasClass(t) : e) ? n.addClass(t) : n.removeClass(t) - }) - }) : this - }, - scrollTop: function (t) { - if (this.length) { - var e = "scrollTop" in this[0]; - return t === T ? e ? this[0].scrollTop : this[0].pageYOffset : this.each(e ? function () { - this.scrollTop = t - } : function () { - this.scrollTo(this.scrollX, t) - }) - } - }, - scrollLeft: function (t) { - if (this.length) { - var e = "scrollLeft" in this[0]; - return t === T ? e ? this[0].scrollLeft : this[0].pageXOffset : this.each(e ? function () { - this.scrollLeft = t - } : function () { - this.scrollTo(t, this.scrollY) - }) - } - }, - position: function () { - if (this.length) { - var t = this[0], e = this.offsetParent(), i = this.offset(), - n = U.test(e[0].nodeName) ? {top: 0, left: 0} : e.offset(); - return i.top -= parseFloat(S(t).css("margin-top")) || 0, i.left -= parseFloat(S(t).css("margin-left")) || 0, n.top += parseFloat(S(e[0]).css("border-top-width")) || 0, n.left += parseFloat(S(e[0]).css("border-left-width")) || 0, { - top: i.top - n.top, - left: i.left - n.left + var triggerEvents = function triggerEvents(events, args, klass, name) { + var ev = void 0, + i = -1; + var l = events.length, + a1 = args[0], + a2 = args[1], + a3 = args[2]; + run(); + + function run() { + try { + switch (args.length) { + /* eslint-disable curly */ + case 0: + while (++i < l) { + (ev = events[i]).callback.call(ev.ctx); + }return; + case 1: + while (++i < l) { + (ev = events[i]).callback.call(ev.ctx, a1); + }return; + case 2: + while (++i < l) { + (ev = events[i]).callback.call(ev.ctx, a1, a2); + }return; + case 3: + while (++i < l) { + (ev = events[i]).callback.call(ev.ctx, a1, a2, a3); + }return; + default: + while (++i < l) { + (ev = events[i]).callback.apply(ev.ctx, args); + }return; } + } catch (exception) { + _log2.default.error.apply(_log2.default, [klass, 'error on event', name, 'trigger', '-', exception]); + run(); } - }, - offsetParent: function () { - return this.map(function () { - for (var t = this.offsetParent || O.body; t && !U.test(t.nodeName) && "static" == S(t).css("position");) t = t.offsetParent; - return t - }) } - }, S.fn.detach = S.fn.remove, ["width", "height"].forEach(function (t) { - var e = t.replace(/./, function (t) { - return t[0].toUpperCase() - }); - S.fn[t] = function (r) { - var a, o = this[0]; - return r === T ? i(o) ? o["inner" + e] : n(o) ? o.documentElement["scroll" + e] : (a = this.offset()) && a[t] : this.each(function (e) { - o = S(this), o.css(t, m(this, r, e, o[t]())) - }) + }; + + /** + * @class Events + * @constructor + * @module base + */ + + var Events = function () { + function Events() { + (0, _classCallCheck3.default)(this, Events); } - }), V.forEach(function (e, i) { - var n = i % 2; - S.fn[e] = function () { - var e, r, a = S.map(arguments, function (i) { - var n = []; - return e = t(i), "array" == e ? (i.forEach(function (t) { - return t.nodeType !== T ? n.push(t) : S.zepto.isZ(t) ? n = n.concat(t.get()) : void(n = n.concat(X.fragment(t))) - }), n) : "object" == e || null == i ? i : X.fragment(i) - }), o = this.length > 1; - return a.length < 1 ? this : this.each(function (t, e) { - r = n ? e : e.parentNode, e = 0 == i ? e.nextSibling : 1 == i ? e.firstChild : 2 == i ? e : null; - var s = S.contains(O.documentElement, r); - a.forEach(function (t) { - if (o) t = t.cloneNode(!0); else if (!r) return S(t).remove(); - r.insertBefore(t, e), s && E(t, function (t) { - if (!(null == t.nodeName || "SCRIPT" !== t.nodeName.toUpperCase() || t.type && "text/javascript" !== t.type || t.src)) { - var e = t.ownerDocument ? t.ownerDocument.defaultView : window; - e.eval.call(e, t.innerHTML) - } - }) - }) - }) - }, S.fn[n ? e + "To" : "insert" + (i ? "Before" : "After")] = function (t) { - return S(t)[e](this), this - } - }), X.Z.prototype = p.prototype = S.fn, X.uniq = k, X.deserializeValue = _, S.zepto = X, S - }(); - window.Zepto = i, void 0 === window.$ && (window.$ = i), function (t) { - function e(e, i, n) { - var r = t.Event(i); - return t(e).trigger(r, n), !r.isDefaultPrevented() - } - function i(t, i, n, r) { - if (t.global) return e(i || b, n, r) - } + /** + * listen to an event indefinitely, if you want to stop you need to call `off` + * @method on + * @param {String} name + * @param {Function} callback + * @param {Object} context + */ + Events.prototype.on = function on(name, callback, context) { + if (!eventsApi(this, 'on', name, [callback, context]) || !callback) return this; + this._events || (this._events = {}); + var events = this._events[name] || (this._events[name] = []); + events.push({ callback: callback, context: context, ctx: context || this }); + return this; + }; - function n(e) { - e.global && 0 == t.active++ && i(e, null, "ajaxStart") - } + /** + * listen to an event only once + * @method once + * @param {String} name + * @param {Function} callback + * @param {Object} context + */ - function r(e) { - e.global && !--t.active && i(e, null, "ajaxStop") - } - function a(t, e) { - var n = e.context; - if (!1 === e.beforeSend.call(n, t, e) || !1 === i(e, n, "ajaxBeforeSend", [t, e])) return !1; - i(e, n, "ajaxSend", [t, e]) - } + Events.prototype.once = function once(name, callback, context) { + var _this = this; - function o(t, e, n, r) { - var a = n.context; - n.success.call(a, t, "success", e), r && r.resolveWith(a, [t, "success", e]), i(n, a, "ajaxSuccess", [e, n, t]), l("success", e, n) - } + var _once = void 0; + if (!eventsApi(this, 'once', name, [callback, context]) || !callback) return this; + var off = function off() { + return _this.off(name, _once); + }; + _once = function once() { + off(name, _once); + callback.apply(this, arguments); + }; + return this.on(name, _once, context); + }; - function s(t, e, n, r, a) { - var o = r.context; - r.error.call(o, n, e, t), a && a.rejectWith(o, [n, e, t]), i(r, o, "ajaxError", [n, r, t || e]), l(e, n, r) - } + /** + * stop listening to an event + * @method off + * @param {String} name + * @param {Function} callback + * @param {Object} context + */ + + + Events.prototype.off = function off(name, callback, context) { + var retain = void 0, + ev = void 0, + events = void 0, + names = void 0, + i = void 0, + l = void 0, + j = void 0, + k = void 0; + if (!this._events || !eventsApi(this, 'off', name, [callback, context])) return this; + if (!name && !callback && !context) { + this._events = void 0; + return this; + } + names = name ? [name] : (0, _keys2.default)(this._events); + // jshint maxdepth:5 + for (i = 0, l = names.length; i < l; i++) { + name = names[i]; + events = this._events[name]; + if (events) { + this._events[name] = retain = []; + if (callback || context) { + for (j = 0, k = events.length; j < k; j++) { + ev = events[j]; + if (callback && callback !== ev.callback && callback !== ev.callback._callback || context && context !== ev.context) retain.push(ev); + } + } + if (!retain.length) delete this._events[name]; + } + } + return this; + }; - function l(t, e, n) { - var a = n.context; - n.complete.call(a, e, t), i(n, a, "ajaxComplete", [e, n]), r(n) - } + /** + * triggers an event given its `name` + * @method trigger + * @param {String} name + */ - function u(t, e, i) { - if (i.dataFilter == c) return t; - var n = i.context; - return i.dataFilter.call(n, t, e) - } - function c() { - } + Events.prototype.trigger = function trigger(name) { + var klass = this.name || this.constructor.name; + _log2.default.debug.apply(_log2.default, [klass].concat(Array.prototype.slice.call(arguments))); + if (!this._events) return this; + var args = slice.call(arguments, 1); + if (!eventsApi(this, 'trigger', name, args)) return this; + var events = this._events[name]; + var allEvents = this._events.all; + if (events) triggerEvents(events, args, klass, name); + if (allEvents) triggerEvents(allEvents, arguments, klass, name); + return this; + }; - function d(t) { - return t && (t = t.split(";", 2)[0]), t && (t == S ? "html" : t == A ? "json" : E.test(t) ? "script" : T.test(t) && "xml") || "text" - } + /** + * stop listening an event for a given object + * @method stopListening + * @param {Object} obj + * @param {String} name + * @param {Function} callback + */ + + + Events.prototype.stopListening = function stopListening(obj, name, callback) { + var listeningTo = this._listeningTo; + if (!listeningTo) return this; + var remove = !name && !callback; + if (!callback && (typeof name === 'undefined' ? 'undefined' : (0, _typeof3.default)(name)) === 'object') callback = this; + if (obj) (listeningTo = {})[obj._listenId] = obj; + for (var id in listeningTo) { + obj = listeningTo[id]; + obj.off(name, callback, this); + if (remove || (0, _keys2.default)(obj._events).length === 0) delete this._listeningTo[id]; + } + return this; + }; - function h(t, e) { - return "" == e ? t : (t + "&" + e).replace(/[&?]{1,2}/, "?") - } + Events.register = function register(eventName) { + Events.Custom || (Events.Custom = {}); + var property = typeof eventName === 'string' && eventName.toUpperCase().trim(); - function f(e) { - e.processData && e.data && "string" != t.type(e.data) && (e.data = t.param(e.data, e.traditional)), !e.data || e.type && "GET" != e.type.toUpperCase() && "jsonp" != e.dataType || (e.url = h(e.url, e.data), e.data = void 0) - } + if (property && !Events.Custom[property]) { + Events.Custom[property] = property.toLowerCase().split('_').map(function (value, index) { + return index === 0 ? value : value = value[0].toUpperCase() + value.slice(1); + }).join(''); + } else _log2.default.error('Events', 'Error when register event: ' + eventName); + }; - function p(e, i, n, r) { - return t.isFunction(i) && (r = n, n = i, i = void 0), t.isFunction(n) || (r = n, n = void 0), { - url: e, - data: i, - success: n, - dataType: r - } - } + Events.listAvailableCustomEvents = function listAvailableCustomEvents() { + Events.Custom || (Events.Custom = {}); + return (0, _keys2.default)(Events.Custom).filter(function (property) { + return typeof Events.Custom[property] === 'string'; + }); + }; - function g(e, i, n, r) { - var a, o = t.isArray(i), s = t.isPlainObject(i); - t.each(i, function (i, l) { - a = t.type(l), r && (i = n ? r : r + "[" + (s || "object" == a || "array" == a ? i : "") + "]"), !r && o ? e.add(l.name, l.value) : "array" == a || !n && "object" == a ? g(e, l, n, i) : e.add(i, l) - }) - } + return Events; + }(); - var y, m, v = +new Date, b = window.document, _ = /)<[^<]*)*<\/script>/gi, - E = /^(?:text|application)\/javascript/i, T = /^(?:text|application)\/xml/i, A = "application/json", - S = "text/html", L = /^\s*$/, R = b.createElement("a"); - R.href = window.location.href, t.active = 0, t.ajaxJSONP = function (e, i) { - if (!("type" in e)) return t.ajax(e); - var n, r, l = e.jsonpCallback, u = (t.isFunction(l) ? l() : l) || "Zepto" + v++, - c = b.createElement("script"), d = window[u], h = function (e) { - t(c).triggerHandler("error", e || "abort") - }, f = {abort: h}; - return i && i.promise(f), t(c).on("load error", function (a, l) { - clearTimeout(r), t(c).off().remove(), "error" != a.type && n ? o(n[0], f, e, i) : s(null, l || "error", f, e, i), window[u] = d, n && t.isFunction(d) && d(n[0]), d = n = void 0 - }), !1 === a(f, e) ? (h("abort"), f) : (window[u] = function () { - n = arguments - }, c.src = e.url.replace(/\?(.+)=\?/, "?$1=" + u), b.head.appendChild(c), e.timeout > 0 && (r = setTimeout(function () { - h("timeout") - }, e.timeout)), f) - }, t.ajaxSettings = { - type: "GET", - beforeSend: c, - success: c, - error: c, - complete: c, - context: null, - global: !0, - xhr: function () { - return new window.XMLHttpRequest - }, - accepts: { - script: "text/javascript, application/javascript, application/x-javascript", - json: A, - xml: "application/xml, text/xml", - html: S, - text: "text/plain" - }, - crossDomain: !1, - timeout: 0, - processData: !0, - cache: !0, - dataFilter: c - }, t.ajax = function (e) { - var i, r, l = t.extend({}, e || {}), p = t.Deferred && t.Deferred(); - for (y in t.ajaxSettings) void 0 === l[y] && (l[y] = t.ajaxSettings[y]); - n(l), l.crossDomain || (i = b.createElement("a"), i.href = l.url, i.href = i.href, l.crossDomain = R.protocol + "//" + R.host != i.protocol + "//" + i.host), l.url || (l.url = window.location.toString()), (r = l.url.indexOf("#")) > -1 && (l.url = l.url.slice(0, r)), f(l); - var g = l.dataType, v = /\?.+=\?/.test(l.url); - if (v && (g = "jsonp"), !1 !== l.cache && (e && !0 === e.cache || "script" != g && "jsonp" != g) || (l.url = h(l.url, "_=" + Date.now())), "jsonp" == g) return v || (l.url = h(l.url, l.jsonp ? l.jsonp + "=?" : !1 === l.jsonp ? "" : "callback=?")), t.ajaxJSONP(l, p); - var _, E = l.accepts[g], T = {}, A = function (t, e) { - T[t.toLowerCase()] = [t, e] - }, S = /^([\w-]+:)\/\//.test(l.url) ? RegExp.$1 : window.location.protocol, k = l.xhr(), - C = k.setRequestHeader; - if (p && p.promise(k), l.crossDomain || A("X-Requested-With", "XMLHttpRequest"), A("Accept", E || "*/*"), (E = l.mimeType || E) && (E.indexOf(",") > -1 && (E = E.split(",", 2)[0]), k.overrideMimeType && k.overrideMimeType(E)), (l.contentType || !1 !== l.contentType && l.data && "GET" != l.type.toUpperCase()) && A("Content-Type", l.contentType || "application/x-www-form-urlencoded"), l.headers) for (m in l.headers) A(m, l.headers[m]); - if (k.setRequestHeader = A, k.onreadystatechange = function () { - if (4 == k.readyState) { - k.onreadystatechange = c, clearTimeout(_); - var e, i = !1; - if (k.status >= 200 && k.status < 300 || 304 == k.status || 0 == k.status && "file:" == S) { - if (g = g || d(l.mimeType || k.getResponseHeader("content-type")), "arraybuffer" == k.responseType || "blob" == k.responseType) e = k.response; else { - e = k.responseText; - try { - e = u(e, g, l), "script" == g ? (0, eval)(e) : "xml" == g ? e = k.responseXML : "json" == g && (e = L.test(e) ? null : t.parseJSON(e)) - } catch (t) { - i = t - } - if (i) return s(i, "parsererror", k, l, p) - } - o(e, k, l, p) - } else s(k.statusText || null, k.status ? "error" : "abort", k, l, p) - } - }, !1 === a(k, l)) return k.abort(), s(null, "abort", k, l, p), k; - var w = !("async" in l) || l.async; - if (k.open(l.type, l.url, w, l.username, l.password), l.xhrFields) for (m in l.xhrFields) k[m] = l.xhrFields[m]; - for (m in T) C.apply(k, T[m]); - return l.timeout > 0 && (_ = setTimeout(function () { - k.onreadystatechange = c, k.abort(), s(null, "timeout", k, l, p) - }, l.timeout)), k.send(l.data ? l.data : null), k - }, t.get = function () { - return t.ajax(p.apply(null, arguments)) - }, t.post = function () { - var e = p.apply(null, arguments); - return e.type = "POST", t.ajax(e) - }, t.getJSON = function () { - var e = p.apply(null, arguments); - return e.dataType = "json", t.ajax(e) - }, t.fn.load = function (e, i, n) { - if (!this.length) return this; - var r, a = this, o = e.split(/\s/), s = p(e, i, n), l = s.success; - return o.length > 1 && (s.url = o[0], r = o[1]), s.success = function (e) { - a.html(r ? t("
").html(e.replace(_, "")).find(r) : e), l && l.apply(a, arguments) - }, t.ajax(s), this - }; - var k = encodeURIComponent; - t.param = function (e, i) { - var n = []; - return n.add = function (e, i) { - t.isFunction(i) && (i = i()), null == i && (i = ""), this.push(k(e) + "=" + k(i)) - }, g(n, e, i), n.join("&").replace(/%20/g, "+") - } - }(i), function (t) { - t.Callbacks = function (e) { - e = t.extend({}, e); - var i, n, r, a, o, s, l = [], u = !e.once && [], c = function (t) { - for (i = e.memory && t, n = !0, s = a || 0, a = 0, o = l.length, r = !0; l && s < o; ++s) if (!1 === l[s].apply(t[0], t[1]) && e.stopOnFalse) { - i = !1; - break - } - r = !1, l && (u ? u.length && c(u.shift()) : i ? l.length = 0 : d.disable()) - }, d = { - add: function () { - if (l) { - var n = l.length, s = function (i) { - t.each(i, function (t, i) { - "function" == typeof i ? e.unique && d.has(i) || l.push(i) : i && i.length && "string" != typeof i && s(i) - }) - }; - s(arguments), r ? o = l.length : i && (a = n, c(i)) - } - return this - }, remove: function () { - return l && t.each(arguments, function (e, i) { - for (var n; (n = t.inArray(i, l, n)) > -1;) l.splice(n, 1), r && (n <= o && --o, n <= s && --s) - }), this - }, has: function (e) { - return !(!l || !(e ? t.inArray(e, l) > -1 : l.length)) - }, empty: function () { - return o = l.length = 0, this - }, disable: function () { - return l = u = i = void 0, this - }, disabled: function () { - return !l - }, lock: function () { - return u = void 0, i || d.disable(), this - }, locked: function () { - return !u - }, fireWith: function (t, e) { - return !l || n && !u || (e = e || [], e = [t, e.slice ? e.slice() : e], r ? u.push(e) : c(e)), this - }, fire: function () { - return d.fireWith(this, arguments) - }, fired: function () { - return !!n - } - }; - return d - } - }(i), function (t) { - function e(i) { - var n = [["resolve", "done", t.Callbacks({ - once: 1, - memory: 1 - }), "resolved"], ["reject", "fail", t.Callbacks({ - once: 1, - memory: 1 - }), "rejected"], ["notify", "progress", t.Callbacks({memory: 1})]], r = "pending", a = { - state: function () { - return r - }, always: function () { - return o.done(arguments).fail(arguments), this - }, then: function () { - var i = arguments; - return e(function (e) { - t.each(n, function (n, r) { - var s = t.isFunction(i[n]) && i[n]; - o[r[1]](function () { - var i = s && s.apply(this, arguments); - if (i && t.isFunction(i.promise)) i.promise().done(e.resolve).fail(e.reject).progress(e.notify); else { - var n = this === a ? e.promise() : this, o = s ? [i] : arguments; - e[r[0] + "With"](n, o) - } - }) - }), i = null - }).promise() - }, promise: function (e) { - return null != e ? t.extend(e, a) : a - } - }, o = {}; - return t.each(n, function (t, e) { - var i = e[2], s = e[3]; - a[e[1]] = i.add, s && i.add(function () { - r = s - }, n[1 ^ t][2].disable, n[2][2].lock), o[e[0]] = function () { - return o[e[0] + "With"](this === o ? a : this, arguments), this - }, o[e[0] + "With"] = i.fireWith - }), a.promise(o), i && i.call(o, o), o - } + /** + * listen to an event indefinitely for a given `obj` + * @method listenTo + * @param {Object} obj + * @param {String} name + * @param {Function} callback + * @param {Object} context + * @example + * ```javascript + * this.listenTo(this.core.playback, Events.PLAYBACK_PAUSE, this.callback) + * ``` + */ + /** + * listen to an event once for a given `obj` + * @method listenToOnce + * @param {Object} obj + * @param {String} name + * @param {Function} callback + * @param {Object} context + * @example + * ```javascript + * this.listenToOnce(this.core.playback, Events.PLAYBACK_PAUSE, this.callback) + * ``` + */ + + + exports.default = Events; + var listenMethods = { listenTo: 'on', listenToOnce: 'once' }; + + (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' : (0, _typeof3.default)(name)) === 'object') callback = this; + obj[listenMethods[method]](name, callback, this); + return this; + }; + }); - var i = Array.prototype.slice; - t.when = function (n) { - var r, a, o, s = i.call(arguments), l = s.length, u = 0, - c = 1 !== l || n && t.isFunction(n.promise) ? l : 0, d = 1 === c ? n : e(), h = function (t, e, n) { - return function (a) { - e[t] = this, n[t] = arguments.length > 1 ? i.call(arguments) : a, n === r ? d.notifyWith(e, n) : --c || d.resolveWith(e, n) - } - }; - if (l > 1) for (r = new Array(l), a = new Array(l), o = new Array(l); u < l; ++u) s[u] && t.isFunction(s[u].promise) ? s[u].promise().done(h(u, o, s)).fail(d.reject).progress(h(u, a, r)) : --c; - return c || d.resolveWith(o, s), d.promise() - }, t.Deferred = e - }(i), function (t) { - function e(t) { - return t._zid || (t._zid = h++) - } +// PLAYER EVENTS + /** + * Fired when the player is ready on startup + * + * @event PLAYER_READY + */ + Events.PLAYER_READY = 'ready'; + /** + * Fired when player resizes + * + * @event PLAYER_RESIZE + * @param {Object} currentSize an object with the current size + */ + Events.PLAYER_RESIZE = 'resize'; + /** + * Fired when player changes its fullscreen state + * + * @event PLAYER_FULLSCREEN + * @param {Boolean} whether or not the player is on fullscreen mode + */ + Events.PLAYER_FULLSCREEN = 'fullscreen'; + /** + * Fired when player starts to play + * + * @event PLAYER_PLAY + */ + Events.PLAYER_PLAY = 'play'; + /** + * Fired when player pauses + * + * @event PLAYER_PAUSE + */ + Events.PLAYER_PAUSE = 'pause'; + /** + * Fired when player stops + * + * @event PLAYER_STOP + */ + Events.PLAYER_STOP = 'stop'; + /** + * Fired when player ends the video + * + * @event PLAYER_ENDED + */ + Events.PLAYER_ENDED = 'ended'; + /** + * Fired when player seeks the video + * + * @event PLAYER_SEEK + * @param {Number} time the current time in seconds + */ + Events.PLAYER_SEEK = 'seek'; + /** + * Fired when player receives an error + * + * @event PLAYER_ERROR + * @param {Object} error the error + */ + Events.PLAYER_ERROR = 'playererror'; + /** + * Fired when there is an error + * + * @event ERROR + * @param {Object} error + * the error with the following format `{code, description, level, raw, origin, scope}` + * @param {String} [options.code] + * error's code: code to identify error in the following format: origin:code + * @param {String} [options.description] + * error's description: description of the error + * @param {String} [options.level] + * error's level: FATAL or WARN. + * @param {String} [options.origin] + * error's origin. Example: hls, html5, etc + * @param {String} [options.scope] + * error's scope. Example: playback, container, etc + * @param {String} [options.raw] + * raw error: the initial error received + */ + Events.ERROR = 'error'; + /** + * Fired when the time is updated on player + * + * @event PLAYER_TIMEUPDATE + * @param {Object} progress Data + * progress object + * @param {Number} [progress.current] + * current time (in seconds) + * @param {Number} [progress.total] + * total time (in seconds) + */ + Events.PLAYER_TIMEUPDATE = 'timeupdate'; + /** + * Fired when player updates its volume + * + * @event PLAYER_VOLUMEUPDATE + * @param {Number} volume the current volume + */ + Events.PLAYER_VOLUMEUPDATE = 'volumeupdate'; + + /** + * Fired when subtitle is available + * + * @event PLAYER_SUBTITLE_AVAILABLE + */ + Events.PLAYER_SUBTITLE_AVAILABLE = 'subtitleavailable'; + +// Playback Events + /** + * Fired when the playback is downloading the media + * + * @event PLAYBACK_PROGRESS + * @param progress {Object} + * Data progress object + * @param [progress.start] {Number} + * start position of buffered content at current position + * @param [progress.current] {Number} + * end position of buffered content at current position + * @param [progress.total] {Number} + * total content to be downloaded + * @param buffered {Array} + * array of buffered segments ({start, end}). [Only for supported playbacks] + */ + Events.PLAYBACK_PROGRESS = 'playback:progress'; + /** + * Fired when the time is updated on playback + * + * @event PLAYBACK_TIMEUPDATE + * @param {Object} progress Data + * progress object + * @param {Number} [progress.current] + * current time (in seconds) + * @param {Number} [progress.total] + * total time (in seconds) + */ + Events.PLAYBACK_TIMEUPDATE = 'playback:timeupdate'; + /** + * Fired when playback is ready + * + * @event PLAYBACK_READY + */ + Events.PLAYBACK_READY = 'playback:ready'; + /** + * Fired when the playback starts having to buffer because + * playback can currently not be smooth. + * + * This corresponds to the playback `buffering` property being + * `true`. + * + * @event PLAYBACK_BUFFERING + */ + Events.PLAYBACK_BUFFERING = 'playback:buffering'; + /** + * Fired when the playback has enough in the buffer to be + * able to play smoothly, after previously being unable to + * do this. + * + * This corresponds to the playback `buffering` property being + * `false`. + * + * @event PLAYBACK_BUFFERFULL + */ + Events.PLAYBACK_BUFFERFULL = 'playback:bufferfull'; + /** + * Fired when playback changes any settings (volume, seek and etc) + * + * @event PLAYBACK_SETTINGSUPDATE + */ + Events.PLAYBACK_SETTINGSUPDATE = 'playback:settingsupdate'; + /** + * Fired when playback loaded its metadata + * + * @event PLAYBACK_LOADEDMETADATA + * @param {Object} metadata Data + * settings object + * @param {Number} [metadata.duration] + * the playback duration + * @param {Object} [metadata.data] + * extra meta data + */ + Events.PLAYBACK_LOADEDMETADATA = 'playback:loadedmetadata'; + /** + * Fired when playback updates its video quality + * + * @event PLAYBACK_HIGHDEFINITIONUPDATE + * @param {Boolean} isHD + * true when is on HD, false otherwise + */ + Events.PLAYBACK_HIGHDEFINITIONUPDATE = 'playback:highdefinitionupdate'; + /** + * Fired when playback updates its bitrate + * + * @event PLAYBACK_BITRATE + * @param {Object} bitrate Data + * bitrate object + * @param {Number} [bitrate.bandwidth] + * bitrate bandwidth when it's available + * @param {Number} [bitrate.width] + * playback width (ex: 720, 640, 1080) + * @param {Number} [bitrate.height] + * playback height (ex: 240, 480, 720) + * @param {Number} [bitrate.level] + * playback level when it's available, it could be just a map for width (0 => 240, 1 => 480, 2 => 720) + */ + Events.PLAYBACK_BITRATE = 'playback:bitrate'; + /** + * Fired when the playback has its levels + * + * @event PLAYBACK_LEVELS_AVAILABLE + * @param {Array} levels + * the ordered levels, each one with the following format `{id: 1, label: '500kbps'}` ps: id should be a number >= 0 + * @param {Number} initial + * the initial level otherwise -1 (AUTO) + */ + Events.PLAYBACK_LEVELS_AVAILABLE = 'playback:levels:available'; + /** + * Fired when the playback starts to switch level + * + * @event PLAYBACK_LEVEL_SWITCH_START + * + */ + Events.PLAYBACK_LEVEL_SWITCH_START = 'playback:levels:switch:start'; + /** + * Fired when the playback ends the level switch + * + * @event PLAYBACK_LEVEL_SWITCH_END + * + */ + Events.PLAYBACK_LEVEL_SWITCH_END = 'playback:levels:switch:end'; + + /** + * Fired when playback internal state changes + * + * @event PLAYBACK_PLAYBACKSTATE + * @param {Object} state Data + * state object + * @param {String} [state.type] + * the playback type + */ + Events.PLAYBACK_PLAYBACKSTATE = 'playback:playbackstate'; + /** + * Fired when DVR becomes enabled/disabled. + * + * @event PLAYBACK_DVR + * @param {boolean} state true if dvr enabled + */ + Events.PLAYBACK_DVR = 'playback:dvr'; +// TODO doc + Events.PLAYBACK_MEDIACONTROL_DISABLE = 'playback:mediacontrol:disable'; +// TODO doc + Events.PLAYBACK_MEDIACONTROL_ENABLE = 'playback:mediacontrol:enable'; + /** + * Fired when the media for a playback ends. + * + * @event PLAYBACK_ENDED + * @param {String} name the name of the playback + */ + Events.PLAYBACK_ENDED = 'playback:ended'; + /** + * Fired when user requests `play()` + * + * @event PLAYBACK_PLAY_INTENT + */ + Events.PLAYBACK_PLAY_INTENT = 'playback:play:intent'; + /** + * Fired when the media for a playback starts playing. + * This is not necessarily when the user requests `play()` + * The media may have to buffer first. + * I.e. `isPlaying()` might return `true` before this event is fired, + * because `isPlaying()` represents the intended state. + * + * @event PLAYBACK_PLAY + */ + Events.PLAYBACK_PLAY = 'playback:play'; + /** + * Fired when the media for a playback pauses. + * + * @event PLAYBACK_PAUSE + */ + Events.PLAYBACK_PAUSE = 'playback:pause'; + /** + * Fired when the media for a playback is seeking. + * + * @event PLAYBACK_SEEK + */ + Events.PLAYBACK_SEEK = 'playback:seek'; + /** + * Fired when the media for a playback is seeked. + * + * @event PLAYBACK_SEEKED + */ + Events.PLAYBACK_SEEKED = 'playback:seeked'; + /** + * Fired when the media for a playback is stopped. + * + * @event PLAYBACK_STOP + */ + Events.PLAYBACK_STOP = 'playback:stop'; + /** + * Fired if an error occurs in the playback. + * + * @event PLAYBACK_ERROR + * @param {Object} error An object containing the error details + * @param {String} name Playback name + */ + Events.PLAYBACK_ERROR = 'playback:error'; +// TODO doc + Events.PLAYBACK_STATS_ADD = 'playback:stats:add'; +// TODO doc + Events.PLAYBACK_FRAGMENT_LOADED = 'playback:fragment:loaded'; +// TODO doc + Events.PLAYBACK_LEVEL_SWITCH = 'playback:level:switch'; + /** + * Fired when subtitle is available on playback for display + * + * @event PLAYBACK_SUBTITLE_AVAILABLE + */ + Events.PLAYBACK_SUBTITLE_AVAILABLE = 'playback:subtitle:available'; + /** + * Fired when playback subtitle track has changed + * + * @event CONTAINER_SUBTITLE_CHANGED + * @param {Object} track Data + * track object + * @param {Number} [track.id] + * selected track id + */ + Events.PLAYBACK_SUBTITLE_CHANGED = 'playback:subtitle:changed'; + +// Core Events + /** + * Fired when the containers are created + * + * @event CORE_CONTAINERS_CREATED + */ + Events.CORE_CONTAINERS_CREATED = 'core:containers:created'; + /** + * Fired when the active container changed + * + * @event CORE_ACTIVE_CONTAINER_CHANGED + */ + Events.CORE_ACTIVE_CONTAINER_CHANGED = 'core:active:container:changed'; + /** + * Fired when the options were changed for the core + * + * @event CORE_OPTIONS_CHANGE + */ + Events.CORE_OPTIONS_CHANGE = 'core:options:change'; + /** + * Fired after creating containers, when the core is ready + * + * @event CORE_READY + */ + 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 + */ + Events.CORE_FULLSCREEN = 'core:fullscreen'; + /** + * Fired when core updates size + * + * @event CORE_RESIZE + * @param {Object} currentSize an object with the current size + */ + Events.CORE_RESIZE = 'core:resize'; + /** + * 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'; + /** + * Fired when occurs mouse move event on core element + * + * @event CORE_MOUSE_MOVE + * @param {Object} event a DOM event + */ + Events.CORE_MOUSE_MOVE = 'core:mousemove'; + /** + * Fired when occurs mouse leave event on core element + * + * @event CORE_MOUSE_LEAVE + * @param {Object} event a DOM event + */ + Events.CORE_MOUSE_LEAVE = 'core:mouseleave'; + +// Container Events + /** + * Fired when the container internal state changes + * + * @event CONTAINER_PLAYBACKSTATE + * @param {Object} state Data + * state object + * @param {String} [state.type] + * the playback type + */ + Events.CONTAINER_PLAYBACKSTATE = 'container:playbackstate'; + Events.CONTAINER_PLAYBACKDVRSTATECHANGED = 'container:dvr'; + /** + * Fired when the container updates its bitrate + * + * @event CONTAINER_BITRATE + * @param {Object} bitrate Data + * bitrate object + * @param {Number} [bitrate.bandwidth] + * bitrate bandwidth when it's available + * @param {Number} [bitrate.width] + * playback width (ex: 720, 640, 1080) + * @param {Number} [bitrate.height] + * playback height (ex: 240, 480, 720) + * @param {Number} [bitrate.level] + * playback level when it's available, it could be just a map for width (0 => 240, 1 => 480, 2 => 720) + */ + Events.CONTAINER_BITRATE = 'container:bitrate'; + Events.CONTAINER_STATS_REPORT = 'container:stats:report'; + Events.CONTAINER_DESTROYED = 'container:destroyed'; + /** + * Fired when the container is ready + * + * @event CONTAINER_READY + */ + Events.CONTAINER_READY = 'container:ready'; + Events.CONTAINER_ERROR = 'container:error'; + /** + * Fired when the container loaded its metadata + * + * @event CONTAINER_LOADEDMETADATA + * @param {Object} metadata Data + * settings object + * @param {Number} [metadata.duration] + * the playback duration + * @param {Object} [metadata.data] + * extra meta data + */ + Events.CONTAINER_LOADEDMETADATA = 'container:loadedmetadata'; + + /** + * Fired when subtitle is available on container for display + * + * @event CONTAINER_SUBTITLE_AVAILABLE + */ + Events.CONTAINER_SUBTITLE_AVAILABLE = 'container:subtitle:available'; + /** + * Fired when subtitle track has changed + * + * @event CONTAINER_SUBTITLE_CHANGED + * @param {Object} track Data + * track object + * @param {Number} [track.id] + * selected track id + */ + Events.CONTAINER_SUBTITLE_CHANGED = 'container:subtitle:changed'; + + /** + * Fired when the time is updated on container + * + * @event CONTAINER_TIMEUPDATE + * @param {Object} progress Data + * progress object + * @param {Number} [progress.current] + * current time (in seconds) + * @param {Number} [progress.total] + * total time (in seconds) + */ + Events.CONTAINER_TIMEUPDATE = 'container:timeupdate'; + /** + * Fired when the container is downloading the media + * + * @event CONTAINER_PROGRESS + * @param {Object} progress Data + * progress object + * @param {Number} [progress.start] + * initial downloaded content + * @param {Number} [progress.current] + * current dowloaded content + * @param {Number} [progress.total] + * total content to be downloaded + */ + Events.CONTAINER_PROGRESS = 'container:progress'; + Events.CONTAINER_PLAY = 'container:play'; + Events.CONTAINER_STOP = 'container:stop'; + Events.CONTAINER_PAUSE = 'container:pause'; + Events.CONTAINER_ENDED = 'container:ended'; + Events.CONTAINER_CLICK = 'container:click'; + Events.CONTAINER_DBLCLICK = 'container:dblclick'; + Events.CONTAINER_CONTEXTMENU = 'container:contextmenu'; + Events.CONTAINER_MOUSE_ENTER = 'container:mouseenter'; + Events.CONTAINER_MOUSE_LEAVE = 'container:mouseleave'; + /** + * Fired when the container seeks the video + * + * @event CONTAINER_SEEK + * @param {Number} time the current time in seconds + */ + Events.CONTAINER_SEEK = 'container:seek'; + /** + * Fired when the container was finished the seek video + * + * @event CONTAINER_SEEKED + * @param {Number} time the current time in seconds + */ + Events.CONTAINER_SEEKED = 'container:seeked'; + Events.CONTAINER_VOLUME = 'container:volume'; + Events.CONTAINER_FULLSCREEN = 'container:fullscreen'; + /** + * Fired when container is buffering + * + * @event CONTAINER_STATE_BUFFERING + */ + Events.CONTAINER_STATE_BUFFERING = 'container:state:buffering'; + /** + * Fired when the container filled the buffer + * + * @event CONTAINER_STATE_BUFFERFULL + */ + Events.CONTAINER_STATE_BUFFERFULL = 'container:state:bufferfull'; + /** + * Fired when the container changes any settings (volume, seek and etc) + * + * @event CONTAINER_SETTINGSUPDATE + */ + Events.CONTAINER_SETTINGSUPDATE = 'container:settingsupdate'; + /** + * Fired when container updates its video quality + * + * @event CONTAINER_HIGHDEFINITIONUPDATE + * @param {Boolean} isHD + * true when is on HD, false otherwise + */ + Events.CONTAINER_HIGHDEFINITIONUPDATE = 'container:highdefinitionupdate'; + + /** + * Fired when the media control shows + * + * @event CONTAINER_MEDIACONTROL_SHOW + */ + Events.CONTAINER_MEDIACONTROL_SHOW = 'container:mediacontrol:show'; + /** + * Fired when the media control hides + * + * @event CONTAINER_MEDIACONTROL_HIDE + */ + Events.CONTAINER_MEDIACONTROL_HIDE = 'container:mediacontrol:hide'; + + Events.CONTAINER_MEDIACONTROL_DISABLE = 'container:mediacontrol:disable'; + Events.CONTAINER_MEDIACONTROL_ENABLE = 'container:mediacontrol:enable'; + Events.CONTAINER_STATS_ADD = 'container:stats:add'; + /** + * Fired when the options were changed for the container + * + * @event CONTAINER_OPTIONS_CHANGE + */ + Events.CONTAINER_OPTIONS_CHANGE = 'container:options:change'; + +// MediaControl Events + Events.MEDIACONTROL_RENDERED = 'mediacontrol:rendered'; + /** + * Fired when the player enters/exit on fullscreen + * + * @event MEDIACONTROL_FULLSCREEN + */ + Events.MEDIACONTROL_FULLSCREEN = 'mediacontrol:fullscreen'; + /** + * Fired when the media control shows + * + * @event MEDIACONTROL_SHOW + */ + Events.MEDIACONTROL_SHOW = 'mediacontrol:show'; + /** + * Fired when the media control hides + * + * @event MEDIACONTROL_HIDE + */ + Events.MEDIACONTROL_HIDE = 'mediacontrol:hide'; + /** + * Fired when mouse enters on the seekbar + * + * @event MEDIACONTROL_MOUSEMOVE_SEEKBAR + * @param {Object} event + * the javascript event + */ + Events.MEDIACONTROL_MOUSEMOVE_SEEKBAR = 'mediacontrol:mousemove:seekbar'; + /** + * Fired when mouse leaves the seekbar + * + * @event MEDIACONTROL_MOUSELEAVE_SEEKBAR + * @param {Object} event + * the javascript event + */ + Events.MEDIACONTROL_MOUSELEAVE_SEEKBAR = 'mediacontrol:mouseleave:seekbar'; + /** + * Fired when the media is being played + * + * @event MEDIACONTROL_PLAYING + */ + Events.MEDIACONTROL_PLAYING = 'mediacontrol:playing'; + /** + * Fired when the media is not being played + * + * @event MEDIACONTROL_NOTPLAYING + */ + Events.MEDIACONTROL_NOTPLAYING = 'mediacontrol:notplaying'; + /** + * Fired when the container was changed + * + * @event MEDIACONTROL_CONTAINERCHANGED + */ + Events.MEDIACONTROL_CONTAINERCHANGED = 'mediacontrol:containerchanged'; + /** + * Fired when the options were changed for the mediacontrol + * + * @event MEDIACONTROL_OPTIONS_CHANGE + */ + Events.MEDIACONTROL_OPTIONS_CHANGE = 'mediacontrol:options:change'; + module.exports = exports['default']; + + /***/ }), + /* 5 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.DomRecycler = exports.cancelAnimationFrame = exports.requestAnimationFrame = exports.QueryString = exports.Config = exports.Fullscreen = undefined; - function i(t, i, a, o) { - if (i = n(i), i.ns) var s = r(i.ns); - return (y[e(t)] || []).filter(function (t) { - return t && (!i.e || t.e == i.e) && (!i.ns || s.test(t.ns)) && (!a || e(t.fn) === e(a)) && (!o || t.sel == o) - }) - } + var _assign = __webpack_require__(12); - function n(t) { - var e = ("" + t).split("."); - return {e: e[0], ns: e.slice(1).sort().join(" ")} - } + var _assign2 = _interopRequireDefault(_assign); - function r(t) { - return new RegExp("(?:^| )" + t.replace(" ", " .* ?") + "(?: |$)") - } + var _createClass2 = __webpack_require__(3); - function a(t, e) { - return t.del && !v && t.e in b || !!e - } + var _createClass3 = _interopRequireDefault(_createClass2); - function o(t) { - return _[t] || v && b[t] || t - } + var _classCallCheck2 = __webpack_require__(0); - function s(i, r, s, l, c, h, f) { - var p = e(i), g = y[p] || (y[p] = []); - r.split(/\s/).forEach(function (e) { - if ("ready" == e) return t(document).ready(s); - var r = n(e); - r.fn = s, r.sel = c, r.e in _ && (s = function (e) { - var i = e.relatedTarget; - if (!i || i !== this && !t.contains(this, i)) return r.fn.apply(this, arguments) - }), r.del = h; - var p = h || s; - r.proxy = function (t) { - if (t = u(t), !t.isImmediatePropagationStopped()) { - t.data = l; - var e = p.apply(i, t._args == d ? [t] : [t].concat(t._args)); - return !1 === e && (t.preventDefault(), t.stopPropagation()), e - } - }, r.i = g.length, g.push(r), "addEventListener" in i && i.addEventListener(o(r.e), r.proxy, a(r, f)) - }) - } + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); - function l(t, n, r, s, l) { - var u = e(t); - (n || "").split(/\s/).forEach(function (e) { - i(t, e, r, s).forEach(function (e) { - delete y[u][e.i], "removeEventListener" in t && t.removeEventListener(o(e.e), e.proxy, a(e, l)) - }) - }) - } + var _possibleConstructorReturn2 = __webpack_require__(1); - function u(e, i) { - return !i && e.isDefaultPrevented || (i || (i = e), t.each(S, function (t, n) { - var r = i[t]; - e[t] = function () { - return this[n] = E, r && r.apply(i, arguments) - }, e[n] = T - }), e.timeStamp || (e.timeStamp = Date.now()), (i.defaultPrevented !== d ? i.defaultPrevented : "returnValue" in i ? !1 === i.returnValue : i.getPreventDefault && i.getPreventDefault()) && (e.isDefaultPrevented = E)), e - } + var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); - function c(t) { - var e, i = {originalEvent: t}; - for (e in t) A.test(e) || t[e] === d || (i[e] = t[e]); - return u(i, t) - } + var _inherits2 = __webpack_require__(2); - var d, h = 1, f = Array.prototype.slice, p = t.isFunction, g = function (t) { - return "string" == typeof t - }, y = {}, m = {}, v = "onfocusin" in window, b = {focus: "focusin", blur: "focusout"}, - _ = {mouseenter: "mouseover", mouseleave: "mouseout"}; - m.click = m.mousedown = m.mouseup = m.mousemove = "MouseEvents", t.event = { - add: s, - remove: l - }, t.proxy = function (i, n) { - var r = 2 in arguments && f.call(arguments, 2); - if (p(i)) { - var a = function () { - return i.apply(n, r ? r.concat(f.call(arguments)) : arguments) - }; - return a._zid = e(i), a - } - if (g(n)) return r ? (r.unshift(i[n], i), t.proxy.apply(null, r)) : t.proxy(i[n], i); - throw new TypeError("expected function") - }, t.fn.bind = function (t, e, i) { - return this.on(t, e, i) - }, t.fn.unbind = function (t, e) { - return this.off(t, e) - }, t.fn.one = function (t, e, i, n) { - return this.on(t, e, i, n, 1) - }; - var E = function () { - return !0 - }, T = function () { - return !1 - }, A = /^([A-Z]|returnValue$|layer[XY]$|webkitMovement[XY]$)/, S = { - preventDefault: "isDefaultPrevented", - stopImmediatePropagation: "isImmediatePropagationStopped", - stopPropagation: "isPropagationStopped" - }; - t.fn.delegate = function (t, e, i) { - return this.on(e, t, i) - }, t.fn.undelegate = function (t, e, i) { - return this.off(e, t, i) - }, t.fn.live = function (e, i) { - return t(document.body).delegate(this.selector, e, i), this - }, t.fn.die = function (e, i) { - return t(document.body).undelegate(this.selector, e, i), this - }, t.fn.on = function (e, i, n, r, a) { - var o, u, h = this; - return e && !g(e) ? (t.each(e, function (t, e) { - h.on(t, i, n, e, a) - }), h) : (g(i) || p(r) || !1 === r || (r = n, n = i, i = d), r !== d && !1 !== n || (r = n, n = d), !1 === r && (r = T), h.each(function (d, h) { - a && (o = function (t) { - return l(h, t.type, r), r.apply(this, arguments) - }), i && (u = function (e) { - var n, a = t(e.target).closest(i, h).get(0); - if (a && a !== h) return n = t.extend(c(e), { - currentTarget: a, - liveFired: h - }), (o || r).apply(a, [n].concat(f.call(arguments, 1))) - }), s(h, e, r, n, i, u || o) - })) - }, t.fn.off = function (e, i, n) { - var r = this; - return e && !g(e) ? (t.each(e, function (t, e) { - r.off(t, i, e) - }), r) : (g(i) || p(n) || !1 === n || (n = i, i = d), !1 === n && (n = T), r.each(function () { - l(this, e, n, i) - })) - }, t.fn.trigger = function (e, i) { - return e = g(e) || t.isPlainObject(e) ? t.Event(e) : u(e), e._args = i, this.each(function () { - e.type in b && "function" == typeof this[e.type] ? this[e.type]() : "dispatchEvent" in this ? this.dispatchEvent(e) : t(this).triggerHandler(e, i) - }) - }, t.fn.triggerHandler = function (e, n) { - var r, a; - return this.each(function (o, s) { - r = c(g(e) ? t.Event(e) : e), r._args = n, r.target = s, t.each(i(s, e.type || e), function (t, e) { - if (a = e.proxy(r), r.isImmediatePropagationStopped()) return !1 - }) - }), a - }, "focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function (e) { - t.fn[e] = function (t) { - return 0 in arguments ? this.bind(e, t) : this.trigger(e) - } - }), t.Event = function (t, e) { - g(t) || (e = t, t = e.type); - var i = document.createEvent(m[t] || "Events"), n = !0; - if (e) for (var r in e) "bubbles" == r ? n = !!e[r] : i[r] = e[r]; - return i.initEvent(t, n, !0), u(i) - } - }(i), function () { - try { - getComputedStyle(void 0) - } catch (e) { - var t = getComputedStyle; - window.getComputedStyle = function (e, i) { - try { - return t(e, i) - } catch (t) { - return null + var _inherits3 = _interopRequireDefault(_inherits2); + + var _defineProperty = __webpack_require__(75); + + var _defineProperty2 = _interopRequireDefault(_defineProperty); + + var _getOwnPropertyDescriptor = __webpack_require__(140); + + var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor); + + exports.assign = assign; + exports.extend = extend; + exports.formatTime = formatTime; + exports.seekStringToSeconds = seekStringToSeconds; + exports.uniqueId = uniqueId; + exports.isNumber = isNumber; + exports.currentScriptUrl = currentScriptUrl; + exports.getBrowserLanguage = getBrowserLanguage; + exports.now = now; + exports.removeArrayItem = removeArrayItem; + exports.listContainsIgnoreCase = listContainsIgnoreCase; + exports.canAutoPlayMedia = canAutoPlayMedia; + + __webpack_require__(143); + + var _browser = __webpack_require__(14); + + var _browser2 = _interopRequireDefault(_browser); + + var _clapprZepto = __webpack_require__(6); + + var _clapprZepto2 = _interopRequireDefault(_clapprZepto); + + var _media = __webpack_require__(147); + + var _media2 = _interopRequireDefault(_media); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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. + /*jshint -W079 */ + + function assign(obj, source) { + if (source) { + for (var prop in source) { + var propDescriptor = (0, _getOwnPropertyDescriptor2.default)(source, prop); + propDescriptor ? (0, _defineProperty2.default)(obj, prop, propDescriptor) : obj[prop] = source[prop]; } } - } - }(), function (t) { - function e(e) { - return e = t(e), !(!e.width() && !e.height()) && "none" !== e.css("display") + return obj; } - function i(t, e) { - t = t.replace(/=#\]/g, '="#"]'); - var i, n, r = s.exec(t); - if (r && r[2] in o && (i = o[r[2]], n = r[3], t = r[1], n)) { - var a = Number(n); - n = isNaN(a) ? n.replace(/^["']|["']$/g, "") : a - } - return e(t, i, n) - } + function extend(parent, properties) { + var Surrogate = function (_parent) { + (0, _inherits3.default)(Surrogate, _parent); - var n = t.zepto, r = n.qsa, a = n.matches, o = t.expr[":"] = { - visible: function () { - if (e(this)) return this - }, hidden: function () { - if (!e(this)) return this - }, selected: function () { - if (this.selected) return this - }, checked: function () { - if (this.checked) return this - }, parent: function () { - return this.parentNode - }, first: function (t) { - if (0 === t) return this - }, last: function (t, e) { - if (t === e.length - 1) return this - }, eq: function (t, e, i) { - if (t === i) return this - }, contains: function (e, i, n) { - if (t(this).text().indexOf(n) > -1) return this - }, has: function (t, e, i) { - if (n.qsa(this, i).length) return this - } - }, s = new RegExp("(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*"), l = /^\s*>/, u = "Zepto" + +new Date; - n.qsa = function (e, a) { - return i(a, function (i, o, s) { - try { - var c; - !i && o ? i = "*" : l.test(i) && (c = t(e).addClass(u), i = "." + u + " " + i); - var d = r(e, i) - } catch (t) { - throw console.error("error performing selector: %o", a), t - } finally { - c && c.removeClass(u) - } - return o ? n.uniq(t.map(d, function (t, e) { - return o.call(t, e, d, s) - })) : d - }) - }, n.matches = function (t, e) { - return i(e, function (e, i, n) { - return (!e || a(t, e)) && (!i || i.call(t, null, n) === t) - }) + function 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 = (0, _possibleConstructorReturn3.default)(this, _parent.call.apply(_parent, [this].concat(args))); + + if (properties.initialize) properties.initialize.apply(_this, args); + + return _this; + } + + return Surrogate; + }(parent); + + assign(Surrogate.prototype, properties); + return Surrogate; } - }(i), t.exports = i - }, function (t, e) { - function i(t, e) { - var i = t[1] || "", r = t[3]; - if (!r) return i; - if (e && "function" == typeof btoa) { - var a = n(r); - return [i].concat(r.sources.map(function (t) { - return "/*# sourceURL=" + r.sourceRoot + t + " */" - })).concat([a]).join("\n") + + function formatTime(time, paddedHours) { + if (!isFinite(time)) return '--:--'; + + time = time * 1000; + time = parseInt(time / 1000); + var seconds = time % 60; + time = parseInt(time / 60); + var minutes = time % 60; + time = parseInt(time / 60); + var hours = time % 24; + var days = parseInt(time / 24); + var out = ''; + if (days && days > 0) { + out += days + ':'; + if (hours < 1) out += '00:'; + } + if (hours && hours > 0 || paddedHours) out += ('0' + hours).slice(-2) + ':'; + out += ('0' + minutes).slice(-2) + ':'; + out += ('0' + seconds).slice(-2); + return out.trim(); } - return [i].join("\n") - } - function n(t) { - return "/*# sourceMappingURL=data:application/json;charset=utf-8;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(t)))) + " */" - } + var Fullscreen = exports.Fullscreen = { + isFullscreen: function isFullscreen() { + return !!(document.webkitFullscreenElement || document.webkitIsFullScreen || document.mozFullScreen || document.msFullscreenElement); + }, + requestFullscreen: function requestFullscreen(el) { + if (el.requestFullscreen) el.requestFullscreen();else if (el.webkitRequestFullscreen) el.webkitRequestFullscreen();else if (el.mozRequestFullScreen) el.mozRequestFullScreen();else if (el.msRequestFullscreen) 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() { + var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; - t.exports = function (t) { - var e = []; - return e.toString = function () { - return this.map(function (e) { - var n = i(e, t); - return e[2] ? "@media " + e[2] + "{" + n + "}" : n - }).join("") - }, e.i = function (t, i) { - "string" == typeof t && (t = [[null, t, ""]]); - for (var n = {}, r = 0; r < this.length; r++) { - var a = this[r][0]; - "number" == typeof a && (n[a] = !0) - } - for (r = 0; r < t.length; r++) { - var o = t[r]; - "number" == typeof o[0] && n[o[0]] || (i && !o[2] ? o[2] = i : i && (o[2] = "(" + o[2] + ") and (" + i + ")"), e.push(o)) - } - }, e - } - }, function (t, e, i) { - "use strict"; - Object.defineProperty(e, "__esModule", {value: !0}); - var n = {evaluate: /<%([\s\S]+?)%>/g, interpolate: /<%=([\s\S]+?)%>/g, escape: /<%-([\s\S]+?)%>/g}, r = /(.)^/, - a = {"'": "'", "\\": "\\", "\r": "r", "\n": "n", "\t": "t", "\u2028": "u2028", "\u2029": "u2029"}, - o = /\\|'|\r|\n|\t|\u2028|\u2029/g, - s = {"&": "&", "<": "<", ">": ">", '"': """, "'": "'"}, l = new RegExp("[&<>\"']", "g"), - u = function (t) { - return null === t ? "" : ("" + t).replace(l, function (t) { - return s[t] - }) - }, c = 0, d = function (t, e) { - var i, - s = new RegExp([(n.escape || r).source, (n.interpolate || r).source, (n.evaluate || r).source].join("|") + "|$", "g"), - l = 0, d = "__p+='"; - t.replace(s, function (e, i, n, r, s) { - return d += t.slice(l, s).replace(o, function (t) { - return "\\" + a[t] - }), i && (d += "'+\n((__t=(" + i + "))==null?'':escapeExpr(__t))+\n'"), n && (d += "'+\n((__t=(" + n + "))==null?'':__t)+\n'"), r && (d += "';\n" + r + "\n__p+='"), l = s + e.length, e - }), d += "';\n", n.variable || (d = "with(obj||{}){\n" + d + "}\n"), d = "var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n" + d + "return __p;\n//# sourceURL=/microtemplates/source[" + c++ + "]"; - try { - i = new Function(n.variable || "obj", "escapeExpr", d) - } catch (t) { - throw t.source = d, t + 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() { + return !!(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled); } - if (e) return i(e, u); - var h = function (t) { - return i.call(this, t, u) - }; - return h.source = "function(" + (n.variable || "obj") + "){\n" + d + "}", h }; - d.settings = n, e.default = d, t.exports = e.default - }, function (t, e, i) { - "use strict"; - - function n(t) { - return t && t.__esModule ? t : {default: t} - } - Object.defineProperty(e, "__esModule", {value: !0}); - var r = i(0), a = n(r), o = i(1), s = n(o), l = i(3), u = n(l), c = i(2), d = n(c), h = i(5), f = i(21), - p = n(f), g = function (t) { - function e(i, n) { - (0, a.default)(this, e); - var r = (0, s.default)(this, t.call(this, i)); - return r.settings = {}, r._i18n = n, r + var Config = exports.Config = function () { + function Config() { + (0, _classCallCheck3.default)(this, Config); } - return (0, d.default)(e, t), (0, u.default)(e, [{ - key: "isAudioOnly", get: function () { - return !1 - } - }, { - key: "isAdaptive", get: function () { - return !1 - } - }, { - key: "ended", get: function () { - return !1 + Config._defaultConfig = function _defaultConfig() { + return { + volume: { + value: 100, + parse: parseInt + } + }; + }; + + Config._defaultValueFor = function _defaultValueFor(key) { + try { + return this._defaultConfig()[key].parse(this._defaultConfig()[key].value); + } catch (e) { + return undefined; } - }, { - key: "i18n", get: function () { - return this._i18n + }; + + Config._createKeyspace = function _createKeyspace(key) { + return 'clappr.' + document.domain + '.' + key; + }; + + Config.restore = function restore(key) { + if (_browser2.default.hasLocalstorage && localStorage[this._createKeyspace(key)]) return this._defaultConfig()[key].parse(localStorage[this._createKeyspace(key)]); + + return this._defaultValueFor(key); + }; + + Config.persist = function persist(key, value) { + if (_browser2.default.hasLocalstorage) { + try { + localStorage[this._createKeyspace(key)] = value; + return true; + } catch (e) { + return false; + } } - }, { - key: "buffering", get: function () { - return !1 - } - }]), e.prototype.consent = function () { - }, e.prototype.play = function () { - }, e.prototype.pause = function () { - }, e.prototype.stop = function () { - }, e.prototype.seek = function (t) { - }, e.prototype.seekPercentage = function (t) { - }, e.prototype.getStartTimeOffset = function () { - return 0 - }, e.prototype.getDuration = function () { - return 0 - }, e.prototype.isPlaying = function () { - return !1 - }, e.prototype.getPlaybackType = function () { - return e.NO_OP - }, e.prototype.isHighDefinitionInUse = function () { - return !1 - }, e.prototype.volume = function (t) { - }, e.prototype.destroy = function () { - this.$el.remove() - }, (0, u.default)(e, [{ - key: "isReady", get: function () { - return !1 + }; + + return Config; + }(); + + var QueryString = exports.QueryString = function () { + function QueryString() { + (0, _classCallCheck3.default)(this, QueryString); + } + + QueryString.parse = function parse(paramsString) { + var match = void 0; + var pl = /\+/g, + // Regex for replacing addition symbol with a space + search = /([^&=]+)=?([^&]*)/g, + decode = function decode(s) { + return decodeURIComponent(s.replace(pl, ' ')); + }, + params = {}; + while (match = search.exec(paramsString)) { + // eslint-disable-line no-cond-assign + params[decode(match[1]).toLowerCase()] = decode(match[2]); } - }, { - key: "hasClosedCaptionsTracks", get: function () { - return this.closedCaptionsTracks.length > 0 + return params; + }; + + (0, _createClass3.default)(QueryString, null, [{ + key: 'params', + get: function get() { + var query = window.location.search.substring(1); + if (query !== this.query) { + this._urlParams = this.parse(query); + this.query = query; + } + return this._urlParams; } }, { - key: "closedCaptionsTracks", get: function () { - return [] + key: 'hashParams', + get: function get() { + var hash = window.location.hash.substring(1); + if (hash !== this.hash) { + this._hashParams = this.parse(hash); + this.hash = hash; + } + return this._hashParams; } - }, { - key: "closedCaptionsTrackId", get: function () { - return -1 - }, set: function (t) { - } - }]), e - }(p.default); - e.default = g, g.extend = function (t) { - return (0, h.extend)(g, t) - }, g.canPlay = function (t, e) { - return !1 - }, g.VOD = "vod", g.AOD = "aod", g.LIVE = "live", g.NO_OP = "no_op", g.type = "playback", t.exports = e.default - }, function (t, e, i) { - function n(t, e) { - for (var i = 0; i < t.length; i++) { - var n = t[i], r = p[n.id]; - if (r) { - r.refs++; - for (var a = 0; a < r.parts.length; a++) r.parts[a](n.parts[a]); - for (; a < n.parts.length; a++) r.parts.push(c(n.parts[a], e)) - } else { - for (var o = [], a = 0; a < n.parts.length; a++) o.push(c(n.parts[a], e)); - p[n.id] = {id: n.id, refs: 1, parts: o} + }]); + return QueryString; + }(); + + function seekStringToSeconds() { + var paramName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 't'; + + var seconds = 0; + var seekString = QueryString.params[paramName] || QueryString.hashParams[paramName] || ''; + var parts = seekString.match(/[0-9]+[hms]+/g) || []; + if (parts.length > 0) { + var factor = { 'h': 3600, 'm': 60, 's': 1 }; + parts.forEach(function (el) { + if (el) { + var suffix = el[el.length - 1]; + var time = parseInt(el.slice(0, el.length - 1), 10); + seconds += time * factor[suffix]; + } + }); + } else if (seekString) { + seconds = parseInt(seekString, 10); } - } - } - function r(t, e) { - for (var i = [], n = {}, r = 0; r < t.length; r++) { - var a = t[r], o = e.base ? a[0] + e.base : a[0], s = a[1], l = a[2], u = a[3], - c = {css: s, media: l, sourceMap: u}; - n[o] ? n[o].parts.push(c) : i.push(n[o] = {id: o, parts: [c]}) + return seconds; } - return i - } - function a(t, e) { - var i = y(t.insertInto); - if (!i) throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid."); - var n = b[b.length - 1]; - if ("top" === t.insertAt) n ? n.nextSibling ? i.insertBefore(e, n.nextSibling) : i.appendChild(e) : i.insertBefore(e, i.firstChild), b.push(e); else if ("bottom" === t.insertAt) i.appendChild(e); else { - if ("object" != typeof t.insertAt || !t.insertAt.before) throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n"); - var r = y(t.insertInto + " " + t.insertAt.before); - i.insertBefore(e, r) + var idsCounter = {}; + + function uniqueId(prefix) { + idsCounter[prefix] || (idsCounter[prefix] = 0); + var id = ++idsCounter[prefix]; + return prefix + id; } - } - function o(t) { - if (null === t.parentNode) return !1; - t.parentNode.removeChild(t); - var e = b.indexOf(t); - e >= 0 && b.splice(e, 1) - } + function isNumber(value) { + return value - parseFloat(value) + 1 >= 0; + } - function s(t) { - var e = document.createElement("style"); - return t.attrs.type = "text/css", u(e, t.attrs), a(t, e), e - } + function currentScriptUrl() { + var scripts = document.getElementsByTagName('script'); + return scripts.length ? scripts[scripts.length - 1].src : ''; + } - function l(t) { - var e = document.createElement("link"); - return t.attrs.type = "text/css", t.attrs.rel = "stylesheet", u(e, t.attrs), a(t, e), e - } + var requestAnimationFrame = exports.requestAnimationFrame = (window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || function (fn) { + window.setTimeout(fn, 1000 / 60); + }).bind(window); - function u(t, e) { - Object.keys(e).forEach(function (i) { - t.setAttribute(i, e[i]) - }) - } + var cancelAnimationFrame = exports.cancelAnimationFrame = (window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.clearTimeout).bind(window); - function c(t, e) { - var i, n, r, a; - if (e.transform && t.css) { - if (!(a = e.transform(t.css))) return function () { - }; - t.css = a + function getBrowserLanguage() { + return window.navigator && window.navigator.language; } - if (e.singleton) { - var u = v++; - i = m || (m = s(e)), n = d.bind(null, i, u, !1), r = d.bind(null, i, u, !0) - } else t.sourceMap && "function" == typeof URL && "function" == typeof URL.createObjectURL && "function" == typeof URL.revokeObjectURL && "function" == typeof Blob && "function" == typeof btoa ? (i = l(e), n = f.bind(null, i, e), r = function () { - o(i), i.href && URL.revokeObjectURL(i.href) - }) : (i = s(e), n = h.bind(null, i), r = function () { - o(i) - }); - return n(t), function (e) { - if (e) { - if (e.css === t.css && e.media === t.media && e.sourceMap === t.sourceMap) return; - n(t = e) - } else r() + + function now() { + if (window.performance && window.performance.now) return performance.now(); + + return Date.now(); } - } - function d(t, e, i, n) { - var r = i ? "" : n.css; - if (t.styleSheet) t.styleSheet.cssText = E(e, r); else { - var a = document.createTextNode(r), o = t.childNodes; - o[e] && t.removeChild(o[e]), o.length ? t.insertBefore(a, o[e]) : t.appendChild(a) +// remove the item from the array if it exists in the array + function removeArrayItem(arr, item) { + var i = arr.indexOf(item); + if (i >= 0) arr.splice(i, 1); } - } - function h(t, e) { - var i = e.css, n = e.media; - if (n && t.setAttribute("media", n), t.styleSheet) t.styleSheet.cssText = i; else { - for (; t.firstChild;) t.removeChild(t.firstChild); - t.appendChild(document.createTextNode(i)) +// find an item regardless of its letter case + function listContainsIgnoreCase(item, items) { + if (item === undefined || items === undefined) return false; + return items.find(function (itemEach) { + return item.toLowerCase() === itemEach.toLowerCase(); + }) !== undefined; } - } - function f(t, e, i) { - var n = i.css, r = i.sourceMap, a = void 0 === e.convertToAbsoluteUrls && r; - (e.convertToAbsoluteUrls || a) && (n = _(n)), r && (n += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(r)))) + " */"); - var o = new Blob([n], {type: "text/css"}), s = t.href; - t.href = URL.createObjectURL(o), s && URL.revokeObjectURL(s) - } +// https://github.com/video-dev/can-autoplay + function canAutoPlayMedia(cb, options) { + options = (0, _assign2.default)({ + inline: false, + muted: false, + timeout: 250, + type: 'video', + source: _media2.default.mp4, + element: null + }, options); - var p = {}, g = function (t) { - var e; - return function () { - return void 0 === e && (e = t.apply(this, arguments)), e - } - }(function () { - return window && document && document.all && !window.atob - }), y = function (t) { - var e = {}; - return function (i) { - if (void 0 === e[i]) { - var n = t.call(this, i); - if (n instanceof window.HTMLIFrameElement) try { - n = n.contentDocument.head - } catch (t) { - n = null - } - e[i] = n - } - return e[i] - } - }(function (t) { - return document.querySelector(t) - }), m = null, v = 0, b = [], _ = i(145); - t.exports = function (t, e) { - if ("undefined" != typeof DEBUG && DEBUG && "object" != typeof document) throw new Error("The style-loader cannot be used in a non-browser environment"); - e = e || {}, e.attrs = "object" == typeof e.attrs ? e.attrs : {}, e.singleton || (e.singleton = g()), e.insertInto || (e.insertInto = "head"), e.insertAt || (e.insertAt = "bottom"); - var i = r(t, e); - return n(i, e), function (t) { - for (var a = [], o = 0; o < i.length; o++) { - var s = i[o], l = p[s.id]; - l.refs--, a.push(l) - } - if (t) { - n(r(t, e), e) - } - for (var o = 0; o < a.length; o++) { - var l = a[o]; - if (0 === l.refs) { - for (var u = 0; u < l.parts.length; u++) l.parts[u](); - delete p[l.id] - } - } - } - }; - var E = function () { - var t = []; - return function (e, i) { - return t[e] = i, t.filter(Boolean).join("\n") - } - }() - }, function (t, e) { - var i = t.exports = {version: "2.4.0"}; - "number" == typeof __e && (__e = i) - }, function (t, e, i) { - var n = i(44)("wks"), r = i(31), a = i(15).Symbol, o = "function" == typeof a; - (t.exports = function (t) { - return n[t] || (n[t] = o && a[t] || (o ? a : r)("Symbol." + t)) - }).store = n - }, function (t, e, i) { - "use strict"; - Object.defineProperty(e, "__esModule", {value: !0}); - var n = {}, r = e.getBrowserInfo = function (t) { - var e = t.match(/\b(playstation 4|nx|opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [], - i = void 0; - if (/trident/i.test(e[1])) return i = /\brv[ :]+(\d+)/g.exec(t) || [], { - name: "IE", - version: parseInt(i[1] || "") - }; - if ("Chrome" === e[1]) { - if (null != (i = t.match(/\bOPR\/(\d+)/))) return {name: "Opera", version: parseInt(i[1])}; - if (null != (i = t.match(/\bEdge\/(\d+)/))) return {name: "Edge", version: parseInt(i[1])} - } else /android/i.test(t) && (i = t.match(/version\/(\d+)/i)) && (e.splice(1, 1, "Android WebView"), e.splice(2, 1, i[1])); - return e = e[2] ? [e[1], e[2]] : [navigator.appName, navigator.appVersion, "-?"], { - name: e[0], - version: parseInt(e[1]) - } - }, a = r(navigator.userAgent); - n.isEdge = /edge/i.test(navigator.userAgent), n.isChrome = /chrome|CriOS/i.test(navigator.userAgent) && !n.isEdge, n.isSafari = /safari/i.test(navigator.userAgent) && !n.isChrome && !n.isEdge, n.isFirefox = /firefox/i.test(navigator.userAgent), n.isLegacyIE = !!window.ActiveXObject, n.isIE = n.isLegacyIE || /trident.*rv:1\d/i.test(navigator.userAgent), n.isIE11 = /trident.*rv:11/i.test(navigator.userAgent), n.isChromecast = n.isChrome && /CrKey/i.test(navigator.userAgent), n.isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone|IEMobile|Mobile Safari|Opera Mini/i.test(navigator.userAgent), n.isiOS = /iPad|iPhone|iPod/i.test(navigator.userAgent), n.isAndroid = /Android/i.test(navigator.userAgent), n.isWindowsPhone = /Windows Phone/i.test(navigator.userAgent), n.isWin8App = /MSAppHost/i.test(navigator.userAgent), n.isWiiU = /WiiU/i.test(navigator.userAgent), n.isPS4 = /PlayStation 4/i.test(navigator.userAgent), n.hasLocalstorage = function () { - try { - return localStorage.setItem("clappr", "clappr"), localStorage.removeItem("clappr"), !0 - } catch (t) { - return !1 - } - }(), n.hasFlash = function () { - try { - return !!new ActiveXObject("ShockwaveFlash.ShockwaveFlash") - } catch (t) { - return !(!navigator.mimeTypes || void 0 === navigator.mimeTypes["application/x-shockwave-flash"] || !navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) - } - }(), n.name = a.name, n.version = a.version, e.default = n - }, function (t, e, i) { - var n = i(97), r = i(40); - t.exports = function (t) { - return n(r(t)) - } - }, function (t, e) { - var i = t.exports = "undefined" != typeof window && window.Math == Math ? window : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(); - "number" == typeof __g && (__g = i) - }, function (t, e, i) { - var n = i(23), r = i(64), a = i(47), o = Object.defineProperty; - e.f = i(20) ? Object.defineProperty : function (t, e, i) { - if (n(t), e = a(e, !0), n(i), r) try { - return o(t, e, i) - } catch (t) { - } - if ("get" in i || "set" in i) throw TypeError("Accessors not supported!"); - return "value" in i && (t[e] = i.value), t - } - }, function (t, e, i) { - "use strict"; + var element = options.element ? options.element : document.createElement(options.type); - function n(t) { - return t && t.__esModule ? t : {default: t} - } + element.muted = options.muted; + if (options.muted === true) element.setAttribute('muted', 'muted'); - Object.defineProperty(e, "__esModule", {value: !0}); - var r = i(0), a = n(r), o = i(1), s = n(o), l = i(3), u = n(l), c = i(2), d = n(c), h = i(5), f = i(4), - p = n(f), g = function (t) { - function e() { - var i = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; - (0, a.default)(this, e); - var n = (0, s.default)(this, t.call(this, i)); - return n._options = i, n.uniqueId = (0, h.uniqueId)("o"), n - } - - return (0, d.default)(e, t), (0, u.default)(e, [{ - key: "options", get: function () { - return this._options - } - }]), e - }(p.default); - e.default = g, t.exports = e.default - }, function (t, e) { - var i = {}.hasOwnProperty; - t.exports = function (t, e) { - return i.call(t, e) - } - }, function (t, e, i) { - var n = i(15), r = i(11), a = i(46), o = i(22), s = function (t, e, i) { - var l, u, c, d = t & s.F, h = t & s.G, f = t & s.S, p = t & s.P, g = t & s.B, y = t & s.W, - m = h ? r : r[e] || (r[e] = {}), v = m.prototype, b = h ? n : f ? n[e] : (n[e] || {}).prototype; - h && (i = e); - for (l in i) (u = !d && b && void 0 !== b[l]) && l in m || (c = u ? b[l] : i[l], m[l] = h && "function" != typeof b[l] ? i[l] : g && u ? a(c, n) : y && b[l] == c ? function (t) { - var e = function (e, i, n) { - if (this instanceof t) { - switch (arguments.length) { - case 0: - return new t; - case 1: - return new t(e); - case 2: - return new t(e, i) - } - return new t(e, i, n) - } - return t.apply(this, arguments) + if (options.inline === true) element.setAttribute('playsinline', 'playsinline'); + + element.src = options.source; + + var promise = element.play(); + + var timeoutId = setTimeout(function () { + setResult(false, new Error('Timeout ' + options.timeout + ' ms has been reached')); + }, options.timeout); + + var setResult = function setResult(result) { + var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + + clearTimeout(timeoutId); + cb(result, error); }; - return e.prototype = t.prototype, e - }(c) : p && "function" == typeof c ? a(Function.call, c) : c, p && ((m.virtual || (m.virtual = {}))[l] = c, t & s.R && v && !v[l] && o(v, l, c))) - }; - s.F = 1, s.G = 2, s.S = 4, s.P = 8, s.B = 16, s.W = 32, s.U = 64, s.R = 128, t.exports = s - }, function (t, e, i) { - t.exports = !i(27)(function () { - return 7 != Object.defineProperty({}, "a", { - get: function () { - return 7 + + if (promise !== undefined) { + promise.then(function () { + return setResult(true); + }).catch(function (err) { + return setResult(false, err); + }); + } else { + setResult(true); } - }).a - }) - }, function (t, e, i) { - "use strict"; + } - function n(t) { - return t && t.__esModule ? t : {default: t} - } +// Simple Zepto element factory with video recycle feature. + var videoStack = []; - Object.defineProperty(e, "__esModule", {value: !0}); - var r = i(0), a = n(r), o = i(1), s = n(o), l = i(3), u = n(l), c = i(2), d = n(c), h = i(6), f = n(h), - p = i(5), g = i(17), y = n(g), m = /^(\S+)\s*(.*)$/, v = function (t) { - function e(i) { - (0, a.default)(this, e); - var n = (0, s.default)(this, t.call(this, i)); - return n.cid = (0, p.uniqueId)("c"), n._ensureElement(), n.delegateEvents(), n + var DomRecycler = exports.DomRecycler = function () { + function DomRecycler() { + (0, _classCallCheck3.default)(this, DomRecycler); } - return (0, d.default)(e, t), (0, u.default)(e, [{ - key: "tagName", get: function () { - return "div" - } - }, { - key: "events", get: function () { - return {} - } - }, { - key: "attributes", get: function () { - return {} - } - }]), e.prototype.$ = function (t) { - return this.$el.find(t) - }, e.prototype.render = function () { - return this - }, e.prototype.remove = function () { - return this.$el.remove(), this.stopListening(), this.undelegateEvents(), this - }, e.prototype.setElement = function (t, e) { - return this.$el && this.undelegateEvents(), this.$el = f.default.zepto.isZ(t) ? t : (0, f.default)(t), this.el = this.$el[0], !1 !== e && this.delegateEvents(), this - }, e.prototype.delegateEvents = function (t) { - if (!t && !(t = this.events)) return this; - this.undelegateEvents(); - for (var e in t) { - var i = t[e]; - if (i && i.constructor !== Function && (i = this[t[e]]), i) { - var n = e.match(m), r = n[1], a = n[2]; - r += ".delegateEvents" + this.cid, "" === a ? this.$el.on(r, i.bind(this)) : this.$el.on(r, a, i.bind(this)) - } - } - return this - }, e.prototype.undelegateEvents = function () { - return this.$el.off(".delegateEvents" + this.cid), this - }, e.prototype._ensureElement = function () { - if (this.el) this.setElement(this.el, !1); else { - var t = f.default.extend({}, this.attributes); - this.id && (t.id = this.id), this.className && (t.class = this.className); - var e = p.DomRecycler.create(this.tagName).attr(t); - this.setElement(e, !1) - } - }, e - }(y.default); - e.default = v, t.exports = e.default - }, function (t, e, i) { - var n = i(16), r = i(28); - t.exports = i(20) ? function (t, e, i) { - return n.f(t, e, r(1, i)) - } : function (t, e, i) { - return t[e] = i, t - } - }, function (t, e, i) { - var n = i(26); - t.exports = function (t) { - if (!n(t)) throw TypeError(t + " is not an object!"); - return t - } - }, function (t, e, i) { - "use strict"; + DomRecycler.configure = function configure(options) { + this.options = _clapprZepto2.default.extend(this.options, options); + }; - function n(t) { - return t && t.__esModule ? t : {default: t} - } + DomRecycler.create = function create(name) { + if (this.options.recycleVideo && name === 'video' && videoStack.length > 0) return videoStack.shift(); - Object.defineProperty(e, "__esModule", {value: !0}); - var r = i(0), a = n(r), o = i(4), s = n(o), l = new s.default, u = function t() { - (0, a.default)(this, t) - }; - e.default = u, u.on = function (t, e, i) { - l.on(t, e, i) - }, u.once = function (t, e, i) { - l.once(t, e, i) - }, u.off = function (t, e, i) { - l.off(t, e, i) - }, u.trigger = function (t) { - for (var e = arguments.length, i = Array(e > 1 ? e - 1 : 0), n = 1; n < e; n++) i[n - 1] = arguments[n]; - l.trigger.apply(l, [t].concat(i)) - }, u.stopListening = function (t, e, i) { - l.stopListening(t, e, i) - }, t.exports = e.default - }, function (t, e, i) { - var n = i(61), r = i(45); - t.exports = Object.keys || function (t) { - return n(t, r) - } - }, function (t, e) { - t.exports = function (t) { - return "object" == typeof t ? null !== t : "function" == typeof t - } - }, function (t, e) { - t.exports = function (t) { - try { - return !!t() - } catch (t) { - return !0 - } - } - }, function (t, e) { - t.exports = function (t, e) { - return {enumerable: !(1 & t), configurable: !(2 & t), writable: !(4 & t), value: e} - } - }, function (t, e) { - t.exports = {} - }, function (t, e, i) { - "use strict"; + return (0, _clapprZepto2.default)('<' + name + '>'); + }; - function n(t) { - return t && t.__esModule ? t : {default: t} - } + DomRecycler.garbage = function garbage($el) { + // Expect Zepto collection with single element (does not iterate!) + if (!this.options.recycleVideo || $el[0].tagName.toUpperCase() !== 'VIDEO') return; + $el.children().remove(); + videoStack.push($el); + }; - Object.defineProperty(e, "__esModule", {value: !0}); - var r = i(0), a = n(r), o = i(1), s = n(o), l = i(2), u = n(l), c = i(5), d = i(17), h = n(d), - f = function (t) { - function e(i) { - (0, a.default)(this, e); - var n = (0, s.default)(this, t.call(this, i.options)); - return n.core = i, n.enabled = !0, n.bindEvents(), n - } - - return (0, u.default)(e, t), e.prototype.bindEvents = function () { - }, e.prototype.enable = function () { - this.enabled || (this.bindEvents(), this.enabled = !0) - }, e.prototype.disable = function () { - this.enabled && (this.stopListening(), this.enabled = !1) - }, e.prototype.getExternalInterface = function () { - return {} - }, e.prototype.destroy = function () { - this.stopListening() - }, e - }(h.default); - e.default = f, f.extend = function (t) { - return (0, c.extend)(f, t) - }, f.type = "core", t.exports = e.default - }, function (t, e) { - var i = 0, n = Math.random(); - t.exports = function (t) { - return "Symbol(".concat(void 0 === t ? "" : t, ")_", (++i + n).toString(36)) - } - }, function (t, e, i) { - "use strict"; + return DomRecycler; + }(); - function n(t) { - return t && t.__esModule ? t : {default: t} - } + DomRecycler.options = { recycleVideo: false }; + + exports.default = { + Config: Config, + Fullscreen: Fullscreen, + QueryString: QueryString, + DomRecycler: DomRecycler, + extend: extend, + formatTime: formatTime, + seekStringToSeconds: seekStringToSeconds, + uniqueId: uniqueId, + currentScriptUrl: currentScriptUrl, + isNumber: isNumber, + requestAnimationFrame: requestAnimationFrame, + cancelAnimationFrame: cancelAnimationFrame, + getBrowserLanguage: getBrowserLanguage, + now: now, + removeArrayItem: removeArrayItem, + canAutoPlayMedia: canAutoPlayMedia, + Media: _media2.default + }; - e.__esModule = !0; - var r = i(101), a = n(r), o = i(112), s = n(o), - l = "function" == typeof s.default && "symbol" == typeof a.default ? function (t) { - return typeof t - } : function (t) { - return t && "function" == typeof s.default && t.constructor === s.default && t !== s.default.prototype ? "symbol" : typeof t - }; - e.default = "function" == typeof s.default && "symbol" === l(a.default) ? function (t) { - return void 0 === t ? "undefined" : l(t) - } : function (t) { - return t && "function" == typeof s.default && t.constructor === s.default && t !== s.default.prototype ? "symbol" : void 0 === t ? "undefined" : l(t) - } - }, function (t, e, i) { - "use strict"; - Object.defineProperty(e, "__esModule", {value: !0}); - var n = i(0), r = function (t) { - return t && t.__esModule ? t : {default: t} - }(n), a = function t() { - (0, r.default)(this, t), this.options = {}, this.playbackPlugins = [], this.currentSize = { - width: 0, - height: 0 - } - }; - a._players = {}, a.getInstance = function (t) { - return a._players[t] || (a._players[t] = new a) - }, e.default = a, t.exports = e.default - }, function (t, e, i) { - "use strict"; - Object.defineProperty(e, "__esModule", {value: !0}); - var n = i(171), r = function (t) { - return t && t.__esModule ? t : {default: t} - }(n); - e.default = r.default, t.exports = e.default - }, function (t, e, i) { - "use strict"; - - function n(t) { - return t && t.__esModule ? t : {default: t} - } + /***/ }), + /* 6 */ + /***/ (function(module, exports) { + + /* 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') + }, + 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 } + + 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 + } - Object.defineProperty(e, "__esModule", {value: !0}); - var r = i(0), a = n(r), o = i(1), s = n(o), l = i(2), u = n(l), c = i(5), d = i(21), h = n(d), - f = function (t) { - function e(i) { - (0, a.default)(this, e); - var n = (0, s.default)(this, t.call(this, i.options)); - return n.container = i, n.enabled = !0, n.bindEvents(), n - } - - return (0, u.default)(e, t), e.prototype.enable = function () { - this.enabled || (this.bindEvents(), this.$el.show(), this.enabled = !0) - }, e.prototype.disable = function () { - this.stopListening(), this.$el.hide(), this.enabled = !1 - }, e.prototype.bindEvents = function () { - }, e.prototype.destroy = function () { - this.remove() - }, e - }(h.default); - e.default = f, f.extend = function (t) { - return (0, c.extend)(f, t) - }, f.type = "container", t.exports = e.default - }, function (t, e, i) { - "use strict"; - - function n(t) { - return t && t.__esModule ? t : {default: t} - } + function type(obj) { + return obj == null ? String(obj) : + class2type[toString.call(obj)] || "object" + } - Object.defineProperty(e, "__esModule", {value: !0}); - var r = i(0), a = n(r), o = i(1), s = n(o), l = i(2), u = n(l), c = i(17), d = n(c), h = i(5), - f = function (t) { - function e(i) { - (0, a.default)(this, e); - var n = (0, s.default)(this, t.call(this, i.options)); - return n.container = i, n.enabled = !0, n.bindEvents(), n - } - - return (0, u.default)(e, t), e.prototype.enable = function () { - this.enabled || (this.bindEvents(), this.enabled = !0) - }, e.prototype.disable = function () { - this.enabled && (this.stopListening(), this.enabled = !1) - }, e.prototype.bindEvents = function () { - }, e.prototype.destroy = function () { - this.stopListening() - }, e - }(d.default); - e.default = f, f.extend = function (t) { - return (0, h.extend)(f, t) - }, f.type = "container", t.exports = e.default - }, function (t, e, i) { - "use strict"; - - function n(t) { - return t && t.__esModule ? t : {default: t} - } + 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 + } - Object.defineProperty(e, "__esModule", {value: !0}); - var r = i(0), a = n(r), o = i(1), s = n(o), l = i(2), u = n(l), c = i(5), d = i(21), h = n(d), - f = function (t) { - function e(i) { - (0, a.default)(this, e); - var n = (0, s.default)(this, t.call(this, i.options)); - return n.core = i, n.enabled = !0, n.bindEvents(), n.render(), n - } - - return (0, u.default)(e, t), e.prototype.bindEvents = function () { - }, e.prototype.getExternalInterface = function () { - return {} - }, e.prototype.enable = function () { - this.enabled || (this.bindEvents(), this.$el.show(), this.enabled = !0) - }, e.prototype.disable = function () { - this.stopListening(), this.$el.hide(), this.enabled = !1 - }, e.prototype.destroy = function () { - this.remove() - }, e.prototype.render = function () { - return this - }, e - }(h.default); - e.default = f, f.extend = function (t) { - return (0, c.extend)(f, t) - }, f.type = "core", t.exports = e.default - }, function (t, e, i) { - t.exports = {default: i(95), __esModule: !0} - }, function (t, e, i) { - var n = i(40); - t.exports = function (t) { - return Object(n(t)) - } - }, function (t, e) { - t.exports = function (t) { - if (void 0 == t) throw TypeError("Can't call method on " + t); - return t - } - }, function (t, e) { - var i = {}.toString; - t.exports = function (t) { - return i.call(t).slice(8, -1) - } - }, function (t, e) { - var i = Math.ceil, n = Math.floor; - t.exports = function (t) { - return isNaN(t = +t) ? 0 : (t > 0 ? n : i)(t) - } - }, function (t, e, i) { - var n = i(44)("keys"), r = i(31); - t.exports = function (t) { - return n[t] || (n[t] = r(t)) - } - }, function (t, e, i) { - var n = i(15), r = n["__core-js_shared__"] || (n["__core-js_shared__"] = {}); - t.exports = function (t) { - return r[t] || (r[t] = {}) - } - }, function (t, e) { - t.exports = "constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",") - }, function (t, e, i) { - var n = i(100); - t.exports = function (t, e, i) { - if (n(t), void 0 === e) return t; - switch (i) { - case 1: - return function (i) { - return t.call(e, i) - }; - case 2: - return function (i, n) { - return t.call(e, i, n) - }; - case 3: - return function (i, n, r) { - return t.call(e, i, n, r) - } - } - return function () { - return t.apply(e, arguments) - } - } - }, function (t, e, i) { - var n = i(26); - t.exports = function (t, e) { - if (!n(t)) return t; - var i, r; - if (e && "function" == typeof(i = t.toString) && !n(r = i.call(t))) return r; - if ("function" == typeof(i = t.valueOf) && !n(r = i.call(t))) return r; - if (!e && "function" == typeof(i = t.toString) && !n(r = i.call(t))) return r; - throw TypeError("Can't convert object to primitive value") - } - }, function (t, e) { - t.exports = !0 - }, function (t, e, i) { - var n = i(23), r = i(105), a = i(45), o = i(43)("IE_PROTO"), s = function () { - }, l = function () { - var t, e = i(65)("iframe"), n = a.length; - for (e.style.display = "none", i(106).appendChild(e), e.src = "javascript:", t = e.contentWindow.document, t.open(), t.write(" + * + * ``` + * Now, create the player: + * ```html + * + *
+ * + * + * ``` + */ +// 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 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; + } + + /** + * Determine if the playback has ended. + * @property ended + * @type Boolean + */ + + }, { + key: 'ended', + get: function get() { + return this.core.activeContainer.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 + */ + + }, { + key: 'buffering', + get: function get() { + return this.core.activeContainer.buffering; + } + + /* + * 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; + } + + /** + * 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, + onSubtitleAvailable: _events2.default.PLAYER_SUBTITLE_AVAILABLE + }; + } + + /** + * @typedef {Object} PlaybackConfig + * @prop {boolean} disableContextMenu + * disables the context menu (right click) on the video element if a HTML5Video playback is used. + * @prop {boolean} preload + * video will be preloaded according to `preload` attribute options **default**: `'metadata'` + * @prop {boolean} controls + * enabled/disables displaying controls + * @prop {boolean} crossOrigin + * enables cross-origin capability for media-resources + * @prop {boolean} playInline + * enables in-line video elements + * @prop {boolean} audioOnly + * enforce audio-only playback (when possible) + * @prop {Object} externalTracks + * pass externaly loaded track to playback + * @prop {Number} [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**. + * @prop {Number} [maxBackBufferLength] + * After how much distance of the playhead data should be pruned from the buffer (influences memory consumption + * of adaptive media-engines like Hls.js or Shaka) + * @prop {Number} [minBufferLength] + * After how much data in the buffer at least we attempt to consume it (influences QoS-related behavior + * of adaptive media-engines like Hls.js or Shaka). If this is too low, and the available bandwidth is varying a lot + * and too close to the streamed bitrate, we may continuously hit under-runs. + * @prop {Number} [initialBandwidthEstimate] + * define an initial bandwidth "guess" (or previously stored/established value) for underlying adaptive-bitreate engines + * of adaptive playback implementations, like Hls.js or Shaka + * @prop {Number} [maxAdaptiveBitrate] + * Limits the streamed bitrate (for adaptive media-engines in underlying playback implementations) + * @prop {Object} [maxAdaptiveVideoDimensions] + * Limits the video dimensions in adaptive media-engines. Should be a literal object with `height` and `width`. + * @prop {Boolean}[enableAutomaticABR] **default**: `true` + * Allows to enable/disable automatic bitrate switching in adaptive media-engines + * @prop {String} [preferredTextLanguage] **default**: `'pt-BR'` + * Allows to set a preferred text language, that may be enabled by the media-engine if available. + * @prop {String} [preferredAudioLanguage] **default**: `'pt-BR'` + * Allows to set a preferred audio language, that may be enabled by the media-engine if available. + */ + + /** + * ## 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.mute] + * 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 {Boolean} [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] @deprecated + * video will be preloaded according to `preload` attribute options **default**: `'metadata'` + * @param {Number} [options.maxBufferLength] @deprecated + * 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] @deprecated + * 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" + * @param {PlaybackConfig} [options.playback] + * Generic `Playback` component related configuration + * @param {Boolean} [options.disableErrorScreen] + * disables the error screen plugin. + * @param {Number} [options.autoPlayTimeout] + * autoplay check timeout. + */ + + }]); + + function Player(options) { + (0, _classCallCheck3.default)(this, Player); + + var _this = (0, _possibleConstructorReturn3.default)(this, _BaseObject.call(this, options)); + + var playbackDefaultOptions = { recycleVideo: true }; + var defaultOptions = { + playerId: (0, _utils.uniqueId)(''), + persistConfig: true, + width: 640, + height: 360, + baseUrl: baseUrl, + allowUserInteraction: _browser2.default.isMobile, + playback: playbackDefaultOptions + }; + _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.options.events); + _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; + } + + /** + * Specify a `parentId` to the player. + * @method setParentId + * @param {String} parentId the element parent id. + * @return {Player} itself + */ + + + Player.prototype.setParentId = function setParentId(parentId) { + var el = document.querySelector(parentId); + if (el) this.attachTo(el); + + return this; + }; + + /** + * 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.attachTo = function attachTo(element) { + this.options.parentElement = element; + this.core = this._coreFactory.create(); + this._addEventListeners(); + return this; + }; + + 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.activeContainer, _events2.default.CORE_ACTIVE_CONTAINER_CHANGED, this._containerChanged); + this.listenTo(this.core, _events2.default.CORE_FULLSCREEN, this._onFullscreenChange); + this.listenTo(this.core, _events2.default.CORE_RESIZE, this._onResize); + return this; + }; + + Player.prototype._addContainerEventListeners = function _addContainerEventListeners() { + var container = this.core.activeContainer; + 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_SUBTITLE_AVAILABLE, this._onSubtitleAvailable); + } + return this; + }; + + Player.prototype._registerOptionEventListeners = function _registerOptionEventListeners() { + var _this2 = this; + + var newEvents = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + var hasNewEvents = (0, _keys2.default)(newEvents).length > 0; + hasNewEvents && (0, _keys2.default)(events).forEach(function (userEvent) { + var eventType = _this2.eventsMapping[userEvent]; + eventType && _this2.off(eventType, events[userEvent]); + }); + + (0, _keys2.default)(newEvents).forEach(function (userEvent) { + var eventType = _this2.eventsMapping[userEvent]; + if (eventType) { + var eventFunction = newEvents[userEvent]; + eventFunction = typeof eventFunction === 'function' && eventFunction; + eventFunction && _this2.on(eventType, eventFunction); + } + }); + return this; + }; + + Player.prototype._containerChanged = function _containerChanged() { + this.stopListening(); + this._addEventListeners(); + }; + + Player.prototype._onReady = function _onReady() { + this._ready = true; + this._addContainerEventListeners(); + this.trigger(_events2.default.PLAYER_READY); + }; + + Player.prototype._onFullscreenChange = function _onFullscreenChange(fullscreen) { + this.trigger(_events2.default.PLAYER_FULLSCREEN, fullscreen); + }; + + Player.prototype._onVolumeUpdate = function _onVolumeUpdate(volume) { + this.trigger(_events2.default.PLAYER_VOLUMEUPDATE, volume); + }; + + Player.prototype._onSubtitleAvailable = function _onSubtitleAvailable() { + this.trigger(_events2.default.PLAYER_SUBTITLE_AVAILABLE); + }; + + Player.prototype._onResize = function _onResize(size) { + this.trigger(_events2.default.PLAYER_RESIZE, size); + }; + + Player.prototype._onPlay = function _onPlay() { + this.trigger(_events2.default.PLAYER_PLAY); + }; + + Player.prototype._onPause = function _onPause() { + this.trigger(_events2.default.PLAYER_PAUSE); + }; + + Player.prototype._onStop = function _onStop() { + this.trigger(_events2.default.PLAYER_STOP, this.getCurrentTime()); + }; + + Player.prototype._onEnded = function _onEnded() { + this.trigger(_events2.default.PLAYER_ENDED); + }; + + Player.prototype._onSeek = function _onSeek(time) { + this.trigger(_events2.default.PLAYER_SEEK, time); + }; + + Player.prototype._onTimeUpdate = function _onTimeUpdate(timeProgress) { + this.trigger(_events2.default.PLAYER_TIMEUPDATE, timeProgress); + }; + + Player.prototype._onError = function _onError(error) { + this.trigger(_events2.default.PLAYER_ERROR, error); + }; + + Player.prototype._normalizeSources = function _normalizeSources(options) { + var sources = options.sources || (options.source !== undefined ? [options.source] : []); + return sources.length === 0 ? [{ source: '', mimeType: '' }] : sources; + }; + + /** + * 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}) + * ``` + */ + + + Player.prototype.resize = function resize(size) { + this.core.resize(size); + return this; + }; + + /** + * 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 + */ + + + Player.prototype.load = function load(sources, mimeType, autoPlay) { + if (autoPlay !== undefined) this.configure({ autoPlay: !!autoPlay }); + + this.core.load(sources, mimeType); + return this; + }; + + /** + * destroys the current player and removes it from the DOM. + * @method destroy + * @return {Player} itself + */ + + + Player.prototype.destroy = function destroy() { + this.stopListening(); + this.core.destroy(); + return this; + }; + + /** + * Gives user consent to playback. Required by mobile device after a click event before Player.load(). + * @method consent + * @return {Player} itself + */ + + + Player.prototype.consent = function consent() { + this.core.getCurrentPlayback().consent(); + return this; + }; + + /** + * plays the current video (`source`). + * @method play + * @return {Player} itself + */ + + + Player.prototype.play = function play() { + this.core.activeContainer.play(); + return this; + }; + + /** + * pauses the current video (`source`). + * @method pause + * @return {Player} itself + */ + + + Player.prototype.pause = function pause() { + this.core.activeContainer.pause(); + return this; + }; + + /** + * stops the current video (`source`). + * @method stop + * @return {Player} itself + */ + + + Player.prototype.stop = function stop() { + this.core.activeContainer.stop(); + return this; + }; + + /** + * 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 + */ + + + Player.prototype.seek = function seek(time) { + this.core.activeContainer.seek(time); + return this; + }; + + /** + * 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 + */ + + + Player.prototype.seekPercentage = function seekPercentage(percentage) { + this.core.activeContainer.seekPercentage(percentage); + return this; + }; + + /** + * mutes the current video (`source`). + * @method mute + * @return {Player} itself + */ + + + Player.prototype.mute = function mute() { + this._mutedVolume = this.getVolume(); + this.setVolume(0); + return this; + }; + + /** + * unmutes the current video (`source`). + * @method unmute + * @return {Player} itself + */ + + + Player.prototype.unmute = function unmute() { + this.setVolume(typeof this._mutedVolume === 'number' ? this._mutedVolume : 100); + this._mutedVolume = null; + return this; + }; + + /** + * checks if the player is playing. + * @method isPlaying + * @return {Boolean} `true` if the current source is playing, otherwise `false` + */ + + + Player.prototype.isPlaying = function isPlaying() { + return this.core.activeContainer.isPlaying(); + }; + + /** + * returns `true` if DVR is enable otherwise `false`. + * @method isDvrEnabled + * @return {Boolean} + */ + + + Player.prototype.isDvrEnabled = function isDvrEnabled() { + return this.core.activeContainer.isDvrEnabled(); + }; + + /** + * returns `true` if DVR is in use otherwise `false`. + * @method isDvrInUse + * @return {Boolean} + */ + + + Player.prototype.isDvrInUse = function isDvrInUse() { + return this.core.activeContainer.isDvrInUse(); + }; + + /** + * 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 + */ + + + Player.prototype.configure = function configure() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + this._registerOptionEventListeners(options.events, this.options.events); + this.core.configure(options); + return this; + }; + + /** + * 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(); + * ``` + */ + + + Player.prototype.getPlugin = function getPlugin(name) { + var plugins = this.core.plugins.concat(this.core.activeContainer.plugins); + return plugins.filter(function (plugin) { + return plugin.name === name; + })[0]; + }; + + /** + * the current time in seconds. + * @method getCurrentTime + * @return {Number} current time (in seconds) of the current source + */ + + + Player.prototype.getCurrentTime = function getCurrentTime() { + return this.core.activeContainer.getCurrentTime(); + }; + + /** + * 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. + */ + + + Player.prototype.getStartTimeOffset = function getStartTimeOffset() { + return this.core.activeContainer.getStartTimeOffset(); + }; + + /** + * the duration time in seconds. + * @method getDuration + * @return {Number} duration time (in seconds) of the current source + */ + + + Player.prototype.getDuration = function getDuration() { + return this.core.activeContainer.getDuration(); + }; + + return Player; + }(_base_object2.default); + + exports.default = Player; + + + (0, _assign2.default)(Player.prototype, _error_mixin2.default); + module.exports = exports['default']; + + /***/ }), + /* 102 */ + /***/ (function(module, exports, __webpack_require__) { + + __webpack_require__(103); + module.exports = __webpack_require__(11).Object.assign; + + /***/ }), + /* 103 */ + /***/ (function(module, exports, __webpack_require__) { + +// 19.1.3.1 Object.assign(target, source) + var $export = __webpack_require__(16); + + $export($export.S + $export.F, 'Object', {assign: __webpack_require__(105)}); + + /***/ }), + /* 104 */ + /***/ (function(module, exports) { + + module.exports = function(it){ + if(typeof it != 'function')throw TypeError(it + ' is not a function!'); + return it; + }; + + /***/ }), + /* 105 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + +// 19.1.2.1 Object.assign(target, source, ...) + var getKeys = __webpack_require__(28) + , gOPS = __webpack_require__(52) + , pIE = __webpack_require__(37) + , toObject = __webpack_require__(38) + , IObject = __webpack_require__(68) + , $assign = Object.assign; + +// should work with symbols and should have deterministic property order (V8 bug) + module.exports = !$assign || __webpack_require__(27)(function(){ + var A = {} + , B = {} + , S = Symbol() + , K = 'abcdefghijklmnopqrst'; + A[S] = 7; + K.split('').forEach(function(k){ B[k] = k; }); + return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; + }) ? function assign(target, source){ // eslint-disable-line no-unused-vars + var T = toObject(target) + , aLen = arguments.length + , index = 1 + , getSymbols = gOPS.f + , isEnum = pIE.f; + while(aLen > index){ + var S = IObject(arguments[index++]) + , keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S) + , length = keys.length + , j = 0 + , key; + while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key]; + } return T; + } : $assign; + + /***/ }), + /* 106 */ + /***/ (function(module, exports, __webpack_require__) { + +// false -> Array#indexOf +// true -> Array#includes + var toIObject = __webpack_require__(19) + , toLength = __webpack_require__(69) + , toIndex = __webpack_require__(107); + module.exports = function(IS_INCLUDES){ + return function($this, el, fromIndex){ + var O = toIObject($this) + , length = toLength(O.length) + , index = toIndex(fromIndex, length) + , value; + // Array#includes uses SameValueZero equality algorithm + if(IS_INCLUDES && el != el)while(length > index){ + value = O[index++]; + if(value != value)return true; + // Array#toIndex ignores holes, Array#includes - not + } else for(;length > index; index++)if(IS_INCLUDES || index in O){ + if(O[index] === el)return IS_INCLUDES || index || 0; + } return !IS_INCLUDES && -1; + }; + }; + + /***/ }), + /* 107 */ + /***/ (function(module, exports, __webpack_require__) { + + var toInteger = __webpack_require__(48) + , max = Math.max + , min = Math.min; + module.exports = function(index, length){ + index = toInteger(index); + return index < 0 ? max(index + length, 0) : min(index, length); + }; + + /***/ }), + /* 108 */ + /***/ (function(module, exports, __webpack_require__) { + + __webpack_require__(109); + module.exports = __webpack_require__(11).Object.keys; + + /***/ }), + /* 109 */ + /***/ (function(module, exports, __webpack_require__) { + +// 19.1.2.14 Object.keys(O) + var toObject = __webpack_require__(38) + , $keys = __webpack_require__(28); + + __webpack_require__(70)('keys', function(){ + return function keys(it){ + return $keys(toObject(it)); + }; + }); + + /***/ }), + /* 110 */ + /***/ (function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(111), __esModule: true }; + + /***/ }), + /* 111 */ + /***/ (function(module, exports, __webpack_require__) { + + __webpack_require__(71); + __webpack_require__(117); + module.exports = __webpack_require__(57).f('iterator'); + + /***/ }), + /* 112 */ + /***/ (function(module, exports, __webpack_require__) { + + var toInteger = __webpack_require__(48) + , defined = __webpack_require__(47); +// true -> String#at +// false -> String#codePointAt + module.exports = function(TO_STRING){ + return function(that, pos){ + var s = String(defined(that)) + , i = toInteger(pos) + , l = s.length + , a, b; + if(i < 0 || i >= l)return TO_STRING ? '' : undefined; + a = s.charCodeAt(i); + return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff + ? TO_STRING ? s.charAt(i) : a + : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; + }; + }; + + /***/ }), + /* 113 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var create = __webpack_require__(55) + , descriptor = __webpack_require__(33) + , setToStringTag = __webpack_require__(56) + , IteratorPrototype = {}; + +// 25.1.2.1.1 %IteratorPrototype%[@@iterator]() + __webpack_require__(25)(IteratorPrototype, __webpack_require__(13)('iterator'), function(){ return this; }); + + module.exports = function(Constructor, NAME, next){ + Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)}); + setToStringTag(Constructor, NAME + ' Iterator'); + }; + + /***/ }), + /* 114 */ + /***/ (function(module, exports, __webpack_require__) { + + var dP = __webpack_require__(18) + , anObject = __webpack_require__(26) + , getKeys = __webpack_require__(28); + + module.exports = __webpack_require__(21) ? Object.defineProperties : function defineProperties(O, Properties){ + anObject(O); + var keys = getKeys(Properties) + , length = keys.length + , i = 0 + , P; + while(length > i)dP.f(O, P = keys[i++], Properties[P]); + return O; + }; + + /***/ }), + /* 115 */ + /***/ (function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(17).document && document.documentElement; + + /***/ }), + /* 116 */ + /***/ (function(module, exports, __webpack_require__) { + +// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) + var has = __webpack_require__(22) + , toObject = __webpack_require__(38) + , IE_PROTO = __webpack_require__(49)('IE_PROTO') + , ObjectProto = Object.prototype; + + module.exports = Object.getPrototypeOf || function(O){ + O = toObject(O); + if(has(O, IE_PROTO))return O[IE_PROTO]; + if(typeof O.constructor == 'function' && O instanceof O.constructor){ + return O.constructor.prototype; + } return O instanceof Object ? ObjectProto : null; + }; + + /***/ }), + /* 117 */ + /***/ (function(module, exports, __webpack_require__) { + + __webpack_require__(118); + var global = __webpack_require__(17) + , hide = __webpack_require__(25) + , Iterators = __webpack_require__(34) + , TO_STRING_TAG = __webpack_require__(13)('toStringTag'); + + for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){ + var NAME = collections[i] + , Collection = global[NAME] + , proto = Collection && Collection.prototype; + if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME); + Iterators[NAME] = Iterators.Array; + } + + /***/ }), + /* 118 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var addToUnscopables = __webpack_require__(119) + , step = __webpack_require__(120) + , Iterators = __webpack_require__(34) + , toIObject = __webpack_require__(19); + +// 22.1.3.4 Array.prototype.entries() +// 22.1.3.13 Array.prototype.keys() +// 22.1.3.29 Array.prototype.values() +// 22.1.3.30 Array.prototype[@@iterator]() + module.exports = __webpack_require__(72)(Array, 'Array', function(iterated, kind){ + this._t = toIObject(iterated); // target + this._i = 0; // next index + this._k = kind; // kind +// 22.1.5.2.1 %ArrayIteratorPrototype%.next() + }, function(){ + var O = this._t + , kind = this._k + , index = this._i++; + if(!O || index >= O.length){ + this._t = undefined; + return step(1); + } + if(kind == 'keys' )return step(0, index); + if(kind == 'values')return step(0, O[index]); + return step(0, [index, O[index]]); + }, 'values'); + +// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) + Iterators.Arguments = Iterators.Array; + + addToUnscopables('keys'); + addToUnscopables('values'); + addToUnscopables('entries'); + + /***/ }), + /* 119 */ + /***/ (function(module, exports) { + + module.exports = function(){ /* empty */ }; + + /***/ }), + /* 120 */ + /***/ (function(module, exports) { + + module.exports = function(done, value){ + return {value: value, done: !!done}; + }; + + /***/ }), + /* 121 */ + /***/ (function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(122), __esModule: true }; + + /***/ }), + /* 122 */ + /***/ (function(module, exports, __webpack_require__) { + + __webpack_require__(123); + __webpack_require__(129); + __webpack_require__(130); + __webpack_require__(131); + module.exports = __webpack_require__(11).Symbol; + + /***/ }), + /* 123 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + +// ECMAScript 6 symbols shim + var global = __webpack_require__(17) + , has = __webpack_require__(22) + , DESCRIPTORS = __webpack_require__(21) + , $export = __webpack_require__(16) + , redefine = __webpack_require__(73) + , META = __webpack_require__(124).KEY + , $fails = __webpack_require__(27) + , shared = __webpack_require__(50) + , setToStringTag = __webpack_require__(56) + , uid = __webpack_require__(36) + , wks = __webpack_require__(13) + , wksExt = __webpack_require__(57) + , wksDefine = __webpack_require__(58) + , keyOf = __webpack_require__(125) + , enumKeys = __webpack_require__(126) + , isArray = __webpack_require__(127) + , anObject = __webpack_require__(26) + , toIObject = __webpack_require__(19) + , toPrimitive = __webpack_require__(45) + , createDesc = __webpack_require__(33) + , _create = __webpack_require__(55) + , gOPNExt = __webpack_require__(128) + , $GOPD = __webpack_require__(59) + , $DP = __webpack_require__(18) + , $keys = __webpack_require__(28) + , gOPD = $GOPD.f + , dP = $DP.f + , gOPN = gOPNExt.f + , $Symbol = global.Symbol + , $JSON = global.JSON + , _stringify = $JSON && $JSON.stringify + , PROTOTYPE = 'prototype' + , HIDDEN = wks('_hidden') + , TO_PRIMITIVE = wks('toPrimitive') + , isEnum = {}.propertyIsEnumerable + , SymbolRegistry = shared('symbol-registry') + , AllSymbols = shared('symbols') + , OPSymbols = shared('op-symbols') + , ObjectProto = Object[PROTOTYPE] + , USE_NATIVE = typeof $Symbol == 'function' + , QObject = global.QObject; +// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 + var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; + +// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 + var setSymbolDesc = DESCRIPTORS && $fails(function(){ + return _create(dP({}, 'a', { + get: function(){ return dP(this, 'a', {value: 7}).a; } + })).a != 7; + }) ? function(it, key, D){ + var protoDesc = gOPD(ObjectProto, key); + if(protoDesc)delete ObjectProto[key]; + dP(it, key, D); + if(protoDesc && it !== ObjectProto)dP(ObjectProto, key, protoDesc); + } : dP; + + var wrap = function(tag){ + var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]); + sym._k = tag; + return sym; + }; + + var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function(it){ + return typeof it == 'symbol'; + } : function(it){ + return it instanceof $Symbol; + }; + + var $defineProperty = function defineProperty(it, key, D){ + if(it === ObjectProto)$defineProperty(OPSymbols, key, D); + anObject(it); + key = toPrimitive(key, true); + anObject(D); + if(has(AllSymbols, key)){ + if(!D.enumerable){ + if(!has(it, HIDDEN))dP(it, HIDDEN, createDesc(1, {})); + it[HIDDEN][key] = true; + } else { + if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false; + D = _create(D, {enumerable: createDesc(0, false)}); + } return setSymbolDesc(it, key, D); + } return dP(it, key, D); + }; + var $defineProperties = function defineProperties(it, P){ + anObject(it); + var keys = enumKeys(P = toIObject(P)) + , i = 0 + , l = keys.length + , key; + while(l > i)$defineProperty(it, key = keys[i++], P[key]); + return it; + }; + var $create = function create(it, P){ + return P === undefined ? _create(it) : $defineProperties(_create(it), P); + }; + var $propertyIsEnumerable = function propertyIsEnumerable(key){ + var E = isEnum.call(this, key = toPrimitive(key, true)); + if(this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return false; + return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; + }; + var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){ + it = toIObject(it); + key = toPrimitive(key, true); + if(it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return; + var D = gOPD(it, key); + if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true; + return D; + }; + var $getOwnPropertyNames = function getOwnPropertyNames(it){ + var names = gOPN(toIObject(it)) + , result = [] + , i = 0 + , key; + while(names.length > i){ + if(!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META)result.push(key); + } return result; + }; + var $getOwnPropertySymbols = function getOwnPropertySymbols(it){ + var IS_OP = it === ObjectProto + , names = gOPN(IS_OP ? OPSymbols : toIObject(it)) + , result = [] + , i = 0 + , key; + while(names.length > i){ + if(has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true))result.push(AllSymbols[key]); + } return result; + }; + +// 19.4.1.1 Symbol([description]) + if(!USE_NATIVE){ + $Symbol = function Symbol(){ + if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor!'); + var tag = uid(arguments.length > 0 ? arguments[0] : undefined); + var $set = function(value){ + if(this === ObjectProto)$set.call(OPSymbols, value); + if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false; + setSymbolDesc(this, tag, createDesc(1, value)); + }; + if(DESCRIPTORS && setter)setSymbolDesc(ObjectProto, tag, {configurable: true, set: $set}); + return wrap(tag); + }; + redefine($Symbol[PROTOTYPE], 'toString', function toString(){ + return this._k; + }); + + $GOPD.f = $getOwnPropertyDescriptor; + $DP.f = $defineProperty; + __webpack_require__(74).f = gOPNExt.f = $getOwnPropertyNames; + __webpack_require__(37).f = $propertyIsEnumerable; + __webpack_require__(52).f = $getOwnPropertySymbols; + + if(DESCRIPTORS && !__webpack_require__(54)){ + redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); + } + + wksExt.f = function(name){ + return wrap(wks(name)); + } + } + + $export($export.G + $export.W + $export.F * !USE_NATIVE, {Symbol: $Symbol}); + + for(var symbols = ( + // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 + 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' + ).split(','), i = 0; symbols.length > i; )wks(symbols[i++]); + + for(var symbols = $keys(wks.store), i = 0; symbols.length > i; )wksDefine(symbols[i++]); + + $export($export.S + $export.F * !USE_NATIVE, 'Symbol', { + // 19.4.2.1 Symbol.for(key) + 'for': function(key){ + return has(SymbolRegistry, key += '') + ? SymbolRegistry[key] + : SymbolRegistry[key] = $Symbol(key); + }, + // 19.4.2.5 Symbol.keyFor(sym) + keyFor: function keyFor(key){ + if(isSymbol(key))return keyOf(SymbolRegistry, key); + throw TypeError(key + ' is not a symbol!'); + }, + useSetter: function(){ setter = true; }, + useSimple: function(){ setter = false; } + }); + + $export($export.S + $export.F * !USE_NATIVE, 'Object', { + // 19.1.2.2 Object.create(O [, Properties]) + create: $create, + // 19.1.2.4 Object.defineProperty(O, P, Attributes) + defineProperty: $defineProperty, + // 19.1.2.3 Object.defineProperties(O, Properties) + defineProperties: $defineProperties, + // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) + getOwnPropertyDescriptor: $getOwnPropertyDescriptor, + // 19.1.2.7 Object.getOwnPropertyNames(O) + getOwnPropertyNames: $getOwnPropertyNames, + // 19.1.2.8 Object.getOwnPropertySymbols(O) + getOwnPropertySymbols: $getOwnPropertySymbols + }); + +// 24.3.2 JSON.stringify(value [, replacer [, space]]) + $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function(){ + var S = $Symbol(); + // MS Edge converts symbol values to JSON as {} + // WebKit converts symbol values to JSON as null + // V8 throws on boxed symbols + return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}'; + })), 'JSON', { + stringify: function stringify(it){ + if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined + var args = [it] + , i = 1 + , replacer, $replacer; + while(arguments.length > i)args.push(arguments[i++]); + replacer = args[1]; + if(typeof replacer == 'function')$replacer = replacer; + if($replacer || !isArray(replacer))replacer = function(key, value){ + if($replacer)value = $replacer.call(this, key, value); + if(!isSymbol(value))return value; + }; + args[1] = replacer; + return _stringify.apply($JSON, args); + } + }); + +// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) + $Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(25)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); +// 19.4.3.5 Symbol.prototype[@@toStringTag] + setToStringTag($Symbol, 'Symbol'); +// 20.2.1.9 Math[@@toStringTag] + setToStringTag(Math, 'Math', true); +// 24.3.3 JSON[@@toStringTag] + setToStringTag(global.JSON, 'JSON', true); + + /***/ }), + /* 124 */ + /***/ (function(module, exports, __webpack_require__) { + + var META = __webpack_require__(36)('meta') + , isObject = __webpack_require__(32) + , has = __webpack_require__(22) + , setDesc = __webpack_require__(18).f + , id = 0; + var isExtensible = Object.isExtensible || function(){ + return true; + }; + var FREEZE = !__webpack_require__(27)(function(){ + return isExtensible(Object.preventExtensions({})); + }); + var setMeta = function(it){ + setDesc(it, META, {value: { + i: 'O' + ++id, // object ID + w: {} // weak collections IDs + }}); + }; + var fastKey = function(it, create){ + // return primitive with prefix + if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; + if(!has(it, META)){ + // can't set metadata to uncaught frozen object + if(!isExtensible(it))return 'F'; + // not necessary to add metadata + if(!create)return 'E'; + // add missing metadata + setMeta(it); + // return object ID + } return it[META].i; + }; + var getWeak = function(it, create){ + if(!has(it, META)){ + // can't set metadata to uncaught frozen object + if(!isExtensible(it))return true; + // not necessary to add metadata + if(!create)return false; + // add missing metadata + setMeta(it); + // return hash weak collections IDs + } return it[META].w; + }; +// add metadata on freeze-family methods calling + var onFreeze = function(it){ + if(FREEZE && meta.NEED && isExtensible(it) && !has(it, META))setMeta(it); + return it; + }; + var meta = module.exports = { + KEY: META, + NEED: false, + fastKey: fastKey, + getWeak: getWeak, + onFreeze: onFreeze + }; + + /***/ }), + /* 125 */ + /***/ (function(module, exports, __webpack_require__) { + + var getKeys = __webpack_require__(28) + , toIObject = __webpack_require__(19); + module.exports = function(object, el){ + var O = toIObject(object) + , keys = getKeys(O) + , length = keys.length + , index = 0 + , key; + while(length > index)if(O[key = keys[index++]] === el)return key; + }; + + /***/ }), + /* 126 */ + /***/ (function(module, exports, __webpack_require__) { + +// all enumerable object keys, includes symbols + var getKeys = __webpack_require__(28) + , gOPS = __webpack_require__(52) + , pIE = __webpack_require__(37); + module.exports = function(it){ + var result = getKeys(it) + , getSymbols = gOPS.f; + if(getSymbols){ + var symbols = getSymbols(it) + , isEnum = pIE.f + , i = 0 + , key; + while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))result.push(key); + } return result; + }; + + /***/ }), + /* 127 */ + /***/ (function(module, exports, __webpack_require__) { + +// 7.2.2 IsArray(argument) + var cof = __webpack_require__(46); + module.exports = Array.isArray || function isArray(arg){ + return cof(arg) == 'Array'; + }; + + /***/ }), + /* 128 */ + /***/ (function(module, exports, __webpack_require__) { + +// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window + var toIObject = __webpack_require__(19) + , gOPN = __webpack_require__(74).f + , toString = {}.toString; + + var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames + ? Object.getOwnPropertyNames(window) : []; + + var getWindowNames = function(it){ + try { + return gOPN(it); + } catch(e){ + return windowNames.slice(); + } + }; + + module.exports.f = function getOwnPropertyNames(it){ + return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it)); + }; + + + /***/ }), + /* 129 */ + /***/ (function(module, exports) { + + + + /***/ }), + /* 130 */ + /***/ (function(module, exports, __webpack_require__) { + + __webpack_require__(58)('asyncIterator'); + + /***/ }), + /* 131 */ + /***/ (function(module, exports, __webpack_require__) { + + __webpack_require__(58)('observable'); + + /***/ }), + /* 132 */ + /***/ (function(module, exports, __webpack_require__) { + + __webpack_require__(133); + var $Object = __webpack_require__(11).Object; + module.exports = function defineProperty(it, key, desc){ + return $Object.defineProperty(it, key, desc); + }; + + /***/ }), + /* 133 */ + /***/ (function(module, exports, __webpack_require__) { + + var $export = __webpack_require__(16); +// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) + $export($export.S + $export.F * !__webpack_require__(21), 'Object', {defineProperty: __webpack_require__(18).f}); + + /***/ }), + /* 134 */ + /***/ (function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(135), __esModule: true }; + + /***/ }), + /* 135 */ + /***/ (function(module, exports, __webpack_require__) { + + __webpack_require__(136); + module.exports = __webpack_require__(11).Object.setPrototypeOf; + + /***/ }), + /* 136 */ + /***/ (function(module, exports, __webpack_require__) { + +// 19.1.3.19 Object.setPrototypeOf(O, proto) + var $export = __webpack_require__(16); + $export($export.S, 'Object', {setPrototypeOf: __webpack_require__(137).set}); + + /***/ }), + /* 137 */ + /***/ (function(module, exports, __webpack_require__) { + +// Works with __proto__ only. Old v8 can't work with null proto objects. + /* eslint-disable no-proto */ + var isObject = __webpack_require__(32) + , anObject = __webpack_require__(26); + var check = function(O, proto){ + anObject(O); + if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!"); + }; + module.exports = { + set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line + function(test, buggy, set){ + try { + set = __webpack_require__(44)(Function.call, __webpack_require__(59).f(Object.prototype, '__proto__').set, 2); + set(test, []); + buggy = !(test instanceof Array); + } catch(e){ buggy = true; } + return function setPrototypeOf(O, proto){ + check(O, proto); + if(buggy)O.__proto__ = proto; + else set(O, proto); + return O; + }; + }({}, false) : undefined), + check: check + }; + + /***/ }), + /* 138 */ + /***/ (function(module, exports, __webpack_require__) { + + __webpack_require__(139); + var $Object = __webpack_require__(11).Object; + module.exports = function create(P, D){ + return $Object.create(P, D); + }; + + /***/ }), + /* 139 */ + /***/ (function(module, exports, __webpack_require__) { + + var $export = __webpack_require__(16) +// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) + $export($export.S, 'Object', {create: __webpack_require__(55)}); + + /***/ }), + /* 140 */ + /***/ (function(module, exports, __webpack_require__) { + + module.exports = { "default": __webpack_require__(141), __esModule: true }; + + /***/ }), + /* 141 */ + /***/ (function(module, exports, __webpack_require__) { + + __webpack_require__(142); + var $Object = __webpack_require__(11).Object; + module.exports = function getOwnPropertyDescriptor(it, key){ + return $Object.getOwnPropertyDescriptor(it, key); + }; + + /***/ }), + /* 142 */ + /***/ (function(module, exports, __webpack_require__) { + +// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) + var toIObject = __webpack_require__(19) + , $getOwnPropertyDescriptor = __webpack_require__(59).f; + + __webpack_require__(70)('getOwnPropertyDescriptor', function(){ + return function getOwnPropertyDescriptor(it, key){ + return $getOwnPropertyDescriptor(toIObject(it), key); + }; + }); + + /***/ }), + /* 143 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + +// 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. + + /** + * Array.prototype.find + * + * Original source : https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find + * See also : https://tc39.github.io/ecma262/#sec-array.prototype.find + */ + if (!Array.prototype.find) { + // eslint-disable-next-line + Object.defineProperty(Array.prototype, 'find', { + // Note: ES6 arrow function syntax is not used on purpose to avoid this to be undefined + value: function value(predicate) { + // 1. Let O be ? ToObject(this value). + if (this == null) throw new TypeError('"this" is null or not defined'); + + var o = Object(this); + + // 2. Let len be ? ToLength(? Get(O, "length")). + var len = o.length >>> 0; + + // 3. If IsCallable(predicate) is false, throw a TypeError exception. + if (typeof predicate !== 'function') throw new TypeError('predicate must be a function'); + + // 4. If thisArg was supplied, let T be thisArg; else let T be undefined. + var thisArg = arguments[1]; + + // 5. Let k be 0. + var k = 0; + + // 6. Repeat, while k < len + while (k < len) { + // a. Let Pk be ! ToString(k). + // b. Let kValue be ? Get(O, Pk). + // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). + // d. If testResult is true, return kValue. + var kValue = o[k]; + if (predicate.call(thisArg, kValue, k, o)) return kValue; + + // e. Increase k by 1. + k++; + } + + // 7. Return undefined. + return undefined; + } + }); + } + + /***/ }), + /* 144 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.getDevice = exports.getViewportSize = exports.getOsData = exports.getBrowserData = exports.getBrowserInfo = undefined; + + var _clapprZepto = __webpack_require__(6); + + var _clapprZepto2 = _interopRequireDefault(_clapprZepto); + + var _browser_data = __webpack_require__(145); + + var _browser_data2 = _interopRequireDefault(_browser_data); + + var _os_data = __webpack_require__(146); + + var _os_data2 = _interopRequireDefault(_os_data); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + 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 = exports.getBrowserInfo = function getBrowserInfo(ua) { + 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]) }; + } else if (/android/i.test(ua) && (extra = ua.match(/version\/(\d+)/i))) { + parts.splice(1, 1, 'Android WebView'); + parts.splice(2, 1, extra[1]); + } + parts = parts[2] ? [parts[1], parts[2]] : [navigator.appName, navigator.appVersion, '-?']; + + return { + name: parts[0], + version: parseInt(parts[1]) + }; + }; + +// Get browser data + var getBrowserData = exports.getBrowserData = function getBrowserData() { + var browserObject = {}; + var userAgent = Browser.userAgent.toLowerCase(); + + // Check browser type + for (var i in _browser_data2.default) { + var browserRegExp = new RegExp(_browser_data2.default[i].identifier.toLowerCase()); + var browserRegExpResult = browserRegExp.exec(userAgent); + + if (browserRegExpResult != null && browserRegExpResult[1]) { + browserObject.name = _browser_data2.default[i].name; + browserObject.group = _browser_data2.default[i].group; + + // Check version + if (_browser_data2.default[i].versionIdentifier) { + var versionRegExp = new RegExp(_browser_data2.default[i].versionIdentifier.toLowerCase()); + var versionRegExpResult = versionRegExp.exec(userAgent); + + if (versionRegExpResult != null && versionRegExpResult[1]) setBrowserVersion(versionRegExpResult[1], browserObject); + } else { + setBrowserVersion(browserRegExpResult[1], browserObject); + } + break; + } + } + return browserObject; + }; + +// Set browser version + var setBrowserVersion = function setBrowserVersion(version, browserObject) { + var splitVersion = version.split('.', 2); + browserObject.fullVersion = version; + + // Major version + if (splitVersion[0]) browserObject.majorVersion = parseInt(splitVersion[0]); + + // Minor version + if (splitVersion[1]) browserObject.minorVersion = parseInt(splitVersion[1]); + }; + +// Get OS data + var getOsData = exports.getOsData = function getOsData() { + var osObject = {}; + var userAgent = Browser.userAgent.toLowerCase(); + + // Check browser type + for (var i in _os_data2.default) { + var osRegExp = new RegExp(_os_data2.default[i].identifier.toLowerCase()); + var osRegExpResult = osRegExp.exec(userAgent); + + if (osRegExpResult != null) { + osObject.name = _os_data2.default[i].name; + osObject.group = _os_data2.default[i].group; + + // Version defined + if (_os_data2.default[i].version) { + setOsVersion(_os_data2.default[i].version, _os_data2.default[i].versionSeparator ? _os_data2.default[i].versionSeparator : '.', osObject); + + // Version detected + } else if (osRegExpResult[1]) { + setOsVersion(osRegExpResult[1], _os_data2.default[i].versionSeparator ? _os_data2.default[i].versionSeparator : '.', osObject); + + // Version identifier + } else if (_os_data2.default[i].versionIdentifier) { + var versionRegExp = new RegExp(_os_data2.default[i].versionIdentifier.toLowerCase()); + var versionRegExpResult = versionRegExp.exec(userAgent); + + if (versionRegExpResult != null && versionRegExpResult[1]) setOsVersion(versionRegExpResult[1], _os_data2.default[i].versionSeparator ? _os_data2.default[i].versionSeparator : '.', osObject); + } + break; + } + } + return osObject; + }; + +// Set OS version + var setOsVersion = function setOsVersion(version, separator, osObject) { + var finalSeparator = separator.substr(0, 1) == '[' ? new RegExp(separator, 'g') : separator; + var splitVersion = version.split(finalSeparator, 2); + + if (separator != '.') version = version.replace(new RegExp(separator, 'g'), '.'); + + osObject.fullVersion = version; + + // Major version + if (splitVersion && splitVersion[0]) osObject.majorVersion = parseInt(splitVersion[0]); + + // Minor version + if (splitVersion && splitVersion[1]) osObject.minorVersion = parseInt(splitVersion[1]); + }; + +// Set viewport size + var getViewportSize = exports.getViewportSize = function getViewportSize() { + var viewportObject = {}; + + viewportObject.width = (0, _clapprZepto2.default)(window).width(); + viewportObject.height = (0, _clapprZepto2.default)(window).height(); + + return viewportObject; + }; + +// Set viewport orientation + var setViewportOrientation = function setViewportOrientation() { + switch (window.orientation) { + case -90: + case 90: + Browser.viewport.orientation = 'landscape'; + break; + default: + Browser.viewport.orientation = 'portrait'; + break; + } + }; + + var getDevice = exports.getDevice = function getDevice(ua) { + var platformRegExp = /\((iP(?:hone|ad|od))?(?:[^;]*; ){0,2}([^)]+(?=\)))/; + var matches = platformRegExp.exec(ua); + var device = matches && (matches[1] || matches[2]) || ''; + return device; + }; + + var browserInfo = getBrowserInfo(navigator.userAgent); + + 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.isEdge; + 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(); + + /** + * @deprecated + * This parameter currently exists for retrocompatibility reasons. + * Use Browser.data.name instead. + */ + Browser.name = browserInfo.name; + + /** + * @deprecated + * This parameter currently exists for retrocompatibility reasons. + * Use Browser.data.fullVersion instead. + */ + Browser.version = browserInfo.version; + + Browser.userAgent = navigator.userAgent; + Browser.data = getBrowserData(); + Browser.os = getOsData(); + Browser.viewport = getViewportSize(); + Browser.device = getDevice(Browser.userAgent); + typeof window.orientation !== 'undefined' && setViewportOrientation(); + + exports.default = Browser; + + /***/ }), + /* 145 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /* eslint-disable no-useless-escape */ +// The order of the following arrays is important, be careful if you change it. + + var BROWSER_DATA = [{ + name: 'Chromium', + group: 'Chrome', + identifier: 'Chromium/([0-9\.]*)' + }, { + name: 'Chrome Mobile', + group: 'Chrome', + identifier: 'Chrome/([0-9\.]*) Mobile', + versionIdentifier: 'Chrome/([0-9\.]*)' + }, { + name: 'Chrome', + group: 'Chrome', + identifier: 'Chrome/([0-9\.]*)' + }, { + name: 'Chrome for iOS', + group: 'Chrome', + identifier: 'CriOS/([0-9\.]*)' + }, { + name: 'Android Browser', + group: 'Chrome', + identifier: 'CrMo/([0-9\.]*)' + }, { + name: 'Firefox', + group: 'Firefox', + identifier: 'Firefox/([0-9\.]*)' + }, { + name: 'Opera Mini', + group: 'Opera', + identifier: 'Opera Mini/([0-9\.]*)' + }, { + name: 'Opera', + group: 'Opera', + identifier: 'Opera ([0-9\.]*)' + }, { + name: 'Opera', + group: 'Opera', + identifier: 'Opera/([0-9\.]*)', + versionIdentifier: 'Version/([0-9\.]*)' + }, { + name: 'IEMobile', + group: 'Explorer', + identifier: 'IEMobile/([0-9\.]*)' + }, { + name: 'Internet Explorer', + group: 'Explorer', + identifier: 'MSIE ([a-zA-Z0-9\.]*)' + }, { + name: 'Internet Explorer', + group: 'Explorer', + identifier: 'Trident/([0-9\.]*)', + versionIdentifier: 'rv:([0-9\.]*)' + }, { + name: 'Spartan', + group: 'Spartan', + identifier: 'Edge/([0-9\.]*)', + versionIdentifier: 'Edge/([0-9\.]*)' + }, { + name: 'Safari', + group: 'Safari', + identifier: 'Safari/([0-9\.]*)', + versionIdentifier: 'Version/([0-9\.]*)' + }]; + + exports.default = BROWSER_DATA; + module.exports = exports['default']; + + /***/ }), + /* 146 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /* eslint-disable no-useless-escape */ +// The order of the following arrays is important, be careful if you change it. + + var OS_DATA = [{ + name: 'Windows 2000', + group: 'Windows', + identifier: 'Windows NT 5.0', + version: '5.0' + }, { + name: 'Windows XP', + group: 'Windows', + identifier: 'Windows NT 5.1', + version: '5.1' + }, { + name: 'Windows Vista', + group: 'Windows', + identifier: 'Windows NT 6.0', + version: '6.0' + }, { + name: 'Windows 7', + group: 'Windows', + identifier: 'Windows NT 6.1', + version: '7.0' + }, { + name: 'Windows 8', + group: 'Windows', + identifier: 'Windows NT 6.2', + version: '8.0' + }, { + name: 'Windows 8.1', + group: 'Windows', + identifier: 'Windows NT 6.3', + version: '8.1' + }, { + name: 'Windows 10', + group: 'Windows', + identifier: 'Windows NT 10.0', + version: '10.0' + }, { + name: 'Windows Phone', + group: 'Windows Phone', + identifier: 'Windows Phone ([0-9\.]*)' + }, { + name: 'Windows Phone', + group: 'Windows Phone', + identifier: 'Windows Phone OS ([0-9\.]*)' + }, { + name: 'Windows', + group: 'Windows', + identifier: 'Windows' + }, { + name: 'Chrome OS', + group: 'Chrome OS', + identifier: 'CrOS' + }, { + name: 'Android', + group: 'Android', + identifier: 'Android', + versionIdentifier: 'Android ([a-zA-Z0-9\.-]*)' + }, { + name: 'iPad', + group: 'iOS', + identifier: 'iPad', + versionIdentifier: 'OS ([0-9_]*)', + versionSeparator: '[_|\.]' + }, { + name: 'iPod', + group: 'iOS', + identifier: 'iPod', + versionIdentifier: 'OS ([0-9_]*)', + versionSeparator: '[_|\.]' + }, { + name: 'iPhone', + group: 'iOS', + identifier: 'iPhone OS', + versionIdentifier: 'OS ([0-9_]*)', + versionSeparator: '[_|\.]' + }, { + name: 'Mac OS X High Sierra', + group: 'Mac OS', + identifier: 'Mac OS X (10([_|\.])13([0-9_\.]*))', + versionSeparator: '[_|\.]' + }, { + name: 'Mac OS X Sierra', + group: 'Mac OS', + identifier: 'Mac OS X (10([_|\.])12([0-9_\.]*))', + versionSeparator: '[_|\.]' + }, { + name: 'Mac OS X El Capitan', + group: 'Mac OS', + identifier: 'Mac OS X (10([_|\.])11([0-9_\.]*))', + versionSeparator: '[_|\.]' + }, { + name: 'Mac OS X Yosemite', + group: 'Mac OS', + identifier: 'Mac OS X (10([_|\.])10([0-9_\.]*))', + versionSeparator: '[_|\.]' + }, { + name: 'Mac OS X Mavericks', + group: 'Mac OS', + identifier: 'Mac OS X (10([_|\.])9([0-9_\.]*))', + versionSeparator: '[_|\.]' + }, { + name: 'Mac OS X Mountain Lion', + group: 'Mac OS', + identifier: 'Mac OS X (10([_|\.])8([0-9_\.]*))', + versionSeparator: '[_|\.]' + }, { + name: 'Mac OS X Lion', + group: 'Mac OS', + identifier: 'Mac OS X (10([_|\.])7([0-9_\.]*))', + versionSeparator: '[_|\.]' + }, { + name: 'Mac OS X Snow Leopard', + group: 'Mac OS', + identifier: 'Mac OS X (10([_|\.])6([0-9_\.]*))', + versionSeparator: '[_|\.]' + }, { + name: 'Mac OS X Leopard', + group: 'Mac OS', + identifier: 'Mac OS X (10([_|\.])5([0-9_\.]*))', + versionSeparator: '[_|\.]' + }, { + name: 'Mac OS X Tiger', + group: 'Mac OS', + identifier: 'Mac OS X (10([_|\.])4([0-9_\.]*))', + versionSeparator: '[_|\.]' + }, { + name: 'Mac OS X Panther', + group: 'Mac OS', + identifier: 'Mac OS X (10([_|\.])3([0-9_\.]*))', + versionSeparator: '[_|\.]' + }, { + name: 'Mac OS X Jaguar', + group: 'Mac OS', + identifier: 'Mac OS X (10([_|\.])2([0-9_\.]*))', + versionSeparator: '[_|\.]' + }, { + name: 'Mac OS X Puma', + group: 'Mac OS', + identifier: 'Mac OS X (10([_|\.])1([0-9_\.]*))', + versionSeparator: '[_|\.]' + }, { + name: 'Mac OS X Cheetah', + group: 'Mac OS', + identifier: 'Mac OS X (10([_|\.])0([0-9_\.]*))', + versionSeparator: '[_|\.]' + }, { + name: 'Mac OS', + group: 'Mac OS', + identifier: 'Mac OS' + }, { + name: 'Ubuntu', + group: 'Linux', + identifier: 'Ubuntu', + versionIdentifier: 'Ubuntu/([0-9\.]*)' + }, { + name: 'Debian', + group: 'Linux', + identifier: 'Debian' + }, { + name: 'Gentoo', + group: 'Linux', + identifier: 'Gentoo' + }, { + name: 'Linux', + group: 'Linux', + identifier: 'Linux' + }, { + name: 'BlackBerry', + group: 'BlackBerry', + identifier: 'BlackBerry' + }]; + + exports.default = OS_DATA; + module.exports = exports['default']; + + /***/ }), + /* 147 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + + Object.defineProperty(exports, "__esModule", { + value: true + }); +// https://github.com/mathiasbynens/small + var mp4 = exports.mp4 = 'data:video/mp4;base64,AAAAHGZ0eXBpc29tAAACAGlzb21pc28ybXA0MQAAAAhmcmVlAAAC721kYXQhEAUgpBv/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3pwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcCEQBSCkG//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADengAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcAAAAsJtb292AAAAbG12aGQAAAAAAAAAAAAAAAAAAAPoAAAALwABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAB7HRyYWsAAABcdGtoZAAAAAMAAAAAAAAAAAAAAAIAAAAAAAAALwAAAAAAAAAAAAAAAQEAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAAC8AAAAAAAEAAAAAAWRtZGlhAAAAIG1kaGQAAAAAAAAAAAAAAAAAAKxEAAAIAFXEAAAAAAAtaGRscgAAAAAAAAAAc291bgAAAAAAAAAAAAAAAFNvdW5kSGFuZGxlcgAAAAEPbWluZgAAABBzbWhkAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAADTc3RibAAAAGdzdHNkAAAAAAAAAAEAAABXbXA0YQAAAAAAAAABAAAAAAAAAAAAAgAQAAAAAKxEAAAAAAAzZXNkcwAAAAADgICAIgACAASAgIAUQBUAAAAAAfQAAAHz+QWAgIACEhAGgICAAQIAAAAYc3R0cwAAAAAAAAABAAAAAgAABAAAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAIAAAABAAAAHHN0c3oAAAAAAAAAAAAAAAIAAAFzAAABdAAAABRzdGNvAAAAAAAAAAEAAAAsAAAAYnVkdGEAAABabWV0YQAAAAAAAAAhaGRscgAAAAAAAAAAbWRpcmFwcGwAAAAAAAAAAAAAAAAtaWxzdAAAACWpdG9vAAAAHWRhdGEAAAABAAAAAExhdmY1Ni40MC4xMDE='; + + exports.default = { + mp4: mp4 + }; + + /***/ }), + /* 148 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _classCallCheck2 = __webpack_require__(0); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _vendor = __webpack_require__(60); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var BOLD = 'font-weight: bold; font-size: 13px;'; +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + + var INFO = 'color: #006600;' + BOLD; + var DEBUG = 'color: #0000ff;' + BOLD; + var WARN = 'color: #ff8000;' + BOLD; + var ERROR = 'color: #ff0000;' + BOLD; + + var LEVEL_DEBUG = 0; + var LEVEL_INFO = 1; + var LEVEL_WARN = 2; + var LEVEL_ERROR = 3; + var LEVEL_DISABLED = LEVEL_ERROR; + + var COLORS = [DEBUG, INFO, WARN, ERROR, ERROR]; + var DESCRIPTIONS = ['debug', 'info', 'warn', 'error', 'disabled']; + + var Log = function () { + function Log() { + var _this = this; + + var level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : LEVEL_INFO; + var offLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : LEVEL_DISABLED; + (0, _classCallCheck3.default)(this, Log); + + this.kibo = new _vendor.Kibo(); + this.kibo.down(['ctrl shift d'], function () { + return _this.onOff(); + }); + this.BLACKLIST = ['timeupdate', 'playback:timeupdate', 'playback:progress', 'container:hover', 'container:timeupdate', 'container:progress']; + this.level = level; + this.offLevel = offLevel; + } + + Log.prototype.debug = function debug(klass) { + this.log(klass, LEVEL_DEBUG, Array.prototype.slice.call(arguments, 1)); + }; + + Log.prototype.info = function info(klass) { + this.log(klass, LEVEL_INFO, Array.prototype.slice.call(arguments, 1)); + }; + + Log.prototype.warn = function warn(klass) { + this.log(klass, LEVEL_WARN, Array.prototype.slice.call(arguments, 1)); + }; + + Log.prototype.error = function error(klass) { + this.log(klass, LEVEL_ERROR, Array.prototype.slice.call(arguments, 1)); + }; + + Log.prototype.onOff = function onOff() { + if (this.level === this.offLevel) { + this.level = this.previousLevel; + } else { + this.previousLevel = this.level; + this.level = this.offLevel; + } + // handle instances where console.log is unavailable + if (window.console && window.console.log) window.console.log('%c[Clappr.Log] set log level to ' + DESCRIPTIONS[this.level], WARN); + }; + + Log.prototype.level = function level(newLevel) { + this.level = newLevel; + }; + + Log.prototype.log = function log(klass, level, message) { + if (this.BLACKLIST.indexOf(message[0]) >= 0) return; + if (level < this.level) return; + + if (!message) { + message = klass; + klass = null; + } + var color = COLORS[level]; + var klassDescription = ''; + if (klass) klassDescription = '[' + klass + ']'; + + if (window.console && window.console.log) window.console.log.apply(console, ['%c[' + DESCRIPTIONS[level] + ']' + klassDescription, color].concat(message)); + }; + + return Log; + }(); + + exports.default = Log; + + + Log.LEVEL_DEBUG = LEVEL_DEBUG; + Log.LEVEL_INFO = LEVEL_INFO; + Log.LEVEL_WARN = LEVEL_WARN; + Log.LEVEL_ERROR = LEVEL_ERROR; + + Log.getInstance = function () { + if (this._instance === undefined) { + this._instance = new this(); + this._instance.previousLevel = this._instance.level; + this._instance.level = this._instance.offLevel; + } + return this._instance; + }; + + Log.setLevel = function (level) { + this.getInstance().level = level; + }; + + Log.debug = function () { + this.getInstance().debug.apply(this.getInstance(), arguments); + }; + Log.info = function () { + this.getInstance().info.apply(this.getInstance(), arguments); + }; + Log.warn = function () { + this.getInstance().warn.apply(this.getInstance(), arguments); + }; + Log.error = function () { + this.getInstance().error.apply(this.getInstance(), arguments); + }; + module.exports = exports['default']; + + /***/ }), + /* 149 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + + Object.defineProperty(exports, "__esModule", { + value: true + }); + /* eslint-disable */ +// Kibo is released under the MIT License. Copyright (c) 2013 marquete. +// see https://github.com/marquete/kibo + + var Kibo = function Kibo(element) { + this.element = element || window.document; + this.initialize(); + }; + + Kibo.KEY_NAMES_BY_CODE = { + 8: 'backspace', 9: 'tab', 13: 'enter', + 16: 'shift', 17: 'ctrl', 18: 'alt', + 20: 'caps_lock', + 27: 'esc', + 32: 'space', + 37: 'left', 38: 'up', 39: 'right', 40: 'down', + 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5', 54: '6', 55: '7', 56: '8', 57: '9', + 65: 'a', 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h', 73: 'i', 74: 'j', + 75: 'k', 76: 'l', 77: 'm', 78: 'n', 79: 'o', 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', + 85: 'u', 86: 'v', 87: 'w', 88: 'x', 89: 'y', 90: 'z', 112: 'f1', 113: 'f2', 114: 'f3', + 115: 'f4', 116: 'f5', 117: 'f6', 118: 'f7', 119: 'f8', 120: 'f9', 121: 'f10', 122: 'f11', 123: 'f12' + }; + + Kibo.KEY_CODES_BY_NAME = {}; + (function () { + for (var key in Kibo.KEY_NAMES_BY_CODE) { + if (Object.prototype.hasOwnProperty.call(Kibo.KEY_NAMES_BY_CODE, key)) { + Kibo.KEY_CODES_BY_NAME[Kibo.KEY_NAMES_BY_CODE[key]] = +key; + } + } + })(); + + Kibo.MODIFIERS = ['shift', 'ctrl', 'alt']; + + Kibo.registerEvent = function () { + if (document.addEventListener) { + return function (element, eventName, func) { + element.addEventListener(eventName, func, false); + }; + } else if (document.attachEvent) { + return function (element, eventName, func) { + element.attachEvent('on' + eventName, func); + }; + } + }(); + + Kibo.unregisterEvent = function () { + if (document.removeEventListener) { + return function (element, eventName, func) { + element.removeEventListener(eventName, func, false); + }; + } else if (document.detachEvent) { + return function (element, eventName, func) { + element.detachEvent('on' + eventName, func); + }; + } + }(); + + Kibo.stringContains = function (string, substring) { + return string.indexOf(substring) !== -1; + }; + + Kibo.neatString = function (string) { + return string.replace(/^\s+|\s+$/g, '').replace(/\s+/g, ' '); + }; + + Kibo.capitalize = function (string) { + return string.toLowerCase().replace(/^./, function (match) { + return match.toUpperCase(); + }); + }; + + Kibo.isString = function (what) { + return Kibo.stringContains(Object.prototype.toString.call(what), 'String'); + }; + + Kibo.arrayIncludes = function () { + if (Array.prototype.indexOf) { + return function (haystack, needle) { + return haystack.indexOf(needle) !== -1; + }; + } else { + return function (haystack, needle) { + for (var i = 0; i < haystack.length; i++) { + if (haystack[i] === needle) { + return true; + } + } + return false; + }; + } + }(); + + Kibo.extractModifiers = function (keyCombination) { + var modifiers, i; + modifiers = []; + for (i = 0; i < Kibo.MODIFIERS.length; i++) { + if (Kibo.stringContains(keyCombination, Kibo.MODIFIERS[i])) { + modifiers.push(Kibo.MODIFIERS[i]); + } + } + return modifiers; + }; + + Kibo.extractKey = function (keyCombination) { + var keys, i; + keys = Kibo.neatString(keyCombination).split(' '); + for (i = 0; i < keys.length; i++) { + if (!Kibo.arrayIncludes(Kibo.MODIFIERS, keys[i])) { + return keys[i]; + } + } + }; + + Kibo.modifiersAndKey = function (keyCombination) { + var result, key; + + if (Kibo.stringContains(keyCombination, 'any')) { + return Kibo.neatString(keyCombination).split(' ').slice(0, 2).join(' '); + } + + result = Kibo.extractModifiers(keyCombination); + + key = Kibo.extractKey(keyCombination); + if (key && !Kibo.arrayIncludes(Kibo.MODIFIERS, key)) { + result.push(key); + } + + return result.join(' '); + }; + + Kibo.keyName = function (keyCode) { + return Kibo.KEY_NAMES_BY_CODE[keyCode + '']; + }; + + Kibo.keyCode = function (keyName) { + return +Kibo.KEY_CODES_BY_NAME[keyName]; + }; + + Kibo.prototype.initialize = function () { + var i, + that = this; + + this.lastKeyCode = -1; + this.lastModifiers = {}; + for (i = 0; i < Kibo.MODIFIERS.length; i++) { + this.lastModifiers[Kibo.MODIFIERS[i]] = false; + } + + this.keysDown = { any: [] }; + this.keysUp = { any: [] }; + this.downHandler = this.handler('down'); + this.upHandler = this.handler('up'); + + Kibo.registerEvent(this.element, 'keydown', this.downHandler); + Kibo.registerEvent(this.element, 'keyup', this.upHandler); + Kibo.registerEvent(window, 'unload', function unloader() { + Kibo.unregisterEvent(that.element, 'keydown', that.downHandler); + Kibo.unregisterEvent(that.element, 'keyup', that.upHandler); + Kibo.unregisterEvent(window, 'unload', unloader); + }); + }; + + Kibo.prototype.handler = function (upOrDown) { + var that = this; + return function (e) { + var i, registeredKeys, lastModifiersAndKey; + + e = e || window.event; + + that.lastKeyCode = e.keyCode; + for (i = 0; i < Kibo.MODIFIERS.length; i++) { + that.lastModifiers[Kibo.MODIFIERS[i]] = e[Kibo.MODIFIERS[i] + 'Key']; + } + if (Kibo.arrayIncludes(Kibo.MODIFIERS, Kibo.keyName(that.lastKeyCode))) { + that.lastModifiers[Kibo.keyName(that.lastKeyCode)] = true; + } + + registeredKeys = that['keys' + Kibo.capitalize(upOrDown)]; + + for (i = 0; i < registeredKeys.any.length; i++) { + if (registeredKeys.any[i](e) === false && e.preventDefault) { + e.preventDefault(); + } + } + + lastModifiersAndKey = that.lastModifiersAndKey(); + if (registeredKeys[lastModifiersAndKey]) { + for (i = 0; i < registeredKeys[lastModifiersAndKey].length; i++) { + if (registeredKeys[lastModifiersAndKey][i](e) === false && e.preventDefault) { + e.preventDefault(); + } + } + } + }; + }; + + Kibo.prototype.registerKeys = function (upOrDown, newKeys, func) { + var i, + keys, + registeredKeys = this['keys' + Kibo.capitalize(upOrDown)]; + + if (Kibo.isString(newKeys)) { + newKeys = [newKeys]; + } + + for (i = 0; i < newKeys.length; i++) { + keys = newKeys[i]; + keys = Kibo.modifiersAndKey(keys + ''); + + if (registeredKeys[keys]) { + registeredKeys[keys].push(func); + } else { + registeredKeys[keys] = [func]; + } + } + + return this; + }; + +// jshint maxdepth:5 + Kibo.prototype.unregisterKeys = function (upOrDown, newKeys, func) { + var i, + j, + keys, + registeredKeys = this['keys' + Kibo.capitalize(upOrDown)]; + + if (Kibo.isString(newKeys)) { + newKeys = [newKeys]; + } + + for (i = 0; i < newKeys.length; i++) { + keys = newKeys[i]; + keys = Kibo.modifiersAndKey(keys + ''); + + if (func === null) { + delete registeredKeys[keys]; + } else { + if (registeredKeys[keys]) { + for (j = 0; j < registeredKeys[keys].length; j++) { + if (String(registeredKeys[keys][j]) === String(func)) { + registeredKeys[keys].splice(j, 1); + break; + } + } + } + } + } + + return this; + }; + + Kibo.prototype.off = function (keys) { + return this.unregisterKeys('down', keys, null); + }; + + Kibo.prototype.delegate = function (upOrDown, keys, func) { + return func !== null || func !== undefined ? this.registerKeys(upOrDown, keys, func) : this.unregisterKeys(upOrDown, keys, func); + }; + + Kibo.prototype.down = function (keys, func) { + return this.delegate('down', keys, func); + }; + + Kibo.prototype.up = function (keys, func) { + return this.delegate('up', keys, func); + }; + + Kibo.prototype.lastKey = function (modifier) { + if (!modifier) { + return Kibo.keyName(this.lastKeyCode); + } + + return this.lastModifiers[modifier]; + }; + + Kibo.prototype.lastModifiersAndKey = function () { + var result, i; + + result = []; + for (i = 0; i < Kibo.MODIFIERS.length; i++) { + if (this.lastKey(Kibo.MODIFIERS[i])) { + result.push(Kibo.MODIFIERS[i]); + } + } + + if (!Kibo.arrayIncludes(result, this.lastKey())) { + result.push(this.lastKey()); + } + + return result.join(' '); + }; + + exports.default = Kibo; + module.exports = exports['default']; + + /***/ }), + /* 150 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _core_factory = __webpack_require__(151); + + var _core_factory2 = _interopRequireDefault(_core_factory); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = _core_factory2.default; + module.exports = exports['default']; + + /***/ }), + /* 151 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _classCallCheck2 = __webpack_require__(0); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _possibleConstructorReturn2 = __webpack_require__(1); + + var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + + var _createClass2 = __webpack_require__(3); + + var _createClass3 = _interopRequireDefault(_createClass2); + + var _inherits2 = __webpack_require__(2); + + var _inherits3 = _interopRequireDefault(_inherits2); + + var _base_object = __webpack_require__(15); + + var _base_object2 = _interopRequireDefault(_base_object); + + var _core = __webpack_require__(77); + + var _core2 = _interopRequireDefault(_core); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + /** + * 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. + + var CoreFactory = function (_BaseObject) { + (0, _inherits3.default)(CoreFactory, _BaseObject); + (0, _createClass3.default)(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) { + (0, _classCallCheck3.default)(this, CoreFactory); + + var _this = (0, _possibleConstructorReturn3.default)(this, _BaseObject.call(this)); + + _this.player = player; + _this._options = player.options; + return _this; + } + + /** + * creates a core and its plugins + * @method create + * @return {Core} created core + */ + + + 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; + }; + + /** + * given the core plugins (`loader.corePlugins`) it builds each one + * @method addCorePlugins + * @return {Core} the core with all plugins + */ + + + 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; + }; + + CoreFactory.prototype.setupExternalInterface = function setupExternalInterface(plugin) { + var externalFunctions = plugin.getExternalInterface(); + for (var key in externalFunctions) { + this.player[key] = externalFunctions[key].bind(plugin); + this.core[key] = externalFunctions[key].bind(plugin); + } + }; + + return CoreFactory; + }(_base_object2.default); + + exports.default = CoreFactory; + module.exports = exports['default']; + + /***/ }), + /* 152 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _assign = __webpack_require__(12); + + var _assign2 = _interopRequireDefault(_assign); + + var _classCallCheck2 = __webpack_require__(0); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _possibleConstructorReturn2 = __webpack_require__(1); + + var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + + var _createClass2 = __webpack_require__(3); + + var _createClass3 = _interopRequireDefault(_createClass2); + + var _inherits2 = __webpack_require__(2); + + var _inherits3 = _interopRequireDefault(_inherits2); + + var _utils = __webpack_require__(5); + + var _styler = __webpack_require__(78); + + var _styler2 = _interopRequireDefault(_styler); + + var _events = __webpack_require__(4); + + var _events2 = _interopRequireDefault(_events); + + var _ui_object = __webpack_require__(30); + + var _ui_object2 = _interopRequireDefault(_ui_object); + + var _ui_core_plugin = __webpack_require__(23); + + var _ui_core_plugin2 = _interopRequireDefault(_ui_core_plugin); + + var _browser = __webpack_require__(14); + + var _browser2 = _interopRequireDefault(_browser); + + var _container_factory = __webpack_require__(153); + + var _container_factory2 = _interopRequireDefault(_container_factory); + + var _mediator = __webpack_require__(31); + + var _mediator2 = _interopRequireDefault(_mediator); + + var _player_info = __webpack_require__(40); + + var _player_info2 = _interopRequireDefault(_player_info); + + var _error = __webpack_require__(24); + + var _error2 = _interopRequireDefault(_error); + + var _error_mixin = __webpack_require__(20); + + var _error_mixin2 = _interopRequireDefault(_error_mixin); + + var _clapprZepto = __webpack_require__(6); + + var _clapprZepto2 = _interopRequireDefault(_clapprZepto); + + __webpack_require__(159); + + var _fonts = __webpack_require__(161); + + var _fonts2 = _interopRequireDefault(_fonts); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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 style = void 0; + + /** + * The Core is responsible to manage Containers, the mediator, MediaControl + * and the player state. + * @class Core + * @constructor + * @extends UIObject + * @module components + */ + + var Core = function (_UIObject) { + (0, _inherits3.default)(Core, _UIObject); + (0, _createClass3.default)(Core, [{ + key: 'events', + get: function get() { + return { + 'webkitfullscreenchange': 'handleFullscreenChange', + 'mousemove': 'onMouseMove', + 'mouseleave': 'onMouseLeave' + }; + } + }, { + key: 'attributes', + get: function get() { + return { + 'data-player': '', + tabindex: 9999 + }; + } + + /** + * checks if the core is ready. + * @property isReady + * @type {Boolean} `true` if the core is ready, otherwise `false` + */ + + }, { + key: 'isReady', + get: function get() { + return !!this.ready; + } + + /** + * The internationalization plugin. + * @property i18n + * @type {Strings} + */ + + }, { + key: 'i18n', + get: function get() { + return this.getPlugin('strings') || { t: function t(key) { + return key; + } }; + } + + /** + * @deprecated + * This property currently exists for retrocompatibility reasons. + * If you want to access the media control instance, use the method getPlugin('media_control'). + */ + + }, { + key: 'mediaControl', + get: function get() { + return this.getPlugin('media_control') || this.dummyMediaControl; + } + }, { + key: 'dummyMediaControl', + get: function get() { + if (this._dummyMediaControl) return this._dummyMediaControl; + this._dummyMediaControl = new _ui_core_plugin2.default(this); + return this._dummyMediaControl; + } + + /** + * gets the active container reference. + * @property activeContainer + * @type {Object} + */ + + }, { + key: 'activeContainer', + get: function get() { + return this._activeContainer; + } + + /** + * sets the active container reference and trigger a event with the new reference. + * @property activeContainer + * @type {Object} + */ + , + set: function set(container) { + this._activeContainer = container; + this.trigger(_events2.default.CORE_ACTIVE_CONTAINER_CHANGED, this._activeContainer); + } + + /** + * gets the active playback reference. + * @property activePlayback + * @type {Object} + */ + + }, { + key: 'activePlayback', + get: function get() { + return this.activeContainer && this.activeContainer.playback; + } + }]); + + function Core(options) { + (0, _classCallCheck3.default)(this, Core); + + var _this = (0, _possibleConstructorReturn3.default)(this, _UIObject.call(this, options)); + + _this.playerError = new _error2.default(options, _this); + _this.configureDomRecycler(); + _this.playerInfo = _player_info2.default.getInstance(options.playerId); + _this.firstResize = true; + _this.plugins = []; + _this.containers = []; + //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; + } + + Core.prototype.configureDomRecycler = function configureDomRecycler() { + var recycleVideo = this.options && this.options.playback && this.options.playback.recycleVideo; + _utils.DomRecycler.configure({ recycleVideo: recycleVideo }); + }; + + Core.prototype.createContainers = function createContainers(options) { + this.defer = _clapprZepto2.default.Deferred(); + this.defer.promise(this); + this.containerFactory = new _container_factory2.default(options, options.loader, this.i18n, this.playerError); + this.prepareContainers(); + }; + + Core.prototype.prepareContainers = function prepareContainers() { + var _this2 = this; + + this.containerFactory.createContainers().then(function (containers) { + return _this2.setupContainers(containers); + }).then(function (containers) { + return _this2.resolveOnContainersReady(containers); + }); + }; + + Core.prototype.updateSize = function updateSize() { + _utils.Fullscreen.isFullscreen() ? this.setFullscreen() : this.setPlayerSize(); + }; + + 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() }; + } + }; + + 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); + }; + + Core.prototype.enableResizeObserver = function enableResizeObserver() { + var _this3 = this; + + var checkSizeCallback = function checkSizeCallback() { + _this3.triggerResize({ width: _this3.el.clientWidth, height: _this3.el.clientHeight }); + }; + this.resizeObserverInterval = setInterval(checkSizeCallback, 500); + }; + + Core.prototype.triggerResize = function triggerResize(newSize) { + var thereWasChange = this.firstResize || this.oldHeight !== newSize.height || this.oldWidth !== newSize.width; + if (thereWasChange) { + this.oldHeight = newSize.height; + this.oldWidth = newSize.width; + this.playerInfo.computedSize = newSize; + this.firstResize = false; + _mediator2.default.trigger(this.options.playerId + ':' + _events2.default.PLAYER_RESIZE, newSize); + this.trigger(_events2.default.CORE_RESIZE, newSize); + } + }; + + Core.prototype.disableResizeObserver = function disableResizeObserver() { + this.resizeObserverInterval && clearInterval(this.resizeObserverInterval); + }; + + 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); + }); + }; + + Core.prototype.addPlugin = function addPlugin(plugin) { + this.plugins.push(plugin); + }; + + 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]; + }; + + Core.prototype.load = function load(sources, mimeType) { + this.options.mimeType = mimeType; + sources = sources && sources.constructor === Array ? sources : [sources]; + this.options.sources = sources; + this.containers.forEach(function (container) { + return container.destroy(); + }); + this.containerFactory.options = _clapprZepto2.default.extend(this.options, { sources: sources }); + this.prepareContainers(); + }; + + 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(); + (0, _clapprZepto2.default)(document).unbind('fullscreenchange', this._boundFullscreenHandler); + (0, _clapprZepto2.default)(document).unbind('MSFullscreenChange', this._boundFullscreenHandler); + (0, _clapprZepto2.default)(document).unbind('mozfullscreenchange', this._boundFullscreenHandler); + this.stopListening(); + }; + + Core.prototype.handleFullscreenChange = function handleFullscreenChange() { + this.trigger(_events2.default.CORE_FULLSCREEN, _utils.Fullscreen.isFullscreen()); + this.updateSize(); + }; + + Core.prototype.handleWindowResize = function handleWindowResize(event) { + var orientation = window.innerWidth > window.innerHeight ? 'landscape' : 'portrait'; + if (this._screenOrientation === orientation) return; + this._screenOrientation = orientation; + this.triggerResize({ width: this.el.clientWidth, height: this.el.clientHeight }); + this.trigger(_events2.default.CORE_SCREEN_ORIENTATION_CHANGED, { + event: event, + orientation: this._screenOrientation + }); + }; + + Core.prototype.removeContainer = function removeContainer(container) { + this.stopListening(container); + this.containers = this.containers.filter(function (c) { + return c !== container; + }); + }; + + Core.prototype.setupContainer = function setupContainer(container) { + this.listenTo(container, _events2.default.CONTAINER_DESTROYED, this.removeContainer); + this.containers.push(container); + }; + + Core.prototype.setupContainers = function setupContainers(containers) { + containers.forEach(this.setupContainer.bind(this)); + this.trigger(_events2.default.CORE_CONTAINERS_CREATED); + this.renderContainers(); + this.activeContainer = containers[0]; + this.render(); + this.appendToParent(); + return this.containers; + }; + + Core.prototype.renderContainers = function renderContainers() { + var _this5 = this; + + this.containers.forEach(function (container) { + return _this5.el.appendChild(container.render().el); + }); + }; + + Core.prototype.createContainer = function createContainer(source, options) { + var container = this.containerFactory.createContainer(source, options); + this.setupContainer(container); + this.el.appendChild(container.render().el); + return container; + }; + + /** + * @deprecated + * This method currently exists for retrocompatibility reasons. + * If you want the current container reference, use the activeContainer getter. + */ + + + Core.prototype.getCurrentContainer = function getCurrentContainer() { + return this.activeContainer; + }; + + /** + * @deprecated + * This method currently exists for retrocompatibility reasons. + * If you want the current playback reference, use the activePlayback getter. + */ + + + Core.prototype.getCurrentPlayback = function getCurrentPlayback() { + return this.activePlayback; + }; + + Core.prototype.getPlaybackType = function getPlaybackType() { + return this.activeContainer && this.activeContainer.getPlaybackType(); + }; + + Core.prototype.toggleFullscreen = function toggleFullscreen() { + if (!_utils.Fullscreen.isFullscreen()) { + _utils.Fullscreen.requestFullscreen(_browser2.default.isiOS ? this.activeContainer.el : this.el); + !_browser2.default.isiOS && this.$el.addClass('fullscreen'); + } else { + _utils.Fullscreen.cancelFullscreen(); + !_browser2.default.isiOS && this.$el.removeClass('fullscreen nocursor'); + } + }; + + Core.prototype.onMouseMove = function onMouseMove(event) { + this.trigger(_events2.default.CORE_MOUSE_MOVE, event); + }; + + Core.prototype.onMouseLeave = function onMouseLeave(event) { + this.trigger(_events2.default.CORE_MOUSE_LEAVE, event); + }; + + /** + * enables to configure the container after its creation + * @method configure + * @param {Object} options all the options to change in form of a javascript object + */ + + + Core.prototype.configure = function configure(options) { + var _this6 = this; + + this._options = _clapprZepto2.default.extend(this._options, options); + this.configureDomRecycler(); + + var sources = options.source || options.sources; + sources && this.load(sources, options.mimeType || this.options.mimeType); + + this.trigger(_events2.default.CORE_OPTIONS_CHANGE); + this.containers.forEach(function (container) { + return container.configure(_this6.options); + }); + }; + + Core.prototype.appendToParent = function appendToParent() { + var hasCoreParent = this.$el.parent() && this.$el.parent().length; + !hasCoreParent && this.$el.appendTo(this.options.parentElement); + }; + + Core.prototype.render = function render() { + if (!style) style = _styler2.default.getStyleFor(_fonts2.default, { baseUrl: this.options.baseUrl }); + + (0, _clapprZepto2.default)('head').append(style); + + 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(); + + this.previousSize = { width: this.$el.width(), height: this.$el.height() }; + + this.enableResizeObserver(); + + return this; + }; + + return Core; + }(_ui_object2.default); + + exports.default = Core; + + + (0, _assign2.default)(Core.prototype, _error_mixin2.default); + module.exports = exports['default']; + + /***/ }), + /* 153 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _container_factory = __webpack_require__(154); + + var _container_factory2 = _interopRequireDefault(_container_factory); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = _container_factory2.default; + module.exports = exports['default']; + + /***/ }), + /* 154 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _typeof2 = __webpack_require__(39); + + var _typeof3 = _interopRequireDefault(_typeof2); + + var _classCallCheck2 = __webpack_require__(0); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _possibleConstructorReturn2 = __webpack_require__(1); + + var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + + var _createClass2 = __webpack_require__(3); + + var _createClass3 = _interopRequireDefault(_createClass2); + + var _inherits2 = __webpack_require__(2); + + var _inherits3 = _interopRequireDefault(_inherits2); + + var _base_object = __webpack_require__(15); + + var _base_object2 = _interopRequireDefault(_base_object); + + var _events = __webpack_require__(4); + + var _events2 = _interopRequireDefault(_events); + + var _container = __webpack_require__(80); + + var _container2 = _interopRequireDefault(_container); + + var _clapprZepto = __webpack_require__(6); + + var _clapprZepto2 = _interopRequireDefault(_clapprZepto); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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. + + /** + * The ContainerFactory is responsible for manage playback bootstrap and create containers. + */ + + 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; + } + }]); + + function ContainerFactory(options, loader, i18n, playerError) { + (0, _classCallCheck3.default)(this, ContainerFactory); + + var _this = (0, _possibleConstructorReturn3.default)(this, _BaseObject.call(this, options)); + + _this._i18n = i18n; + _this.loader = loader; + _this.playerError = playerError; + 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 ((typeof source === 'undefined' ? 'undefined' : (0, _typeof3.default)(source)) === 'object') { + 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, this.playerError); + + options = _clapprZepto2.default.extend({}, options, { playback: playback }); + + var container = new _container2.default(options, this._i18n, this.playerError); + 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']; + + /***/ }), + /* 155 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _assign = __webpack_require__(12); + + var _assign2 = _interopRequireDefault(_assign); + + var _classCallCheck2 = __webpack_require__(0); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _possibleConstructorReturn2 = __webpack_require__(1); + + var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + + var _createClass2 = __webpack_require__(3); + + var _createClass3 = _interopRequireDefault(_createClass2); + + var _inherits2 = __webpack_require__(2); + + var _inherits3 = _interopRequireDefault(_inherits2); + + var _events = __webpack_require__(4); + + var _events2 = _interopRequireDefault(_events); + + var _ui_object = __webpack_require__(30); + + var _ui_object2 = _interopRequireDefault(_ui_object); + + var _error_mixin = __webpack_require__(20); + + var _error_mixin2 = _interopRequireDefault(_error_mixin); + + __webpack_require__(156); + + var _clapprZepto = __webpack_require__(6); + + var _clapprZepto2 = _interopRequireDefault(_clapprZepto); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + /** + * 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) { + (0, _inherits3.default)(Container, _UIObject); + (0, _createClass3.default)(Container, [{ + key: 'name', + + /** + * 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' + }; + } + + /** + * Determine if the playback has ended. + * @property ended + * @type Boolean + */ + + }, { + 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 + */ + + }, { + key: 'buffering', + get: function get() { + return this.playback.buffering; + } + + /** + * The internationalization plugin. + * @property i18n + * @type {Strings} + */ + + }, { + key: 'i18n', + get: function get() { + return this._i18n; + } + + /** + * checks if has closed caption tracks. + * @property hasClosedCaptionsTracks + * @type {Boolean} + */ + + }, { + key: 'hasClosedCaptionsTracks', + get: function get() { + return this.playback.hasClosedCaptionsTracks; + } + + /** + * gets the available closed caption tracks. + * @property closedCaptionsTracks + * @type {Array} an array of objects with at least 'id' and 'name' properties + */ + + }, { + key: 'closedCaptionsTracks', + get: function get() { + return this.playback.closedCaptionsTracks; + } + + /** + * gets the selected closed caption track index. (-1 is disabled) + * @property closedCaptionsTrackId + * @type {Number} + */ + + }, { + key: 'closedCaptionsTrackId', + get: function get() { + return this.playback.closedCaptionsTrackId; + } + + /** + * sets the selected closed caption track index. (-1 is disabled) + * @property closedCaptionsTrackId + * @type {Number} + */ + , + set: function set(trackId) { + this.playback.closedCaptionsTrackId = trackId; + } + + /** + * it builds a container + * @method constructor + * @param {Object} options the options object + * @param {Strings} i18n the internationalization component + */ + + }]); + + function Container(options, i18n, playerError) { + (0, _classCallCheck3.default)(this, Container); + + var _this = (0, _possibleConstructorReturn3.default)(this, _UIObject.call(this, options)); + + _this._i18n = i18n; + _this.currentTime = 0; + _this.volume = 100; + _this.playback = options.playback; + _this.playerError = playerError; + _this.settings = _clapprZepto2.default.extend({}, _this.playback.settings); + _this.isReady = false; + _this.mediaControlDisabled = false; + _this.plugins = [_this.playback]; + _this.bindEvents(); + 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 + */ + + + 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_SEEKED, this.onSeeked); + 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_AVAILABLE, this.subtitleAvailable); + this.listenTo(this.playback, _events2.default.PLAYBACK_SUBTITLE_CHANGED, this.subtitleChanged); + }; + + Container.prototype.subtitleAvailable = function subtitleAvailable() { + this.trigger(_events2.default.CONTAINER_SUBTITLE_AVAILABLE); + }; + + Container.prototype.subtitleChanged = function subtitleChanged(track) { + this.trigger(_events2.default.CONTAINER_SUBTITLE_CHANGED, track); + }; + + 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); + }; + + Container.prototype.updateBitrate = function updateBitrate(newBitrate) { + this.trigger(_events2.default.CONTAINER_BITRATE, newBitrate); + }; + + Container.prototype.statsReport = function statsReport(metrics) { + this.trigger(_events2.default.CONTAINER_STATS_REPORT, metrics); + }; + + Container.prototype.getPlaybackType = function getPlaybackType() { + return this.playback.getPlaybackType(); + }; + + /** + * returns `true` if DVR is enable otherwise `false`. + * @method isDvrEnabled + * @return {Boolean} + */ + + + Container.prototype.isDvrEnabled = function isDvrEnabled() { + return !!this.playback.dvrEnabled; + }; + + /** + * returns `true` if DVR is in use otherwise `false`. + * @method isDvrInUse + * @return {Boolean} + */ + + + Container.prototype.isDvrInUse = function isDvrInUse() { + return !!this.dvrInUse; + }; + + /** + * destroys the container + * @method 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(); + }; + + Container.prototype.setStyle = function setStyle(style) { + this.$el.css(style); + }; + + Container.prototype.animate = function animate(style, duration) { + return this.$el.animate(style, duration).promise(); + }; + + Container.prototype.ready = function ready() { + this.isReady = true; + this.trigger(_events2.default.CONTAINER_READY, this.name); + }; + + Container.prototype.isPlaying = function isPlaying() { + return this.playback.isPlaying(); + }; + + Container.prototype.getStartTimeOffset = function getStartTimeOffset() { + return this.playback.getStartTimeOffset(); + }; + + Container.prototype.getCurrentTime = function getCurrentTime() { + return this.currentTime; + }; + + Container.prototype.getDuration = function getDuration() { + return this.playback.getDuration(); + }; + + Container.prototype.error = function error(_error) { + if (!this.isReady) this.ready(); + + this.trigger(_events2.default.CONTAINER_ERROR, _error, this.name); + }; + + Container.prototype.loadedMetadata = function loadedMetadata(metadata) { + this.trigger(_events2.default.CONTAINER_LOADEDMETADATA, metadata); + }; + + 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]; + } + + this.trigger.apply(this, [_events2.default.CONTAINER_PROGRESS].concat(args, [this.name])); + }; + + Container.prototype.playing = function playing() { + this.trigger(_events2.default.CONTAINER_PLAY, this.name); + }; + + Container.prototype.paused = function paused() { + this.trigger(_events2.default.CONTAINER_PAUSE, this.name); + }; + + /** + * plays the playback + * @method play + */ + + + Container.prototype.play = function play() { + this.playback.play(); + }; + + /** + * stops the playback + * @method stop + */ + + + Container.prototype.stop = function stop() { + this.playback.stop(); + this.currentTime = 0; + }; + + /** + * pauses the playback + * @method pause + */ + + + Container.prototype.pause = function pause() { + this.playback.pause(); + }; + + Container.prototype.onEnded = function onEnded() { + this.trigger(_events2.default.CONTAINER_ENDED, this, this.name); + this.currentTime = 0; + }; + + 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); + }; + + Container.prototype.dblClicked = function dblClicked() { + if (!this.options.chromeless || this.options.allowUserInteraction) this.trigger(_events2.default.CONTAINER_DBLCLICK, this, this.name); + }; + + 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); + }; + + Container.prototype.onSeeked = function onSeeked() { + this.trigger(_events2.default.CONTAINER_SEEKED, this.name); + }; + + Container.prototype.seekPercentage = function seekPercentage(percentage) { + var duration = this.getDuration(); + if (percentage >= 0 && percentage <= 100) { + var time = duration * (percentage / 100); + this.seek(time); + } + }; + + 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); + }; + + Container.prototype.onBuffering = function onBuffering() { + this.trigger(_events2.default.CONTAINER_STATE_BUFFERING, this.name); + }; + + Container.prototype.bufferfull = function bufferfull() { + this.trigger(_events2.default.CONTAINER_STATE_BUFFERFULL, this.name); + }; + + /** + * adds plugin to the container + * @method addPlugin + * @param {Object} plugin + */ + + + Container.prototype.addPlugin = function addPlugin(plugin) { + this.plugins.push(plugin); + }; + + /** + * checks if a plugin, given its name, exist + * @method hasPlugin + * @param {String} name + * @return {Boolean} + */ + + + Container.prototype.hasPlugin = function hasPlugin(name) { + return !!this.getPlugin(name); + }; + + /** + * get the plugin given its name + * @method getPlugin + * @param {String} name + */ + + + Container.prototype.getPlugin = function getPlugin(name) { + return this.plugins.filter(function (plugin) { + return plugin.name === name; + })[0]; + }; + + Container.prototype.mouseEnter = function mouseEnter() { + if (!this.options.chromeless || this.options.allowUserInteraction) this.trigger(_events2.default.CONTAINER_MOUSE_ENTER); + }; + + 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.playback.configure(this.options); + this.trigger(_events2.default.CONTAINER_OPTIONS_CHANGE); + }; + + Container.prototype.render = function render() { + this.$el.append(this.playback.render().el); + this.updateStyle(); + return this; + }; + + 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. + + /** + * Container is responsible for the video rendering and state + */ + + exports.default = Container; + + + (0, _assign2.default)(Container.prototype, _error_mixin2.default); + module.exports = exports['default']; + + /***/ }), + /* 156 */ + /***/ (function(module, exports, __webpack_require__) { + + + var content = __webpack_require__(157); + + if(typeof content === 'string') content = [[module.i, content, '']]; + + var transform; + var insertInto; + + + + var options = {"singleton":true,"hmr":true} + + options.transform = transform + options.insertInto = undefined; + + var update = __webpack_require__(9)(content, options); + + if(content.locals) module.exports = content.locals; + + if(false) { + module.hot.accept("!!../../../../node_modules/css-loader/index.js!../../../../node_modules/postcss-loader/lib/index.js!../../../../node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno.torres/workspace/clappr/clappr/src/base/scss!./style.scss", function() { + var newContent = require("!!../../../../node_modules/css-loader/index.js!../../../../node_modules/postcss-loader/lib/index.js!../../../../node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno.torres/workspace/clappr/clappr/src/base/scss!./style.scss"); + + if(typeof newContent === 'string') newContent = [[module.id, newContent, '']]; + + var locals = (function(a, b) { + var key, idx = 0; + + for(key in a) { + if(!b || a[key] !== b[key]) return false; + idx++; + } + + for(key in b) idx--; + + return idx === 0; + }(content.locals, newContent.locals)); + + if(!locals) throw new Error('Aborting CSS HMR due to changed css-modules locals.'); + + update(newContent); + }); + + module.hot.dispose(function() { update(); }); + } + + /***/ }), + /* 157 */ + /***/ (function(module, exports, __webpack_require__) { + + exports = module.exports = __webpack_require__(8)(false); +// imports + + +// module + exports.push([module.i, ".container[data-container] {\n position: absolute;\n background-color: black;\n height: 100%;\n width: 100%; }\n .container[data-container] .chromeless {\n cursor: default; }\n\n[data-player]:not(.nocursor) .container[data-container]:not(.chromeless).pointer-enabled {\n cursor: pointer; }\n", ""]); + +// exports + + + /***/ }), + /* 158 */ + /***/ (function(module, exports) { + + + /** + * When source maps are enabled, `style-loader` uses a link element with a data-uri to + * embed the css on the page. This breaks all relative urls because now they are relative to a + * bundle instead of the current page. + * + * One solution is to only use full urls, but that may be impossible. + * + * Instead, this function "fixes" the relative urls to be absolute according to the current page location. + * + * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command. + * + */ + + module.exports = function (css) { + // get current location + var location = typeof window !== "undefined" && window.location; + + if (!location) { + throw new Error("fixUrls requires window.location"); + } + + // blank or null? + if (!css || typeof css !== "string") { + return css; + } + + var baseUrl = location.protocol + "//" + location.host; + var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/"); + + // convert each url(...) + /* + This regular expression is just a way to recursively match brackets within + a string. + + /url\s*\( = Match on the word "url" with any whitespace after it and then a parens + ( = Start a capturing group + (?: = Start a non-capturing group + [^)(] = Match anything that isn't a parentheses + | = OR + \( = Match a start parentheses + (?: = Start another non-capturing groups + [^)(]+ = Match anything that isn't a parentheses + | = OR + \( = Match a start parentheses + [^)(]* = Match anything that isn't a parentheses + \) = Match a end parentheses + ) = End Group + *\) = Match anything and then a close parens + ) = Close non-capturing group + * = Match anything + ) = Close capturing group + \) = Match a close parens + + /gi = Get all matches, not the first. Be case insensitive. + */ + var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) { + // strip quotes (if they exist) + var unquotedOrigUrl = origUrl + .trim() + .replace(/^"(.*)"$/, function(o, $1){ return $1; }) + .replace(/^'(.*)'$/, function(o, $1){ return $1; }); + + // already a full url? no change + if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) { + return fullMatch; + } + + // convert the url to a full url + var newUrl; + + if (unquotedOrigUrl.indexOf("//") === 0) { + //TODO: should we add protocol? + newUrl = unquotedOrigUrl; + } else if (unquotedOrigUrl.indexOf("/") === 0) { + // path should be relative to the base url + newUrl = baseUrl + unquotedOrigUrl; // already starts with '/' + } else { + // path should be relative to current directory + newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './' + } + + // send back the fixed url(...) + return "url(" + JSON.stringify(newUrl) + ")"; + }); + + // send back the fixed css + return fixedCss; + }; + + + /***/ }), + /* 159 */ + /***/ (function(module, exports, __webpack_require__) { + + + var content = __webpack_require__(160); + + if(typeof content === 'string') content = [[module.i, content, '']]; + + var transform; + var insertInto; + + + + var options = {"singleton":true,"hmr":true} + + options.transform = transform + options.insertInto = undefined; + + var update = __webpack_require__(9)(content, options); + + if(content.locals) module.exports = content.locals; + + if(false) { + module.hot.accept("!!../../../../node_modules/css-loader/index.js!../../../../node_modules/postcss-loader/lib/index.js!../../../../node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno.torres/workspace/clappr/clappr/src/base/scss!./style.scss", function() { + var newContent = require("!!../../../../node_modules/css-loader/index.js!../../../../node_modules/postcss-loader/lib/index.js!../../../../node_modules/sass-loader/lib/loader.js?includePaths[]=/Users/bruno.torres/workspace/clappr/clappr/src/base/scss!./style.scss"); + + if(typeof newContent === 'string') newContent = [[module.id, newContent, '']]; + + var locals = (function(a, b) { + var key, idx = 0; + + for(key in a) { + if(!b || a[key] !== b[key]) return false; + idx++; + } + + for(key in b) idx--; + + return idx === 0; + }(content.locals, newContent.locals)); + + if(!locals) throw new Error('Aborting CSS HMR due to changed css-modules locals.'); + + update(newContent); + }); + + module.hot.dispose(function() { update(); }); + } + + /***/ }), + /* 160 */ + /***/ (function(module, exports, __webpack_require__) { + + exports = module.exports = __webpack_require__(8)(false); +// imports + + +// module + exports.push([module.i, "[data-player] {\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n -o-user-select: none;\n user-select: none;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n position: relative;\n margin: 0;\n padding: 0;\n border: 0;\n font-style: normal;\n font-weight: normal;\n text-align: center;\n overflow: hidden;\n font-size: 100%;\n font-family: \"Roboto\", \"Open Sans\", Arial, sans-serif;\n text-shadow: 0 0 0;\n box-sizing: border-box; }\n [data-player] div, [data-player] span, [data-player] applet, [data-player] object, [data-player] iframe,\n [data-player] h1, [data-player] h2, [data-player] h3, [data-player] h4, [data-player] h5, [data-player] h6, [data-player] p, [data-player] blockquote, [data-player] pre,\n [data-player] a, [data-player] abbr, [data-player] acronym, [data-player] address, [data-player] big, [data-player] cite, [data-player] code,\n [data-player] del, [data-player] dfn, [data-player] em, [data-player] img, [data-player] ins, [data-player] kbd, [data-player] q, [data-player] s, [data-player] samp,\n [data-player] small, [data-player] strike, [data-player] strong, [data-player] sub, [data-player] sup, [data-player] tt, [data-player] var,\n [data-player] b, [data-player] u, [data-player] i, [data-player] center,\n [data-player] dl, [data-player] dt, [data-player] dd, [data-player] ol, [data-player] ul, [data-player] li,\n [data-player] fieldset, [data-player] form, [data-player] label, [data-player] legend,\n [data-player] table, [data-player] caption, [data-player] tbody, [data-player] tfoot, [data-player] thead, [data-player] tr, [data-player] th, [data-player] td,\n [data-player] article, [data-player] aside, [data-player] canvas, [data-player] details, [data-player] embed,\n [data-player] figure, [data-player] figcaption, [data-player] footer, [data-player] header, [data-player] hgroup,\n [data-player] menu, [data-player] nav, [data-player] output, [data-player] ruby, [data-player] section, [data-player] summary,\n [data-player] time, [data-player] mark, [data-player] audio, [data-player] video {\n margin: 0;\n padding: 0;\n border: 0;\n font: inherit;\n font-size: 100%;\n vertical-align: baseline; }\n [data-player] table {\n border-collapse: collapse;\n border-spacing: 0; }\n [data-player] caption, [data-player] th, [data-player] td {\n text-align: left;\n font-weight: normal;\n vertical-align: middle; }\n [data-player] q, [data-player] blockquote {\n quotes: none; }\n [data-player] q:before, [data-player] q:after, [data-player] blockquote:before, [data-player] blockquote:after {\n content: \"\";\n content: none; }\n [data-player] a img {\n border: none; }\n [data-player]:focus {\n outline: 0; }\n [data-player] * {\n max-width: none;\n box-sizing: inherit;\n float: none; }\n [data-player] div {\n display: block; }\n [data-player].fullscreen {\n width: 100% !important;\n height: 100% !important;\n top: 0;\n left: 0; }\n [data-player].nocursor {\n cursor: none; }\n\n.clappr-style {\n display: none !important; }\n", ""]); + +// exports + + + /***/ }), + /* 161 */ + /***/ (function(module, exports, __webpack_require__) { + + var escape = __webpack_require__(81); + exports = module.exports = __webpack_require__(8)(false); +// imports + + +// module + exports.push([module.i, "@font-face {\n font-family: \"Roboto\";\n font-style: normal;\n font-weight: 400;\n src: local(\"Roboto\"), local(\"Roboto-Regular\"), url(" + escape(__webpack_require__(162)) + ") format(\"truetype\");\n}\n", ""]); + +// exports + + + /***/ }), + /* 162 */ + /***/ (function(module, exports) { + + module.exports = "<%=baseUrl%>/38861cba61c66739c1452c3a71e39852.ttf"; + + /***/ }), + /* 163 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _create = __webpack_require__(76); + + var _create2 = _interopRequireDefault(_create); + + var _toConsumableArray2 = __webpack_require__(61); + + var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2); + + var _classCallCheck2 = __webpack_require__(0); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _possibleConstructorReturn2 = __webpack_require__(1); + + var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + + var _inherits2 = __webpack_require__(2); + + var _inherits3 = _interopRequireDefault(_inherits2); + + var _base_object = __webpack_require__(15); + + var _base_object2 = _interopRequireDefault(_base_object); + + var _player_info = __webpack_require__(40); + + var _player_info2 = _interopRequireDefault(_player_info); + + var _html5_video = __webpack_require__(41); + + var _html5_video2 = _interopRequireDefault(_html5_video); + + var _flash = __webpack_require__(84); + + var _flash2 = _interopRequireDefault(_flash); + + var _html5_audio = __webpack_require__(85); + + var _html5_audio2 = _interopRequireDefault(_html5_audio); + + var _flashls = __webpack_require__(86); + + var _flashls2 = _interopRequireDefault(_flashls); + + var _hls = __webpack_require__(87); + + var _hls2 = _interopRequireDefault(_hls); + + var _html_img = __webpack_require__(89); + + var _html_img2 = _interopRequireDefault(_html_img); + + var _no_op = __webpack_require__(90); + + var _no_op2 = _interopRequireDefault(_no_op); + + var _spinner_three_bounce = __webpack_require__(91); + + var _spinner_three_bounce2 = _interopRequireDefault(_spinner_three_bounce); + + var _stats = __webpack_require__(200); + + var _stats2 = _interopRequireDefault(_stats); + + var _watermark = __webpack_require__(92); + + var _watermark2 = _interopRequireDefault(_watermark); + + var _poster = __webpack_require__(93); + + var _poster2 = _interopRequireDefault(_poster); + + var _google_analytics = __webpack_require__(210); + + var _google_analytics2 = _interopRequireDefault(_google_analytics); + + var _click_to_pause = __webpack_require__(94); + + var _click_to_pause2 = _interopRequireDefault(_click_to_pause); + + var _media_control = __webpack_require__(95); + + var _media_control2 = _interopRequireDefault(_media_control); + + var _dvr_controls = __webpack_require__(98); + + var _dvr_controls2 = _interopRequireDefault(_dvr_controls); + + var _closed_captions = __webpack_require__(227); + + var _closed_captions2 = _interopRequireDefault(_closed_captions); + + var _favicon = __webpack_require__(99); + + var _favicon2 = _interopRequireDefault(_favicon); + + var _seek_time = __webpack_require__(234); + + var _seek_time2 = _interopRequireDefault(_seek_time); + + var _sources = __webpack_require__(239); + + var _sources2 = _interopRequireDefault(_sources); + + var _end_video = __webpack_require__(240); + + var _end_video2 = _interopRequireDefault(_end_video); + + var _strings = __webpack_require__(241); + + var _strings2 = _interopRequireDefault(_strings); + + var _error_screen = __webpack_require__(242); + + var _error_screen2 = _interopRequireDefault(_error_screen); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + /** + * 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 + */ + + + /* 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 Loader = function (_BaseObject) { + (0, _inherits3.default)(Loader, _BaseObject); + + /** + * 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() { + var externalPlugins = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + var playerId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var useOnlyPlainHtml5Plugins = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + (0, _classCallCheck3.default)(this, Loader); + + var _this = (0, _possibleConstructorReturn3.default)(this, _BaseObject.call(this)); + + _this.playerId = playerId; + _this.playbackPlugins = []; + + if (!useOnlyPlainHtml5Plugins) { + _this.playbackPlugins = [].concat((0, _toConsumableArray3.default)(_this.playbackPlugins), [_hls2.default]); + } + + _this.playbackPlugins = [].concat((0, _toConsumableArray3.default)(_this.playbackPlugins), [_html5_video2.default, _html5_audio2.default]); + + if (!useOnlyPlainHtml5Plugins) { + _this.playbackPlugins = [].concat((0, _toConsumableArray3.default)(_this.playbackPlugins), [_flash2.default, _flashls2.default]); + } + + _this.playbackPlugins = [].concat((0, _toConsumableArray3.default)(_this.playbackPlugins), [_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 = [_media_control2.default, _dvr_controls2.default, _closed_captions2.default, _favicon2.default, _seek_time2.default, _sources2.default, _end_video2.default, _error_screen2.default, _strings2.default]; + + 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; + }; + + 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 plugins = []; + for (var key in pluginsMap) { + plugins.unshift(pluginsMap[key]); + }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); + 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)); + + _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); + + /* Core Plugins */ + + + /* Container Plugins */ + + + exports.default = Loader; + module.exports = exports['default']; + + /***/ }), + /* 164 */ + /***/ (function(module, exports, __webpack_require__) { + + __webpack_require__(71); + __webpack_require__(165); + module.exports = __webpack_require__(11).Array.from; + + /***/ }), + /* 165 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var ctx = __webpack_require__(44) + , $export = __webpack_require__(16) + , toObject = __webpack_require__(38) + , call = __webpack_require__(166) + , isArrayIter = __webpack_require__(167) + , toLength = __webpack_require__(69) + , createProperty = __webpack_require__(168) + , getIterFn = __webpack_require__(169); + + $export($export.S + $export.F * !__webpack_require__(171)(function(iter){ Array.from(iter); }), 'Array', { + // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) + from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){ + var O = toObject(arrayLike) + , C = typeof this == 'function' ? this : Array + , aLen = arguments.length + , mapfn = aLen > 1 ? arguments[1] : undefined + , mapping = mapfn !== undefined + , index = 0 + , iterFn = getIterFn(O) + , length, result, step, iterator; + if(mapping)mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); + // if object isn't iterable or it's array with default iterator - use simple case + if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){ + for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){ + createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value); + } + } else { + length = toLength(O.length); + for(result = new C(length); length > index; index++){ + createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); + } + } + result.length = index; + return result; + } + }); + + + /***/ }), + /* 166 */ + /***/ (function(module, exports, __webpack_require__) { + +// call something on iterator step with safe closing on error + var anObject = __webpack_require__(26); + module.exports = function(iterator, fn, value, entries){ + try { + return entries ? fn(anObject(value)[0], value[1]) : fn(value); + // 7.4.6 IteratorClose(iterator, completion) + } catch(e){ + var ret = iterator['return']; + if(ret !== undefined)anObject(ret.call(iterator)); + throw e; + } + }; + + /***/ }), + /* 167 */ + /***/ (function(module, exports, __webpack_require__) { + +// check on default Array iterator + var Iterators = __webpack_require__(34) + , ITERATOR = __webpack_require__(13)('iterator') + , ArrayProto = Array.prototype; + + module.exports = function(it){ + return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); + }; + + /***/ }), + /* 168 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + var $defineProperty = __webpack_require__(18) + , createDesc = __webpack_require__(33); + + module.exports = function(object, index, value){ + if(index in object)$defineProperty.f(object, index, createDesc(0, value)); + else object[index] = value; + }; + + /***/ }), + /* 169 */ + /***/ (function(module, exports, __webpack_require__) { + + var classof = __webpack_require__(170) + , ITERATOR = __webpack_require__(13)('iterator') + , Iterators = __webpack_require__(34); + module.exports = __webpack_require__(11).getIteratorMethod = function(it){ + if(it != undefined)return it[ITERATOR] + || it['@@iterator'] + || Iterators[classof(it)]; + }; + + /***/ }), + /* 170 */ + /***/ (function(module, exports, __webpack_require__) { + +// getting tag from 19.1.3.6 Object.prototype.toString() + var cof = __webpack_require__(46) + , TAG = __webpack_require__(13)('toStringTag') + // ES3 wrong here + , ARG = cof(function(){ return arguments; }()) == 'Arguments'; + +// fallback for IE11 Script Access Denied error + var tryGet = function(it, key){ + try { + return it[key]; + } catch(e){ /* empty */ } + }; + + module.exports = function(it){ + var O, T, B; + return it === undefined ? 'Undefined' : it === null ? 'Null' + // @@toStringTag case + : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T + // builtinTag case + : ARG ? cof(O) + // ES3 arguments fallback + : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; + }; + + /***/ }), + /* 171 */ + /***/ (function(module, exports, __webpack_require__) { + + var ITERATOR = __webpack_require__(13)('iterator') + , SAFE_CLOSING = false; + + try { + var riter = [7][ITERATOR](); + riter['return'] = function(){ SAFE_CLOSING = true; }; + Array.from(riter, function(){ throw 2; }); + } catch(e){ /* empty */ } + + module.exports = function(exec, skipClosing){ + if(!skipClosing && !SAFE_CLOSING)return false; + var safe = false; + try { + var arr = [7] + , iter = arr[ITERATOR](); + iter.next = function(){ return {done: safe = true}; }; + arr[ITERATOR] = function(){ return iter; }; + exec(arr); + } catch(e){ /* empty */ } + return safe; + }; + + /***/ }), + /* 172 */ + /***/ (function(module, exports, __webpack_require__) { + + "use strict"; + /* WEBPACK VAR INJECTION */(function(process) { + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _from = __webpack_require__(83); + + var _from2 = _interopRequireDefault(_from); + + var _classCallCheck2 = __webpack_require__(0); + + var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); + + var _possibleConstructorReturn2 = __webpack_require__(1); + + var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); + + var _createClass2 = __webpack_require__(3); + + var _createClass3 = _interopRequireDefault(_createClass2); + + var _inherits2 = __webpack_require__(2); + + var _inherits3 = _interopRequireDefault(_inherits2); + + var _toConsumableArray2 = __webpack_require__(61); + + var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2); + + var _keys = __webpack_require__(53); + + var _keys2 = _interopRequireDefault(_keys); + + var _utils = __webpack_require__(5); + + var _playback = __webpack_require__(10); + + var _playback2 = _interopRequireDefault(_playback); + + var _browser = __webpack_require__(14); + + var _browser2 = _interopRequireDefault(_browser); + + var _error = __webpack_require__(24); + + var _error2 = _interopRequireDefault(_error); + + var _events = __webpack_require__(4); + + var _events2 = _interopRequireDefault(_events); + + var _log = __webpack_require__(29); + + var _log2 = _interopRequireDefault(_log); + + var _clapprZepto = __webpack_require__(6); + + var _clapprZepto2 = _interopRequireDefault(_clapprZepto); + + var _template = __webpack_require__(7); + + var _template2 = _interopRequireDefault(_template); + + var _tracks = __webpack_require__(173); + + var _tracks2 = _interopRequireDefault(_tracks); + + __webpack_require__(174); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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 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 = (0, _keys2.default)(AUDIO_MIMETYPES).reduce(function (acc, k) { + return [].concat((0, _toConsumableArray3.default)(acc), (0, _toConsumableArray3.default)(AUDIO_MIMETYPES[k])); + }, []); + + var UNKNOWN_ERROR = { code: 'unknown', message: 'unknown' + + // TODO: rename this Playback to HTML5Playback (breaking change, only after 0.3.0) + }; + var HTML5Video = function (_Playback) { + (0, _inherits3.default)(HTML5Video, _Playback); + (0, _createClass3.default)(HTML5Video, [{ + key: 'name', + get: function get() { + return 'html5_video'; + } + }, { + key: 'tagName', + get: function get() { + return this.isAudioOnly ? 'audio' : 'video'; + } + }, { + key: 'isAudioOnly', + 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; + } + }, { + key: 'attributes', + get: function get() { + return { + 'data-html5-video': '' + }; + } + }, { + key: 'events', + get: function get() { + return { + 'canplay': '_onCanPlay', + 'canplaythrough': '_handleBufferingEvents', + 'durationchange': '_onDurationChange', + 'ended': '_onEnded', + 'error': '_onError', + 'loadeddata': '_onLoadedData', + 'loadedmetadata': '_onLoadedMetadata', + 'pause': '_onPause', + 'playing': '_onPlaying', + 'progress': '_onProgress', + 'seeking': '_onSeeking', + 'seeked': '_onSeeked', + 'stalled': '_handleBufferingEvents', + 'timeupdate': '_onTimeUpdate', + 'waiting': '_onWaiting' + }; + } + + /** + * Determine if the playback has ended. + * @property ended + * @type Boolean + */ + + }, { + key: 'ended', + get: function get() { + return this.el.ended; + } + + /** + * Determine if the playback is having to buffer in order for + * playback to be smooth. + * This is related to the PLAYBACK_BUFFERING and PLAYBACK_BUFFERFULL events + * @property buffering + * @type Boolean + */ + + }, { + key: 'buffering', + get: function get() { + return this._isBuffering; + } + }]); + + function HTML5Video() { + (0, _classCallCheck3.default)(this, HTML5Video); + + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + var _this = (0, _possibleConstructorReturn3.default)(this, _Playback.call.apply(_Playback, [this].concat(args))); + + _this._destroyed = false; + _this._loadStarted = false; + _this._isBuffering = false; + _this._playheadMoving = false; + _this._playheadMovingTimer = null; + _this._stopped = false; + _this._ccTrackId = -1; + _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, { + muted: _this.options.mute, + defaultMuted: _this.options.mute, + loop: _this.options.loop, + poster: posterUrl, + preload: preload || 'metadata', + controls: (playbackConfig.controls || _this.options.useVideoTagDefaultControls) && 'controls', + crossOrigin: playbackConfig.crossOrigin, + 'x-webkit-playsinline': playbackConfig.playInline + }); + + playbackConfig.playInline && _this.$el.attr({ playsinline: 'playsinline' }); + playbackConfig.crossOrigin && _this.$el.attr({ crossorigin: playbackConfig.crossOrigin }); + + // TODO should settings be private? + _this.settings = { default: ['seekbar'] }; + _this.settings.left = ['playpause', 'position', 'duration']; + _this.settings.right = ['fullscreen', 'volume', 'hd-indicator']; + + playbackConfig.externalTracks && _this._setupExternalTracks(playbackConfig.externalTracks); + + _this.options.autoPlay && _this.attemptAutoPlay(); + return _this; + } + + // See Playback.attemptAutoPlay() + + + HTML5Video.prototype.attemptAutoPlay = function attemptAutoPlay() { + var _this2 = this; + + this.canAutoPlay(function (result, error) { + error && _log2.default.warn(_this2.name, 'autoplay error.', { result: result, error: error }); + + // https://github.com/clappr/clappr/issues/1076 + result && process.nextTick(function () { + return !_this2._destroyed && _this2.play(); + }); + }); + }; + + // See Playback.canAutoPlay() + + + HTML5Video.prototype.canAutoPlay = function canAutoPlay(cb) { + if (this.options.disableCanAutoPlay) cb(true, null); + + var opts = { + timeout: this.options.autoPlayTimeout || 500, + inline: this.options.playback.playInline || false, + muted: this.options.mute || false // Known issue: mediacontrols may asynchronously mute video + + + // Use current video element if recycling feature enabled with mobile devices + };if (_browser2.default.isMobile && _utils.DomRecycler.options.recycleVideo) opts.element = this.el; + + // Desktop browser autoplay policy may require user action + // Mobile browser autoplay require user consent and video recycling feature enabled + // It may returns a false positive with source-less player consent + (0, _utils.canAutoPlayMedia)(cb, opts); + }; + + HTML5Video.prototype._setupExternalTracks = function _setupExternalTracks(tracks) { + this._externalTracks = tracks.map(function (track) { + return { + kind: track.kind || 'subtitles', // Default is 'subtitles' + label: track.label, + lang: track.lang, + src: track.src + }; + }); + }; + + /** + * Sets the source url on the