diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bc5d8f2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +css/mejs-controls.svg +css/myplayer.min.css +css/playlist-controls.svg diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..77cc86a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "mediaelement"] + path = mediaelement + url = https://github.com/mediaelement/mediaelement.git +[submodule "mediaelement-plugins"] + path = mediaelement-plugins + url = https://github.com/mediaelement/mediaelement-plugins.git diff --git a/css/ajax-loader.gif b/css/ajax-loader.gif deleted file mode 100644 index 6d7e82e..0000000 Binary files a/css/ajax-loader.gif and /dev/null differ diff --git a/css/background.png b/css/background.png deleted file mode 100644 index fd42841..0000000 Binary files a/css/background.png and /dev/null differ diff --git a/css/bigplay.png b/css/bigplay.png deleted file mode 100644 index 694553e..0000000 Binary files a/css/bigplay.png and /dev/null differ diff --git a/css/bigplay.svg b/css/bigplay.svg deleted file mode 100644 index c2f62bb..0000000 --- a/css/bigplay.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/css/build.sh b/css/build.sh new file mode 100755 index 0000000..cf085be --- /dev/null +++ b/css/build.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# MyPlayer - Copyright 2014 - 2024 tilt@linuxfoo.de GPLv3 +# Build Script; generates a minified collective CSS file + +dir=$(readlink -f "$(dirname "$0")") + +if ! cd "$dir" ; then + echo "ERROR: Could not change working directory; aborted." >&2 ; + exit 1 ; +elif [[ -z $(type -p r.js) ]] ; then + echo "ERROR: r.js optimizer not found; install it using 'npm install -g requirejs'." >&2 + exit 1 +elif ! r.js -o cssIn=myplayer.css out=myplayer.min.css optimizeCss=standard.keepComments.keepLines ; then + echo "ERROR: r.js failed; aborted." >&2 + exit 1 +else + sed -i -e 's|../mediaelement-plugins/dist/playlist/||' myplayer.min.css + chmod 0644 myplayer.min.css + + echo "INFO: Minimized CSS to $dir/myplayer.min.css" >&2 + + for svg in \ + ../mediaelement-plugins/dist/playlist/playlist-controls.svg \ + ../mediaelement/build/mejs-controls.svg + do + svg_out="$dir/$(basename "$svg")" + + if ! cp "$svg" "$svg_out" ; then + echo "ERROR: Copying controls SVG $svg failed; aborted." >&2 + exit 1 + else + echo "INFO: Copied controls SVG to $svg_out" >&2 + fi + done +fi diff --git a/css/controls-playlist.png b/css/controls-playlist.png deleted file mode 100644 index 44a3c61..0000000 Binary files a/css/controls-playlist.png and /dev/null differ diff --git a/css/controls.png b/css/controls.png deleted file mode 100644 index f6a857d..0000000 Binary files a/css/controls.png and /dev/null differ diff --git a/css/controls.svg b/css/controls.svg deleted file mode 100644 index af3bd41..0000000 --- a/css/controls.svg +++ /dev/null @@ -1 +0,0 @@ - cc \ No newline at end of file diff --git a/css/custom.css b/css/custom.css deleted file mode 100644 index e69de29..0000000 diff --git a/css/local.css b/css/local.css index c5c3289..863a3b0 100644 --- a/css/local.css +++ b/css/local.css @@ -1,69 +1,4 @@ -html { - overflow: hidden; - height: 100% -} -body { - background: black; -} -.mejs-audio { -} -.mejs-controls { - top: 0!important; - padding: 3px 0 0 0; - height: 2em!important; - background: none!important; - border-top: 2em!important; -} -.mejs-controls .mejs-time-rail .mejs-time-loaded { - background: #5a1a7a!important; -} -.mejs-controls .mejs-time-rail .mejs-time-float { - top: 2.5em!important; -} -.mejs-controls .mejs-time-rail .mejs-time-float .mejs-time-float-corner { - display: none!important; -} -.mejs li { - font-size: 0.8em!important; - line-height: 1em!important; - color: #ccddff; -} -.mejs-playlist { - width: 430px!important; - height: 265px!important; -} -.popupButton { - display: inline-block!important; - position: absolute; - top: 2px; -} -.popupButton button { - overflow: hidden; - width: 25px; - height: 22px; - padding: 0; - margin: 0; - border: 0; - background: url(popup.png); - cursor: pointer; -} -.playerDetached { - margin: 0; - padding: 0; - height: 100%; - width: 100%; - text-align: center; - font-size: small; - font-family: sans-serif; - color: #cacaca; -} -.ajaxLoader { - width: 16px; - height: 16px; - display: inline-block; - background: url(ajax-loader.gif); -} -noscript { - color: white; - font-family: sans-serif; +.mejs__playlist-selector-list-item, .mejs-playlist-selector-list-item { + margin-top: -5px; + border-bottom: none; } diff --git a/css/mep-feature-playlist.css b/css/mep-feature-playlist.css deleted file mode 100644 index 48381b6..0000000 --- a/css/mep-feature-playlist.css +++ /dev/null @@ -1,68 +0,0 @@ -/* - Document : mep-feature-playlist.css - Author : Andrew Berezovsky - Original Author : Junaid Qadir Baloch -*/ - -/* Start: Show/Hide Playlist*/ -.mejs-controls .mejs-show-playlist button { - background: transparent url(controls-playlist.png) no-repeat; - background-position: -16px -16px; -} -.mejs-controls .mejs-hide-playlist button { - background: transparent url(controls-playlist.png) no-repeat; - background-position: -16px 0; -} -/* End: Show/Hide Playlist */ - -/* Start: Previous */ -.mejs-controls .mejs-prevtrack button { - background: transparent url(controls-playlist.png) no-repeat; - background-position: 0 -16px; -} -/* End: Previous */ - -/* Start: Next */ -.mejs-controls .mejs-nexttrack button { - background: transparent url(controls-playlist.png) no-repeat; -} -/* End: Next */ - -/* Start: Shuffle */ -.mejs-controls .mejs-shuffle-on button { - background: transparent url(controls-playlist.png) no-repeat; - background-position: -32px 0; -} -.mejs-controls .mejs-shuffle-off button { - background: transparent url(controls-playlist.png) no-repeat; - background-position: -32px -16px; -} -/* End: Shuffle */ - -/*Start: Playlist*/ -.mejs-playlist { - position: absolute; - left: 0; - height: 200px!important; - overflow-y: auto; -} -.mejs-playlist ul { - margin: 0; - padding: 5px; -} -.mejs-playlist li { - color: white; - font-size: 11px; - height: 16px; - overflow: hidden; - margin: 2px; - cursor: pointer; -} -.mejs-playlist li:hover { - color: #a8a8a8; -} -.mejs-playlist li.current { - color: white; - font-weight: bold; -} -/*End: Playlist*/ diff --git a/css/myplayer.css b/css/myplayer.css index d0b2310..da476c2 100644 --- a/css/myplayer.css +++ b/css/myplayer.css @@ -1,3 +1,3 @@ -@import url('mediaelementplayer.css'); -@import url('mep-feature-playlist.css'); +@import url('../mediaelement/build/mediaelementplayer.css'); +@import url('../mediaelement-plugins/dist/playlist/playlist.css'); @import url('local.css'); diff --git a/css/popup.png b/css/popup.png deleted file mode 100644 index 701a757..0000000 Binary files a/css/popup.png and /dev/null differ diff --git a/js/myplayer.js b/js/myplayer.js new file mode 100644 index 0000000..6992f25 --- /dev/null +++ b/js/myplayer.js @@ -0,0 +1,8673 @@ +/*! + * MediaElement.js + * http://www.mediaelementjs.com/ + * + * Wrapper that mimics native HTML5 MediaElement (audio and video) + * using a variety of technologies (pure JavaScript, iframe) + * + * Copyright 2010-2017, John Dyer (http://j.hn/) + * License: MIT + * + */(function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o collection + for (// get the cached index + var index = 0; index < uses.length; ) { + // get the current + var use = uses[index], parent = use.parentNode, svg = getSVGAncestor(parent), src = use.getAttribute("xlink:href") || use.getAttribute("href"); + if (!src && opts.attributeName && (src = use.getAttribute(opts.attributeName)), + svg && src) { + if (polyfill) { + if (!opts.validate || opts.validate(src, svg, use)) { + // remove the element + parent.removeChild(use); + // parse the src and get the url and id + var srcSplit = src.split("#"), url = srcSplit.shift(), id = srcSplit.join("#"); + // if the link is external + if (url.length) { + // get the cached xhr request + var xhr = requests[url]; + // ensure the xhr request exists + xhr || (xhr = requests[url] = new XMLHttpRequest(), xhr.open("GET", url), xhr.send(), + xhr._embeds = []), // add the svg and id as an item to the xhr embeds list + xhr._embeds.push({ + parent: parent, + svg: svg, + id: id + }), // prepare the xhr ready state change event + loadreadystatechange(xhr); + } else { + // embed the local id into the svg + embed(parent, svg, document.getElementById(id)); + } + } else { + // increase the index when the previous value was not "valid" + ++index, ++numberOfSvgUseElementsToBypass; + } + } + } else { + // increase the index when the previous value was not "valid" + ++index; + } + } + // continue the interval + (!uses.length || uses.length - numberOfSvgUseElementsToBypass > 0) && requestAnimationFrame(oninterval, 67); + } + var polyfill, opts = Object(rawopts), newerIEUA = /\bTrident\/[567]\b|\bMSIE (?:9|10)\.0\b/, webkitUA = /\bAppleWebKit\/(\d+)\b/, olderEdgeUA = /\bEdge\/12\.(\d+)\b/, edgeUA = /\bEdge\/.(\d+)\b/, inIframe = window.top !== window.self; + polyfill = "polyfill" in opts ? opts.polyfill : newerIEUA.test(navigator.userAgent) || (navigator.userAgent.match(olderEdgeUA) || [])[1] < 10547 || (navigator.userAgent.match(webkitUA) || [])[1] < 537 || edgeUA.test(navigator.userAgent) && inIframe; + // create xhr requests object + var requests = {}, requestAnimationFrame = window.requestAnimationFrame || setTimeout, uses = document.getElementsByTagName("use"), numberOfSvgUseElementsToBypass = 0; + // conditionally start the interval if the polyfill is active + polyfill && oninterval(); + } + function getSVGAncestor(node) { + for (var svg = node; "svg" !== svg.nodeName.toLowerCase() && (svg = svg.parentNode); ) {} + return svg; + } + return svg4everybody; +}); +},{}],6:[function(_dereq_,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +var _mejs = _dereq_(8); + +var _mejs2 = _interopRequireDefault(_mejs); + +var _en = _dereq_(16); + +var _general = _dereq_(26); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var i18n = { lang: 'en', en: _en.EN }; + +i18n.language = function () { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + if (args !== null && args !== undefined && args.length) { + + if (typeof args[0] !== 'string') { + throw new TypeError('Language code must be a string value'); + } + + if (!/^[a-z]{2,3}((\-|_)[a-z]{2})?$/i.test(args[0])) { + throw new TypeError('Language code must have format 2-3 letters and. optionally, hyphen, underscore followed by 2 more letters'); + } + + i18n.lang = args[0]; + + if (i18n[args[0]] === undefined) { + args[1] = args[1] !== null && args[1] !== undefined && _typeof(args[1]) === 'object' ? args[1] : {}; + i18n[args[0]] = !(0, _general.isObjectEmpty)(args[1]) ? args[1] : _en.EN; + } else if (args[1] !== null && args[1] !== undefined && _typeof(args[1]) === 'object') { + i18n[args[0]] = args[1]; + } + } + + return i18n.lang; +}; + +i18n.t = function (message) { + var pluralParam = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + + + if (typeof message === 'string' && message.length) { + + var str = void 0, + pluralForm = void 0; + + var language = i18n.language(); + + var _plural = function _plural(input, number, form) { + + if ((typeof input === 'undefined' ? 'undefined' : _typeof(input)) !== 'object' || typeof number !== 'number' || typeof form !== 'number') { + return input; + } + + var _pluralForms = function () { + return [function () { + return arguments.length <= 1 ? undefined : arguments[1]; + }, function () { + return (arguments.length <= 0 ? undefined : arguments[0]) === 1 ? arguments.length <= 1 ? undefined : arguments[1] : arguments.length <= 2 ? undefined : arguments[2]; + }, function () { + return (arguments.length <= 0 ? undefined : arguments[0]) === 0 || (arguments.length <= 0 ? undefined : arguments[0]) === 1 ? arguments.length <= 1 ? undefined : arguments[1] : arguments.length <= 2 ? undefined : arguments[2]; + }, function () { + if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 === 1 && (arguments.length <= 0 ? undefined : arguments[0]) % 100 !== 11) { + return arguments.length <= 1 ? undefined : arguments[1]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) !== 0) { + return arguments.length <= 2 ? undefined : arguments[2]; + } else { + return arguments.length <= 3 ? undefined : arguments[3]; + } + }, function () { + if ((arguments.length <= 0 ? undefined : arguments[0]) === 1 || (arguments.length <= 0 ? undefined : arguments[0]) === 11) { + return arguments.length <= 1 ? undefined : arguments[1]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 2 || (arguments.length <= 0 ? undefined : arguments[0]) === 12) { + return arguments.length <= 2 ? undefined : arguments[2]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) > 2 && (arguments.length <= 0 ? undefined : arguments[0]) < 20) { + return arguments.length <= 3 ? undefined : arguments[3]; + } else { + return arguments.length <= 4 ? undefined : arguments[4]; + } + }, function () { + if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { + return arguments.length <= 1 ? undefined : arguments[1]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 0 || (arguments.length <= 0 ? undefined : arguments[0]) % 100 > 0 && (arguments.length <= 0 ? undefined : arguments[0]) % 100 < 20) { + return arguments.length <= 2 ? undefined : arguments[2]; + } else { + return arguments.length <= 3 ? undefined : arguments[3]; + } + }, function () { + if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 === 1 && (arguments.length <= 0 ? undefined : arguments[0]) % 100 !== 11) { + return arguments.length <= 1 ? undefined : arguments[1]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 >= 2 && ((arguments.length <= 0 ? undefined : arguments[0]) % 100 < 10 || (arguments.length <= 0 ? undefined : arguments[0]) % 100 >= 20)) { + return arguments.length <= 2 ? undefined : arguments[2]; + } else { + return [3]; + } + }, function () { + if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 === 1 && (arguments.length <= 0 ? undefined : arguments[0]) % 100 !== 11) { + return arguments.length <= 1 ? undefined : arguments[1]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 >= 2 && (arguments.length <= 0 ? undefined : arguments[0]) % 10 <= 4 && ((arguments.length <= 0 ? undefined : arguments[0]) % 100 < 10 || (arguments.length <= 0 ? undefined : arguments[0]) % 100 >= 20)) { + return arguments.length <= 2 ? undefined : arguments[2]; + } else { + return arguments.length <= 3 ? undefined : arguments[3]; + } + }, function () { + if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { + return arguments.length <= 1 ? undefined : arguments[1]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) >= 2 && (arguments.length <= 0 ? undefined : arguments[0]) <= 4) { + return arguments.length <= 2 ? undefined : arguments[2]; + } else { + return arguments.length <= 3 ? undefined : arguments[3]; + } + }, function () { + if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { + return arguments.length <= 1 ? undefined : arguments[1]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 >= 2 && (arguments.length <= 0 ? undefined : arguments[0]) % 10 <= 4 && ((arguments.length <= 0 ? undefined : arguments[0]) % 100 < 10 || (arguments.length <= 0 ? undefined : arguments[0]) % 100 >= 20)) { + return arguments.length <= 2 ? undefined : arguments[2]; + } else { + return arguments.length <= 3 ? undefined : arguments[3]; + } + }, function () { + if ((arguments.length <= 0 ? undefined : arguments[0]) % 100 === 1) { + return arguments.length <= 2 ? undefined : arguments[2]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 100 === 2) { + return arguments.length <= 3 ? undefined : arguments[3]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 100 === 3 || (arguments.length <= 0 ? undefined : arguments[0]) % 100 === 4) { + return arguments.length <= 4 ? undefined : arguments[4]; + } else { + return arguments.length <= 1 ? undefined : arguments[1]; + } + }, function () { + if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { + return arguments.length <= 1 ? undefined : arguments[1]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 2) { + return arguments.length <= 2 ? undefined : arguments[2]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) > 2 && (arguments.length <= 0 ? undefined : arguments[0]) < 7) { + return arguments.length <= 3 ? undefined : arguments[3]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) > 6 && (arguments.length <= 0 ? undefined : arguments[0]) < 11) { + return arguments.length <= 4 ? undefined : arguments[4]; + } else { + return arguments.length <= 5 ? undefined : arguments[5]; + } + }, function () { + if ((arguments.length <= 0 ? undefined : arguments[0]) === 0) { + return arguments.length <= 1 ? undefined : arguments[1]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { + return arguments.length <= 2 ? undefined : arguments[2]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 2) { + return arguments.length <= 3 ? undefined : arguments[3]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 100 >= 3 && (arguments.length <= 0 ? undefined : arguments[0]) % 100 <= 10) { + return arguments.length <= 4 ? undefined : arguments[4]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 100 >= 11) { + return arguments.length <= 5 ? undefined : arguments[5]; + } else { + return arguments.length <= 6 ? undefined : arguments[6]; + } + }, function () { + if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { + return arguments.length <= 1 ? undefined : arguments[1]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 0 || (arguments.length <= 0 ? undefined : arguments[0]) % 100 > 1 && (arguments.length <= 0 ? undefined : arguments[0]) % 100 < 11) { + return arguments.length <= 2 ? undefined : arguments[2]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 100 > 10 && (arguments.length <= 0 ? undefined : arguments[0]) % 100 < 20) { + return arguments.length <= 3 ? undefined : arguments[3]; + } else { + return arguments.length <= 4 ? undefined : arguments[4]; + } + }, function () { + if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 === 1) { + return arguments.length <= 1 ? undefined : arguments[1]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 === 2) { + return arguments.length <= 2 ? undefined : arguments[2]; + } else { + return arguments.length <= 3 ? undefined : arguments[3]; + } + }, function () { + return (arguments.length <= 0 ? undefined : arguments[0]) !== 11 && (arguments.length <= 0 ? undefined : arguments[0]) % 10 === 1 ? arguments.length <= 1 ? undefined : arguments[1] : arguments.length <= 2 ? undefined : arguments[2]; + }, function () { + if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { + return arguments.length <= 1 ? undefined : arguments[1]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 >= 2 && (arguments.length <= 0 ? undefined : arguments[0]) % 10 <= 4 && ((arguments.length <= 0 ? undefined : arguments[0]) % 100 < 10 || (arguments.length <= 0 ? undefined : arguments[0]) % 100 >= 20)) { + return arguments.length <= 2 ? undefined : arguments[2]; + } else { + return arguments.length <= 3 ? undefined : arguments[3]; + } + }, function () { + if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { + return arguments.length <= 1 ? undefined : arguments[1]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 2) { + return arguments.length <= 2 ? undefined : arguments[2]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) !== 8 && (arguments.length <= 0 ? undefined : arguments[0]) !== 11) { + return arguments.length <= 3 ? undefined : arguments[3]; + } else { + return arguments.length <= 4 ? undefined : arguments[4]; + } + }, function () { + return (arguments.length <= 0 ? undefined : arguments[0]) === 0 ? arguments.length <= 1 ? undefined : arguments[1] : arguments.length <= 2 ? undefined : arguments[2]; + }, function () { + if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { + return arguments.length <= 1 ? undefined : arguments[1]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 2) { + return arguments.length <= 2 ? undefined : arguments[2]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 3) { + return arguments.length <= 3 ? undefined : arguments[3]; + } else { + return arguments.length <= 4 ? undefined : arguments[4]; + } + }, function () { + if ((arguments.length <= 0 ? undefined : arguments[0]) === 0) { + return arguments.length <= 1 ? undefined : arguments[1]; + } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { + return arguments.length <= 2 ? undefined : arguments[2]; + } else { + return arguments.length <= 3 ? undefined : arguments[3]; + } + }]; + }(); + + return _pluralForms[form].apply(null, [number].concat(input)); + }; + + if (i18n[language] !== undefined) { + str = i18n[language][message]; + if (pluralParam !== null && typeof pluralParam === 'number') { + pluralForm = i18n[language]['mejs.plural-form']; + str = _plural.apply(null, [str, pluralParam, pluralForm]); + } + } + + if (!str && i18n.en) { + str = i18n.en[message]; + if (pluralParam !== null && typeof pluralParam === 'number') { + pluralForm = i18n.en['mejs.plural-form']; + str = _plural.apply(null, [str, pluralParam, pluralForm]); + } + } + + str = str || message; + + if (pluralParam !== null && typeof pluralParam === 'number') { + str = str.replace('%1', pluralParam); + } + + return (0, _general.escapeHTML)(str); + } + + return message; +}; + +_mejs2.default.i18n = i18n; + +if (typeof mejsL10n !== 'undefined') { + _mejs2.default.i18n.language(mejsL10n.language, mejsL10n.strings); +} + +exports.default = i18n; + +},{"16":16,"26":26,"8":8}],7:[function(_dereq_,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +var _window = _dereq_(3); + +var _window2 = _interopRequireDefault(_window); + +var _document = _dereq_(2); + +var _document2 = _interopRequireDefault(_document); + +var _mejs = _dereq_(8); + +var _mejs2 = _interopRequireDefault(_mejs); + +var _general = _dereq_(26); + +var _media2 = _dereq_(28); + +var _renderer = _dereq_(9); + +var _constants = _dereq_(24); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var MediaElement = function MediaElement(idOrNode, options, sources) { + var _this = this; + + _classCallCheck(this, MediaElement); + + var t = this; + + sources = Array.isArray(sources) ? sources : null; + + t.defaults = { + renderers: [], + + fakeNodeName: 'div', + + iconSprite: 'mejs-controls.svg' + }; + + options = Object.assign(t.defaults, options); + + t.mediaElement = _document2.default.createElement(options.fakeNodeName); + + var id = idOrNode, + error = false; + + if (typeof idOrNode === 'string') { + t.mediaElement.originalNode = _document2.default.getElementById(idOrNode); + } else { + t.mediaElement.originalNode = idOrNode; + id = idOrNode.id; + } + + if (t.mediaElement.originalNode === undefined || t.mediaElement.originalNode === null) { + return null; + } + + t.mediaElement.options = options; + id = id || 'mejs_' + Math.random().toString().slice(2); + + t.mediaElement.originalNode.setAttribute('id', id + '_from_mejs'); + + var tagName = t.mediaElement.originalNode.tagName.toLowerCase(); + if (['video', 'audio'].indexOf(tagName) > -1 && !t.mediaElement.originalNode.getAttribute('preload')) { + t.mediaElement.originalNode.setAttribute('preload', 'none'); + } + + t.mediaElement.originalNode.setAttribute('tabindex', -1); + + t.mediaElement.originalNode.parentNode.insertBefore(t.mediaElement, t.mediaElement.originalNode); + + t.mediaElement.appendChild(t.mediaElement.originalNode); + + var processURL = function processURL(url, type) { + if (_window2.default.location.protocol === 'https:' && url.indexOf('http:') === 0 && _constants.IS_IOS && _mejs2.default.html5media.mediaTypes.indexOf(type) > -1) { + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function () { + if (this.readyState === 4 && this.status === 200) { + var _url = _window2.default.URL || _window2.default.webkitURL, + blobUrl = _url.createObjectURL(this.response); + t.mediaElement.originalNode.setAttribute('src', blobUrl); + return blobUrl; + } + return url; + }; + xhr.open('GET', url); + xhr.responseType = 'blob'; + xhr.send(); + } + + return url; + }; + + var mediaFiles = void 0; + if (sources !== null) { + mediaFiles = sources; + } else if (t.mediaElement.originalNode !== null) { + + mediaFiles = []; + switch (t.mediaElement.originalNode.nodeName.toLowerCase()) { + case 'iframe': + mediaFiles.push({ + type: '', + src: t.mediaElement.originalNode.getAttribute('src') + }); + break; + case 'audio': + case 'video': + var _sources = t.mediaElement.originalNode.children.length, + nodeSource = t.mediaElement.originalNode.getAttribute('src'); + + if (nodeSource) { + var node = t.mediaElement.originalNode, + type = (0, _media2.formatType)(nodeSource, node.getAttribute('type')); + mediaFiles.push({ + type: type, + src: processURL(nodeSource, type) + }); + } + + for (var i = 0; i < _sources; i++) { + var n = t.mediaElement.originalNode.children[i]; + if (n.tagName.toLowerCase() === 'source') { + var src = n.getAttribute('src'), + _type = (0, _media2.formatType)(src, n.getAttribute('type')); + mediaFiles.push({ type: _type, src: processURL(src, _type) }); + } + } + break; + } + } + + t.mediaElement.id = id; + t.mediaElement.renderers = {}; + t.mediaElement.events = {}; + t.mediaElement.promises = []; + t.mediaElement.renderer = null; + t.mediaElement.rendererName = null; + + t.mediaElement.changeRenderer = function (rendererName, mediaFiles) { + var t = _this, + media = Object.keys(mediaFiles[0]).length > 2 ? mediaFiles[0] : mediaFiles[0].src; + + if (t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null && t.mediaElement.renderer.name === rendererName) { + t.mediaElement.renderer.pause(); + t.mediaElement.renderer.show(); + t.mediaElement.renderer.setSrc(media); + return true; + } + + if (t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null) { + t.mediaElement.renderer.pause(); + t.mediaElement.renderer.hide(); + } + + var newRenderer = t.mediaElement.renderers[rendererName], + newRendererType = null; + + if (newRenderer !== undefined && newRenderer !== null) { + newRenderer.show(); + newRenderer.setSrc(media); + t.mediaElement.renderer = newRenderer; + t.mediaElement.rendererName = rendererName; + return true; + } + + var rendererArray = t.mediaElement.options.renderers.length ? t.mediaElement.options.renderers : _renderer.renderer.order; + + for (var _i = 0, total = rendererArray.length; _i < total; _i++) { + var index = rendererArray[_i]; + + if (index === rendererName) { + var rendererList = _renderer.renderer.renderers; + newRendererType = rendererList[index]; + + var renderOptions = Object.assign(newRendererType.options, t.mediaElement.options); + newRenderer = newRendererType.create(t.mediaElement, renderOptions, mediaFiles); + newRenderer.name = rendererName; + + t.mediaElement.renderers[newRendererType.name] = newRenderer; + t.mediaElement.renderer = newRenderer; + t.mediaElement.rendererName = rendererName; + newRenderer.show(); + return true; + } + } + + return false; + }; + + t.mediaElement.setSize = function (width, height) { + if (t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null) { + t.mediaElement.renderer.setSize(width, height); + } + }; + + t.mediaElement.generateError = function (message, urlList) { + message = message || ''; + urlList = Array.isArray(urlList) ? urlList : []; + var event = (0, _general.createEvent)('error', t.mediaElement); + event.message = message; + event.urls = urlList; + t.mediaElement.dispatchEvent(event); + error = true; + }; + + var props = _mejs2.default.html5media.properties, + methods = _mejs2.default.html5media.methods, + addProperty = function addProperty(obj, name, onGet, onSet) { + var oldValue = obj[name]; + var getFn = function getFn() { + return onGet.apply(obj, [oldValue]); + }, + setFn = function setFn(newValue) { + oldValue = onSet.apply(obj, [newValue]); + return oldValue; + }; + + Object.defineProperty(obj, name, { + get: getFn, + set: setFn + }); + }, + assignGettersSetters = function assignGettersSetters(propName) { + if (propName !== 'src') { + var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1), + getFn = function getFn() { + return t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null && typeof t.mediaElement.renderer['get' + capName] === 'function' ? t.mediaElement.renderer['get' + capName]() : null; + }, + setFn = function setFn(value) { + if (t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null && typeof t.mediaElement.renderer['set' + capName] === 'function') { + t.mediaElement.renderer['set' + capName](value); + } + }; + + addProperty(t.mediaElement, propName, getFn, setFn); + t.mediaElement['get' + capName] = getFn; + t.mediaElement['set' + capName] = setFn; + } + }, + getSrc = function getSrc() { + return t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null ? t.mediaElement.renderer.getSrc() : null; + }, + setSrc = function setSrc(value) { + var mediaFiles = []; + if (typeof value === 'string') { + mediaFiles.push({ + src: value, + type: value ? (0, _media2.getTypeFromFile)(value) : '' + }); + } else if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value.src !== undefined) { + var _src = (0, _media2.absolutizeUrl)(value.src), + _type2 = value.type, + media = Object.assign(value, { + src: _src, + type: (_type2 === '' || _type2 === null || _type2 === undefined) && _src ? (0, _media2.getTypeFromFile)(_src) : _type2 + }); + mediaFiles.push(media); + } else if (Array.isArray(value)) { + for (var _i2 = 0, total = value.length; _i2 < total; _i2++) { + + var _src2 = (0, _media2.absolutizeUrl)(value[_i2].src), + _type3 = value[_i2].type, + _media = Object.assign(value[_i2], { + src: _src2, + type: (_type3 === '' || _type3 === null || _type3 === undefined) && _src2 ? (0, _media2.getTypeFromFile)(_src2) : _type3 + }); + mediaFiles.push(_media); + } + } + + var renderInfo = _renderer.renderer.select(mediaFiles, t.mediaElement.options.renderers.length ? t.mediaElement.options.renderers : []), + event = void 0; + + if (!t.mediaElement.paused && !(t.mediaElement.src == null || t.mediaElement.src === '')) { + t.mediaElement.pause(); + event = (0, _general.createEvent)('pause', t.mediaElement); + t.mediaElement.dispatchEvent(event); + } + t.mediaElement.originalNode.src = mediaFiles[0].src || ''; + + if (renderInfo === null && mediaFiles[0].src) { + t.mediaElement.generateError('No renderer found', mediaFiles); + return; + } + + var shouldChangeRenderer = !(mediaFiles[0].src == null || mediaFiles[0].src === ''); + return shouldChangeRenderer ? t.mediaElement.changeRenderer(renderInfo.rendererName, mediaFiles) : null; + }, + triggerAction = function triggerAction(methodName, args) { + try { + if (methodName === 'play' && (t.mediaElement.rendererName === 'native_dash' || t.mediaElement.rendererName === 'native_hls' || t.mediaElement.rendererName === 'vimeo_iframe')) { + var response = t.mediaElement.renderer[methodName](args); + if (response && typeof response.then === 'function') { + response.catch(function () { + if (t.mediaElement.paused) { + setTimeout(function () { + var tmpResponse = t.mediaElement.renderer.play(); + if (tmpResponse !== undefined) { + tmpResponse.catch(function () { + if (!t.mediaElement.renderer.paused) { + t.mediaElement.renderer.pause(); + } + }); + } + }, 150); + } + }); + } + return response; + } else { + return t.mediaElement.renderer[methodName](args); + } + } catch (e) { + t.mediaElement.generateError(e, mediaFiles); + throw e; + } + }, + assignMethods = function assignMethods(methodName) { + t.mediaElement[methodName] = function () { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + if (t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null && typeof t.mediaElement.renderer[methodName] === 'function') { + if (t.mediaElement.promises.length) { + return Promise.all(t.mediaElement.promises).then(function () { + return triggerAction(methodName, args); + }).catch(function (e) { + t.mediaElement.generateError(e, mediaFiles); + return Promise.reject(e); + }); + } else { + return triggerAction(methodName, args); + } + } + return null; + }; + }; + + addProperty(t.mediaElement, 'src', getSrc, setSrc); + + t.mediaElement.getSrc = getSrc; + t.mediaElement.setSrc = setSrc; + for (var _i3 = 0, total = props.length; _i3 < total; _i3++) { + assignGettersSetters(props[_i3]); + } + + for (var _i4 = 0, _total = methods.length; _i4 < _total; _i4++) { + assignMethods(methods[_i4]); + } + + t.mediaElement.addEventListener = function (eventName, callback) { + t.mediaElement.events[eventName] = t.mediaElement.events[eventName] || []; + + t.mediaElement.events[eventName].push(callback); + }; + t.mediaElement.removeEventListener = function (eventName, callback) { + if (!eventName) { + t.mediaElement.events = {}; + return true; + } + + var callbacks = t.mediaElement.events[eventName]; + + if (!callbacks) { + return true; + } + + if (!callback) { + t.mediaElement.events[eventName] = []; + return true; + } + + for (var _i5 = 0; _i5 < callbacks.length; _i5++) { + if (callbacks[_i5] === callback) { + t.mediaElement.events[eventName].splice(_i5, 1); + return true; + } + } + return false; + }; + + t.mediaElement.dispatchEvent = function (event) { + var callbacks = t.mediaElement.events[event.type]; + if (callbacks) { + for (var _i6 = 0; _i6 < callbacks.length; _i6++) { + callbacks[_i6].apply(null, [event]); + } + } + }; + + t.mediaElement.destroy = function () { + var mediaElement = t.mediaElement.originalNode.cloneNode(true); + var wrapper = t.mediaElement.parentElement; + mediaElement.removeAttribute('id'); + mediaElement.remove(); + t.mediaElement.remove(); + wrapper.appendChild(mediaElement); + }; + + if (mediaFiles.length) { + t.mediaElement.src = mediaFiles; + } + + if (t.mediaElement.promises.length) { + Promise.all(t.mediaElement.promises).then(function () { + if (t.mediaElement.options.success) { + t.mediaElement.options.success(t.mediaElement, t.mediaElement.originalNode); + } + }).catch(function () { + if (error && t.mediaElement.options.error) { + t.mediaElement.options.error(t.mediaElement, t.mediaElement.originalNode); + } + }); + } else { + if (t.mediaElement.options.success) { + t.mediaElement.options.success(t.mediaElement, t.mediaElement.originalNode); + } + + if (error && t.mediaElement.options.error) { + t.mediaElement.options.error(t.mediaElement, t.mediaElement.originalNode); + } + } + + return t.mediaElement; +}; + +_window2.default.MediaElement = MediaElement; +_mejs2.default.MediaElement = MediaElement; + +exports.default = MediaElement; + +},{"2":2,"24":24,"26":26,"28":28,"3":3,"8":8,"9":9}],8:[function(_dereq_,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _window = _dereq_(3); + +var _window2 = _interopRequireDefault(_window); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var mejs = {}; + +mejs.version = '7.0.5'; + +mejs.html5media = { + properties: ['volume', 'src', 'currentTime', 'muted', 'duration', 'paused', 'ended', 'buffered', 'error', 'networkState', 'readyState', 'seeking', 'seekable', 'currentSrc', 'preload', 'bufferedBytes', 'bufferedTime', 'initialTime', 'startOffsetTime', 'defaultPlaybackRate', 'playbackRate', 'played', 'autoplay', 'loop', 'controls'], + readOnlyProperties: ['duration', 'paused', 'ended', 'buffered', 'error', 'networkState', 'readyState', 'seeking', 'seekable'], + + methods: ['load', 'play', 'pause', 'canPlayType'], + + events: ['loadstart', 'durationchange', 'loadedmetadata', 'loadeddata', 'progress', 'canplay', 'canplaythrough', 'suspend', 'abort', 'error', 'emptied', 'stalled', 'play', 'playing', 'pause', 'waiting', 'seeking', 'seeked', 'timeupdate', 'ended', 'ratechange', 'volumechange'], + + mediaTypes: ['audio/mp3', 'audio/ogg', 'audio/oga', 'audio/wav', 'audio/x-wav', 'audio/wave', 'audio/x-pn-wav', 'audio/mpeg', 'audio/mp4', 'video/mp4', 'video/webm', 'video/ogg', 'video/ogv'] +}; + +_window2.default.mejs = mejs; + +exports.default = mejs; + +},{"3":3}],9:[function(_dereq_,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.renderer = undefined; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _mejs = _dereq_(8); + +var _mejs2 = _interopRequireDefault(_mejs); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Renderer = function () { + function Renderer() { + _classCallCheck(this, Renderer); + + this.renderers = {}; + this.order = []; + } + + _createClass(Renderer, [{ + key: 'add', + value: function add(renderer) { + if (renderer.name === undefined) { + throw new TypeError('renderer must contain at least `name` property'); + } + + this.renderers[renderer.name] = renderer; + this.order.push(renderer.name); + } + }, { + key: 'select', + value: function select(mediaFiles) { + var renderers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + + var renderersLength = renderers.length; + + renderers = renderers.length ? renderers : this.order; + + if (!renderersLength) { + var rendererIndicator = [/^(html5|native)/i, /iframe$/i], + rendererRanking = function rendererRanking(renderer) { + for (var i = 0, total = rendererIndicator.length; i < total; i++) { + if (rendererIndicator[i].test(renderer)) { + return i; + } + } + return rendererIndicator.length; + }; + + renderers.sort(function (a, b) { + return rendererRanking(a) - rendererRanking(b); + }); + } + + for (var i = 0, total = renderers.length; i < total; i++) { + var key = renderers[i], + _renderer = this.renderers[key]; + + if (_renderer !== null && _renderer !== undefined) { + for (var j = 0, jl = mediaFiles.length; j < jl; j++) { + + if (typeof _renderer.canPlayType === 'function' && typeof mediaFiles[j].type === 'string' && _renderer.canPlayType(mediaFiles[j].type)) { + return { + rendererName: _renderer.name, + src: mediaFiles[j].src + }; + } + } + } + } + + return null; + } + }, { + key: 'order', + set: function set(order) { + if (!Array.isArray(order)) { + throw new TypeError('order must be an array of strings.'); + } + + this._order = order; + }, + get: function get() { + return this._order; + } + }, { + key: 'renderers', + set: function set(renderers) { + if (renderers !== null && (typeof renderers === 'undefined' ? 'undefined' : _typeof(renderers)) !== 'object') { + throw new TypeError('renderers must be an array of objects.'); + } + + this._renderers = renderers; + }, + get: function get() { + return this._renderers; + } + }]); + + return Renderer; +}(); + +var renderer = exports.renderer = new Renderer(); + +_mejs2.default.Renderers = renderer; + +},{"8":8}],10:[function(_dereq_,module,exports){ +'use strict'; + +var _window = _dereq_(3); + +var _window2 = _interopRequireDefault(_window); + +var _document = _dereq_(2); + +var _document2 = _interopRequireDefault(_document); + +var _i18n = _dereq_(6); + +var _i18n2 = _interopRequireDefault(_i18n); + +var _player = _dereq_(17); + +var _player2 = _interopRequireDefault(_player); + +var _constants = _dereq_(24); + +var Features = _interopRequireWildcard(_constants); + +var _general = _dereq_(26); + +var _dom = _dereq_(25); + +var _media = _dereq_(28); + +var _generate = _dereq_(27); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +Object.assign(_player.config, { + usePluginFullScreen: true, + + fullscreenText: null, + + useFakeFullscreen: false +}); + +Object.assign(_player2.default.prototype, { + isFullScreen: false, + + isNativeFullScreen: false, + + isInIframe: false, + + isPluginClickThroughCreated: false, + + fullscreenMode: '', + + containerSizeTimeout: null, + + buildfullscreen: function buildfullscreen(player) { + if (!player.isVideo) { + return; + } + + player.isInIframe = _window2.default.location !== _window2.default.parent.location; + + player.detectFullscreenMode(); + + var t = this, + fullscreenTitle = (0, _general.isString)(t.options.fullscreenText) ? t.options.fullscreenText : _i18n2.default.t('mejs.fullscreen'), + fullscreenBtn = _document2.default.createElement('div'); + fullscreenBtn.className = t.options.classPrefix + 'button ' + t.options.classPrefix + 'fullscreen-button'; + fullscreenBtn.innerHTML = (0, _generate.generateControlButton)(t.id, fullscreenTitle, fullscreenTitle, '' + t.media.options.iconSprite, ['icon-fullscreen', 'icon-unfullscreen'], '' + t.options.classPrefix); + t.addControlElement(fullscreenBtn, 'fullscreen'); + + fullscreenBtn.addEventListener('click', function () { + var isFullScreen = Features.HAS_TRUE_NATIVE_FULLSCREEN && Features.IS_FULLSCREEN || player.isFullScreen; + + if (isFullScreen) { + player.exitFullScreen(); + } else { + player.enterFullScreen(); + } + }); + + player.fullscreenBtn = fullscreenBtn; + + t.options.keyActions.push({ + keys: [70], + action: function action(player, media, key, event) { + if (!event.ctrlKey) { + if (typeof player.enterFullScreen !== 'undefined') { + if (player.isFullScreen) { + player.exitFullScreen(); + } else { + player.enterFullScreen(); + } + } + } + } + }); + + t.exitFullscreenCallback = function (e) { + var key = e.which || e.keyCode || 0; + if (t.options.enableKeyboard && key === 27 && (Features.HAS_TRUE_NATIVE_FULLSCREEN && Features.IS_FULLSCREEN || t.isFullScreen)) { + player.exitFullScreen(); + } + }; + + t.globalBind('keydown', t.exitFullscreenCallback); + + t.normalHeight = 0; + t.normalWidth = 0; + + if (Features.HAS_TRUE_NATIVE_FULLSCREEN) { + var fullscreenChanged = function fullscreenChanged() { + if (player.isFullScreen) { + if (Features.isFullScreen()) { + player.isNativeFullScreen = true; + + player.setControlsSize(); + } else { + player.isNativeFullScreen = false; + + player.exitFullScreen(); + } + } + }; + + player.globalBind(Features.FULLSCREEN_EVENT_NAME, fullscreenChanged); + } + }, + cleanfullscreen: function cleanfullscreen(player) { + player.exitFullScreen(); + player.globalUnbind('keydown', player.exitFullscreenCallback); + }, + detectFullscreenMode: function detectFullscreenMode() { + var t = this, + isNative = t.media.rendererName !== null && /(native|html5)/i.test(t.media.rendererName); + + var mode = ''; + + if (Features.HAS_TRUE_NATIVE_FULLSCREEN && isNative) { + mode = 'native-native'; + } else if (Features.HAS_TRUE_NATIVE_FULLSCREEN && !isNative) { + mode = 'plugin-native'; + } else if (t.usePluginFullScreen && Features.SUPPORT_POINTER_EVENTS) { + mode = 'plugin-click'; + } + + t.fullscreenMode = mode; + return mode; + }, + enterFullScreen: function enterFullScreen() { + var t = this, + isNative = t.media.rendererName !== null && /(html5|native)/i.test(t.media.rendererName), + containerStyles = getComputedStyle(t.getElement(t.container)); + + if (!t.isVideo) { + return; + } + + if (t.options.useFakeFullscreen === false && (Features.IS_IOS || Features.IS_SAFARI) && Features.HAS_IOS_FULLSCREEN && typeof t.media.originalNode.webkitEnterFullscreen === 'function' && t.media.originalNode.canPlayType((0, _media.getTypeFromFile)(t.media.getSrc()))) { + t.media.originalNode.webkitEnterFullscreen(); + return; + } + + (0, _dom.addClass)(_document2.default.documentElement, t.options.classPrefix + 'fullscreen'); + (0, _dom.addClass)(t.getElement(t.container), t.options.classPrefix + 'container-fullscreen'); + + t.normalHeight = parseFloat(containerStyles.height); + t.normalWidth = parseFloat(containerStyles.width); + + if (t.fullscreenMode === 'native-native' || t.fullscreenMode === 'plugin-native') { + Features.requestFullScreen(t.getElement(t.container)); + + if (t.isInIframe) { + setTimeout(function checkFullscreen() { + + if (t.isNativeFullScreen) { + var percentErrorMargin = 0.002, + windowWidth = _window2.default.innerWidth || _document2.default.documentElement.clientWidth || _document2.default.body.clientWidth, + screenWidth = screen.width, + absDiff = Math.abs(screenWidth - windowWidth), + marginError = screenWidth * percentErrorMargin; + + if (absDiff > marginError) { + t.exitFullScreen(); + } else { + setTimeout(checkFullscreen, 500); + } + } + }, 1000); + } + } + + t.getElement(t.container).style.width = '100%'; + t.getElement(t.container).style.height = '100%'; + + t.containerSizeTimeout = setTimeout(function () { + t.getElement(t.container).style.width = '100%'; + t.getElement(t.container).style.height = '100%'; + t.setControlsSize(); + }, 500); + + if (isNative) { + t.node.style.width = '100%'; + t.node.style.height = '100%'; + } else { + var elements = t.getElement(t.container).querySelectorAll('embed, object, video'), + _total = elements.length; + for (var i = 0; i < _total; i++) { + elements[i].style.width = '100%'; + elements[i].style.height = '100%'; + } + } + + if (t.options.setDimensions && typeof t.media.setSize === 'function') { + t.media.setSize(screen.width, screen.height); + } + + var layers = t.getElement(t.layers).children, + total = layers.length; + for (var _i = 0; _i < total; _i++) { + layers[_i].style.width = '100%'; + layers[_i].style.height = '100%'; + } + + if (t.fullscreenBtn) { + (0, _dom.removeClass)(t.fullscreenBtn, t.options.classPrefix + 'fullscreen'); + (0, _dom.addClass)(t.fullscreenBtn, t.options.classPrefix + 'unfullscreen'); + } + + t.setControlsSize(); + t.isFullScreen = true; + + var zoomFactor = Math.min(screen.width / t.width, screen.height / t.height), + captionText = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'captions-text'); + if (captionText) { + captionText.style.fontSize = zoomFactor * 100 + '%'; + captionText.style.lineHeight = 'normal'; + t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'captions-position').style.bottom = (screen.height - t.normalHeight) / 2 - t.getElement(t.controls).offsetHeight / 2 + zoomFactor + 15 + 'px'; + } + var event = (0, _general.createEvent)('enteredfullscreen', t.getElement(t.container)); + t.getElement(t.container).dispatchEvent(event); + }, + exitFullScreen: function exitFullScreen() { + var t = this, + isNative = t.media.rendererName !== null && /(native|html5)/i.test(t.media.rendererName); + + if (!t.isVideo) { + return; + } + + clearTimeout(t.containerSizeTimeout); + + if (Features.HAS_TRUE_NATIVE_FULLSCREEN && (Features.IS_FULLSCREEN || t.isFullScreen)) { + Features.cancelFullScreen(); + } + + (0, _dom.removeClass)(_document2.default.documentElement, t.options.classPrefix + 'fullscreen'); + (0, _dom.removeClass)(t.getElement(t.container), t.options.classPrefix + 'container-fullscreen'); + + if (t.options.setDimensions) { + t.getElement(t.container).style.width = t.normalWidth + 'px'; + t.getElement(t.container).style.height = t.normalHeight + 'px'; + + if (isNative) { + t.node.style.width = t.normalWidth + 'px'; + t.node.style.height = t.normalHeight + 'px'; + } else { + var elements = t.getElement(t.container).querySelectorAll('embed, object, video'), + _total2 = elements.length; + for (var i = 0; i < _total2; i++) { + elements[i].style.width = t.normalWidth + 'px'; + elements[i].style.height = t.normalHeight + 'px'; + } + } + + if (typeof t.media.setSize === 'function') { + t.media.setSize(t.normalWidth, t.normalHeight); + } + + var layers = t.getElement(t.layers).children, + total = layers.length; + for (var _i2 = 0; _i2 < total; _i2++) { + layers[_i2].style.width = t.normalWidth + 'px'; + layers[_i2].style.height = t.normalHeight + 'px'; + } + } + + if (t.fullscreenBtn) { + (0, _dom.removeClass)(t.fullscreenBtn, t.options.classPrefix + 'unfullscreen'); + (0, _dom.addClass)(t.fullscreenBtn, t.options.classPrefix + 'fullscreen'); + } + + t.setControlsSize(); + t.isFullScreen = false; + + var captionText = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'captions-text'); + if (captionText) { + captionText.style.fontSize = ''; + captionText.style.lineHeight = ''; + t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'captions-position').style.bottom = ''; + } + var event = (0, _general.createEvent)('exitedfullscreen', t.getElement(t.container)); + t.getElement(t.container).dispatchEvent(event); + } +}); + +},{"17":17,"2":2,"24":24,"25":25,"26":26,"27":27,"28":28,"3":3,"6":6}],11:[function(_dereq_,module,exports){ +'use strict'; + +var _document = _dereq_(2); + +var _document2 = _interopRequireDefault(_document); + +var _player = _dereq_(17); + +var _player2 = _interopRequireDefault(_player); + +var _i18n = _dereq_(6); + +var _i18n2 = _interopRequireDefault(_i18n); + +var _general = _dereq_(26); + +var _dom = _dereq_(25); + +var _generate = _dereq_(27); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +Object.assign(_player.config, { + playText: null, + + pauseText: null +}); + +Object.assign(_player2.default.prototype, { + buildplaypause: function buildplaypause(player, controls, layers, media) { + var t = this, + op = t.options, + playTitle = (0, _general.isString)(op.playText) ? op.playText : _i18n2.default.t('mejs.play'), + pauseTitle = (0, _general.isString)(op.pauseText) ? op.pauseText : _i18n2.default.t('mejs.pause'), + play = _document2.default.createElement('div'); + + play.className = t.options.classPrefix + 'button ' + t.options.classPrefix + 'playpause-button ' + t.options.classPrefix + 'play'; + play.innerHTML = (0, _generate.generateControlButton)(t.id, pauseTitle, playTitle, '' + t.media.options.iconSprite, ['icon-play', 'icon-pause', 'icon-replay'], '' + t.options.classPrefix); + play.addEventListener('click', function () { + if (t.paused) { + t.play(); + } else { + t.pause(); + } + }); + + var playBtn = play.querySelector('button'); + t.addControlElement(play, 'playpause'); + + function togglePlayPause(which) { + (0, _dom.removeClass)(play, t.options.classPrefix + 'play'); + (0, _dom.removeClass)(play, t.options.classPrefix + 'replay'); + (0, _dom.removeClass)(play, t.options.classPrefix + 'pause'); + + if ('play' === which) { + (0, _dom.addClass)(play, t.options.classPrefix + 'pause'); + playBtn.setAttribute('title', pauseTitle); + playBtn.setAttribute('aria-label', pauseTitle); + } else if ('pse' === which) { + (0, _dom.addClass)(play, t.options.classPrefix + 'play'); + playBtn.setAttribute('title', playTitle); + playBtn.setAttribute('aria-label', playTitle); + } else { + (0, _dom.addClass)(play, t.options.classPrefix + 'replay'); + playBtn.setAttribute('title', playTitle); + playBtn.setAttribute('aria-label', playTitle); + } + } + + togglePlayPause('pse'); + + media.addEventListener('loadedmetadata', function () { + togglePlayPause('pse'); + }); + media.addEventListener('play', function () { + togglePlayPause('play'); + }); + media.addEventListener('playing', function () { + togglePlayPause('play'); + }); + media.addEventListener('pause', function () { + togglePlayPause('pse'); + }); + media.addEventListener('ended', function () { + if (!player.options.loop) { + setTimeout(function () { + togglePlayPause('replay'); + }, 0); + } + }); + } +}); + +},{"17":17,"2":2,"25":25,"26":26,"27":27,"6":6}],12:[function(_dereq_,module,exports){ +'use strict'; + +var _document = _dereq_(2); + +var _document2 = _interopRequireDefault(_document); + +var _player = _dereq_(17); + +var _player2 = _interopRequireDefault(_player); + +var _i18n = _dereq_(6); + +var _i18n2 = _interopRequireDefault(_i18n); + +var _constants = _dereq_(24); + +var _time = _dereq_(30); + +var _dom = _dereq_(25); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +Object.assign(_player.config, { + enableProgressTooltip: true, + + useSmoothHover: true, + + forceLive: false +}); + +Object.assign(_player2.default.prototype, { + buildprogress: function buildprogress(player, controls, layers, media) { + + var lastKeyPressTime = 0, + mouseIsDown = false, + startedPaused = false; + + var t = this, + autoRewindInitial = player.options.autoRewind, + tooltip = player.options.enableProgressTooltip ? '' + ('00:00') + ('') + '' : '', + rail = _document2.default.createElement('div'); + + rail.className = t.options.classPrefix + 'time-rail'; + rail.innerHTML = '' + ('') + ('') + ('') + ('') + ('') + ('' + tooltip) + ''; + + t.addControlElement(rail, 'progress'); + + t.options.keyActions.push({ + keys: [37, 227], + action: function action(player) { + if (!isNaN(player.duration) && player.duration > 0) { + if (player.isVideo) { + player.showControls(); + player.startControlsTimer(); + } + + var timeSlider = player.getElement(player.container).querySelector('.' + t.options.classPrefix + 'time-total'); + if (timeSlider) { + timeSlider.focus(); + } + + var newTime = Math.max(player.currentTime - player.options.defaultSeekBackwardInterval(player), 0); + + if (!player.paused) { + player.pause(); + } + + setTimeout(function () { + player.setCurrentTime(newTime, true); + }, 0); + + setTimeout(function () { + player.play(); + }, 0); + } + } + }, { + keys: [39, 228], + action: function action(player) { + + if (!isNaN(player.duration) && player.duration > 0) { + if (player.isVideo) { + player.showControls(); + player.startControlsTimer(); + } + + var timeSlider = player.getElement(player.container).querySelector('.' + t.options.classPrefix + 'time-total'); + if (timeSlider) { + timeSlider.focus(); + } + + var newTime = Math.min(player.currentTime + player.options.defaultSeekForwardInterval(player), player.duration); + + if (!player.paused) { + player.pause(); + } + + setTimeout(function () { + player.setCurrentTime(newTime, true); + }, 0); + + setTimeout(function () { + player.play(); + }, 0); + } + } + }); + + t.rail = controls.querySelector('.' + t.options.classPrefix + 'time-rail'); + t.total = controls.querySelector('.' + t.options.classPrefix + 'time-total'); + t.loaded = controls.querySelector('.' + t.options.classPrefix + 'time-loaded'); + t.current = controls.querySelector('.' + t.options.classPrefix + 'time-current'); + t.handle = controls.querySelector('.' + t.options.classPrefix + 'time-handle'); + t.timefloat = controls.querySelector('.' + t.options.classPrefix + 'time-float'); + t.timefloatcurrent = controls.querySelector('.' + t.options.classPrefix + 'time-float-current'); + t.slider = controls.querySelector('.' + t.options.classPrefix + 'time-slider'); + t.hovered = controls.querySelector('.' + t.options.classPrefix + 'time-hovered'); + t.buffer = controls.querySelector('.' + t.options.classPrefix + 'time-buffering'); + t.newTime = 0; + t.forcedHandlePause = false; + t.setTransformStyle = function (element, value) { + element.style.transform = value; + element.style.webkitTransform = value; + element.style.MozTransform = value; + element.style.msTransform = value; + element.style.OTransform = value; + }; + + t.buffer.style.display = 'none'; + + var handleMouseMove = function handleMouseMove(e) { + var totalStyles = getComputedStyle(t.total), + offsetStyles = (0, _dom.offset)(t.total), + width = t.total.offsetWidth, + transform = function () { + if (totalStyles.webkitTransform !== undefined) { + return 'webkitTransform'; + } else if (totalStyles.mozTransform !== undefined) { + return 'mozTransform '; + } else if (totalStyles.oTransform !== undefined) { + return 'oTransform'; + } else if (totalStyles.msTransform !== undefined) { + return 'msTransform'; + } else { + return 'transform'; + } + }(), + cssMatrix = function () { + if ('WebKitCSSMatrix' in window) { + return 'WebKitCSSMatrix'; + } else if ('MSCSSMatrix' in window) { + return 'MSCSSMatrix'; + } else if ('CSSMatrix' in window) { + return 'CSSMatrix'; + } + }(); + + var percentage = 0, + leftPos = 0, + pos = 0, + x = void 0; + + if (e.originalEvent && e.originalEvent.changedTouches) { + x = e.originalEvent.changedTouches[0].pageX; + } else if (e.changedTouches) { + x = e.changedTouches[0].pageX; + } else { + x = e.pageX; + } + + if (t.getDuration()) { + if (x < offsetStyles.left) { + x = offsetStyles.left; + } else if (x > width + offsetStyles.left) { + x = width + offsetStyles.left; + } + + pos = x - offsetStyles.left; + percentage = pos / width; + t.newTime = percentage * t.getDuration(); + + if (mouseIsDown && t.getCurrentTime() !== null && t.newTime.toFixed(4) !== t.getCurrentTime().toFixed(4)) { + t.setCurrentRailHandle(t.newTime); + t.updateCurrent(t.newTime); + } + + if (!_constants.IS_IOS && !_constants.IS_ANDROID) { + if (pos < 0) { + pos = 0; + } + if (t.options.useSmoothHover && cssMatrix !== null && typeof window[cssMatrix] !== 'undefined') { + var matrix = new window[cssMatrix](getComputedStyle(t.handle)[transform]), + handleLocation = matrix.m41, + hoverScaleX = pos / parseFloat(getComputedStyle(t.total).width) - handleLocation / parseFloat(getComputedStyle(t.total).width); + + t.hovered.style.left = handleLocation + 'px'; + t.setTransformStyle(t.hovered, 'scaleX(' + hoverScaleX + ')'); + t.hovered.setAttribute('pos', pos); + + if (hoverScaleX >= 0) { + (0, _dom.removeClass)(t.hovered, 'negative'); + } else { + (0, _dom.addClass)(t.hovered, 'negative'); + } + } + + if (t.timefloat) { + var half = t.timefloat.offsetWidth / 2, + offsetContainer = mejs.Utils.offset(t.getElement(t.container)), + tooltipStyles = getComputedStyle(t.timefloat); + + if (x - offsetContainer.left < t.timefloat.offsetWidth) { + leftPos = half; + } else if (x - offsetContainer.left >= t.getElement(t.container).offsetWidth - half) { + leftPos = t.total.offsetWidth - half; + } else { + leftPos = pos; + } + + if ((0, _dom.hasClass)(t.getElement(t.container), t.options.classPrefix + 'long-video')) { + leftPos += parseFloat(tooltipStyles.marginLeft) / 2 + t.timefloat.offsetWidth / 2; + } + + t.timefloat.style.left = leftPos + 'px'; + t.timefloatcurrent.innerHTML = (0, _time.secondsToTimeCode)(t.newTime, player.options.alwaysShowHours, player.options.showTimecodeFrameCount, player.options.framesPerSecond, player.options.secondsDecimalLength, player.options.timeFormat); + t.timefloat.style.display = 'block'; + } + } + } else if (!_constants.IS_IOS && !_constants.IS_ANDROID && t.timefloat) { + leftPos = t.timefloat.offsetWidth + width >= t.getElement(t.container).offsetWidth ? t.timefloat.offsetWidth / 2 : 0; + t.timefloat.style.left = leftPos + 'px'; + t.timefloat.style.left = leftPos + 'px'; + t.timefloat.style.display = 'block'; + } + }, + updateSlider = function updateSlider() { + var seconds = t.getCurrentTime(), + timeSliderText = _i18n2.default.t('mejs.time-slider'), + time = (0, _time.secondsToTimeCode)(seconds, player.options.alwaysShowHours, player.options.showTimecodeFrameCount, player.options.framesPerSecond, player.options.secondsDecimalLength, player.options.timeFormat), + duration = t.getDuration(); + + t.slider.setAttribute('role', 'slider'); + t.slider.tabIndex = 0; + + if (media.paused) { + t.slider.setAttribute('aria-label', timeSliderText); + t.slider.setAttribute('aria-valuemin', 0); + t.slider.setAttribute('aria-valuemax', isNaN(duration) ? 0 : duration); + t.slider.setAttribute('aria-valuenow', seconds); + t.slider.setAttribute('aria-valuetext', time); + } else { + t.slider.removeAttribute('aria-label'); + t.slider.removeAttribute('aria-valuemin'); + t.slider.removeAttribute('aria-valuemax'); + t.slider.removeAttribute('aria-valuenow'); + t.slider.removeAttribute('aria-valuetext'); + } + }, + restartPlayer = function restartPlayer() { + if (new Date() - lastKeyPressTime >= 1000) { + t.play(); + } + }, + handleMouseup = function handleMouseup() { + if (mouseIsDown && t.getCurrentTime() !== null && t.newTime.toFixed(4) !== t.getCurrentTime().toFixed(4)) { + t.setCurrentTime(t.newTime, true); + t.setCurrentRailHandle(t.newTime); + t.updateCurrent(t.newTime); + } + if (t.forcedHandlePause) { + t.slider.focus(); + t.play(); + } + t.forcedHandlePause = false; + }; + + t.slider.addEventListener('focus', function () { + player.options.autoRewind = false; + }); + t.slider.addEventListener('blur', function () { + player.options.autoRewind = autoRewindInitial; + }); + t.slider.addEventListener('keydown', function (e) { + if (new Date() - lastKeyPressTime >= 1000) { + startedPaused = t.paused; + } + + if (t.options.enableKeyboard && t.options.keyActions.length) { + + var keyCode = e.which || e.keyCode || 0, + duration = t.getDuration(), + seekForward = player.options.defaultSeekForwardInterval(media), + seekBackward = player.options.defaultSeekBackwardInterval(media); + + var seekTime = t.getCurrentTime(); + var volume = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'volume-slider'); + + if (keyCode === 38 || keyCode === 40) { + if (volume) { + volume.style.display = 'block'; + } + if (t.isVideo) { + t.showControls(); + t.startControlsTimer(); + } + + var newVolume = keyCode === 38 ? Math.min(t.volume + 0.1, 1) : Math.max(t.volume - 0.1, 0), + mutePlayer = newVolume <= 0; + t.setVolume(newVolume); + t.setMuted(mutePlayer); + return; + } else { + if (volume) { + volume.style.display = 'none'; + } + } + + switch (keyCode) { + case 37: + if (t.getDuration() !== Infinity) { + seekTime -= seekBackward; + } + break; + case 39: + if (t.getDuration() !== Infinity) { + seekTime += seekForward; + } + break; + case 36: + seekTime = 0; + break; + case 35: + seekTime = duration; + break; + case 13: + case 32: + if (_constants.IS_FIREFOX) { + if (t.paused) { + t.play(); + } else { + t.pause(); + } + } + return; + default: + return; + } + + seekTime = seekTime < 0 || isNaN(seekTime) ? 0 : seekTime >= duration ? duration : Math.floor(seekTime); + lastKeyPressTime = new Date(); + if (!startedPaused) { + player.pause(); + } + + setTimeout(function () { + t.setCurrentTime(seekTime, true); + }, 0); + + if (seekTime < t.getDuration() && !startedPaused) { + setTimeout(restartPlayer, 1100); + } + + player.showControls(); + + e.preventDefault(); + e.stopPropagation(); + } + }); + + var events = ['mousedown', 'touchstart']; + + t.slider.addEventListener('dragstart', function () { + return false; + }); + + for (var i = 0, total = events.length; i < total; i++) { + t.slider.addEventListener(events[i], function (e) { + t.forcedHandlePause = false; + if (t.getDuration() !== Infinity) { + if (e.which === 1 || e.which === 0) { + if (!t.paused) { + t.pause(); + t.forcedHandlePause = true; + } + + mouseIsDown = true; + handleMouseMove(e); + var endEvents = ['mouseup', 'touchend']; + + for (var j = 0, totalEvents = endEvents.length; j < totalEvents; j++) { + t.getElement(t.container).addEventListener(endEvents[j], function (event) { + var target = event.target; + if (target === t.slider || target.closest('.' + t.options.classPrefix + 'time-slider')) { + handleMouseMove(event); + } + }); + } + t.globalBind('mouseup.dur touchend.dur', function () { + handleMouseup(); + mouseIsDown = false; + if (t.timefloat) { + t.timefloat.style.display = 'none'; + } + }); + } + } + }, _constants.SUPPORT_PASSIVE_EVENT && events[i] === 'touchstart' ? { passive: true } : false); + } + t.slider.addEventListener('mouseenter', function (e) { + if (e.target === t.slider && t.getDuration() !== Infinity) { + t.getElement(t.container).addEventListener('mousemove', function (event) { + var target = event.target; + if (target === t.slider || target.closest('.' + t.options.classPrefix + 'time-slider')) { + handleMouseMove(event); + } + }); + if (t.timefloat && !_constants.IS_IOS && !_constants.IS_ANDROID) { + t.timefloat.style.display = 'block'; + } + if (t.hovered && !_constants.IS_IOS && !_constants.IS_ANDROID && t.options.useSmoothHover) { + (0, _dom.removeClass)(t.hovered, 'no-hover'); + } + } + }); + t.slider.addEventListener('mouseleave', function () { + if (t.getDuration() !== Infinity) { + if (!mouseIsDown) { + if (t.timefloat) { + t.timefloat.style.display = 'none'; + } + if (t.hovered && t.options.useSmoothHover) { + (0, _dom.addClass)(t.hovered, 'no-hover'); + } + } + } + }); + + t.broadcastCallback = function (e) { + var broadcast = controls.querySelector('.' + t.options.classPrefix + 'broadcast'); + if (!t.options.forceLive && t.getDuration() !== Infinity) { + if (broadcast) { + t.slider.style.display = ''; + broadcast.remove(); + } + + player.setProgressRail(e); + if (!t.forcedHandlePause) { + player.setCurrentRail(e); + } + updateSlider(); + } else if (!broadcast && t.options.forceLive) { + var label = _document2.default.createElement('span'); + label.className = t.options.classPrefix + 'broadcast'; + label.innerText = _i18n2.default.t('mejs.live-broadcast'); + t.slider.style.display = 'none'; + t.rail.appendChild(label); + } + }; + + media.addEventListener('progress', t.broadcastCallback); + media.addEventListener('timeupdate', t.broadcastCallback); + media.addEventListener('play', function () { + t.buffer.style.display = 'none'; + }); + media.addEventListener('playing', function () { + t.buffer.style.display = 'none'; + }); + media.addEventListener('seeking', function () { + t.buffer.style.display = ''; + }); + media.addEventListener('seeked', function () { + t.buffer.style.display = 'none'; + }); + media.addEventListener('pause', function () { + t.buffer.style.display = 'none'; + }); + media.addEventListener('waiting', function () { + t.buffer.style.display = ''; + }); + media.addEventListener('loadeddata', function () { + t.buffer.style.display = ''; + }); + media.addEventListener('canplay', function () { + t.buffer.style.display = 'none'; + }); + media.addEventListener('error', function () { + t.buffer.style.display = 'none'; + }); + + t.getElement(t.container).addEventListener('controlsresize', function (e) { + if (t.getDuration() !== Infinity) { + player.setProgressRail(e); + if (!t.forcedHandlePause) { + player.setCurrentRail(e); + } + } + }); + }, + cleanprogress: function cleanprogress(player, controls, layers, media) { + media.removeEventListener('progress', player.broadcastCallback); + media.removeEventListener('timeupdate', player.broadcastCallback); + if (player.rail) { + player.rail.remove(); + } + }, + setProgressRail: function setProgressRail(e) { + var t = this, + target = e !== undefined ? e.detail.target || e.target : t.media; + + var percent = null; + + if (target && target.buffered && target.buffered.length > 0 && target.buffered.end && t.getDuration()) { + percent = target.buffered.end(target.buffered.length - 1) / t.getDuration(); + } else if (target && target.bytesTotal !== undefined && target.bytesTotal > 0 && target.bufferedBytes !== undefined) { + percent = target.bufferedBytes / target.bytesTotal; + } else if (e && e.lengthComputable && e.total !== 0) { + percent = e.loaded / e.total; + } + + if (percent !== null) { + percent = Math.min(1, Math.max(0, percent)); + + if (t.loaded) { + t.setTransformStyle(t.loaded, 'scaleX(' + percent + ')'); + } + } + }, + setCurrentRailHandle: function setCurrentRailHandle(fakeTime) { + var t = this; + t.setCurrentRailMain(t, fakeTime); + }, + setCurrentRail: function setCurrentRail() { + var t = this; + t.setCurrentRailMain(t); + }, + setCurrentRailMain: function setCurrentRailMain(t, fakeTime) { + if (t.getCurrentTime() !== undefined && t.getDuration()) { + var nTime = typeof fakeTime === 'undefined' ? t.getCurrentTime() : fakeTime; + + if (t.total && t.handle) { + var tW = parseFloat(getComputedStyle(t.total).width); + + var newWidth = Math.round(tW * nTime / t.getDuration()), + handlePos = newWidth - Math.round(t.handle.offsetWidth / 2); + + handlePos = handlePos < 0 ? 0 : handlePos; + t.setTransformStyle(t.current, 'scaleX(' + newWidth / tW + ')'); + t.setTransformStyle(t.handle, 'translateX(' + handlePos + 'px)'); + + if (t.options.useSmoothHover && !(0, _dom.hasClass)(t.hovered, 'no-hover')) { + var pos = parseInt(t.hovered.getAttribute('pos'), 10); + pos = isNaN(pos) ? 0 : pos; + + var hoverScaleX = pos / tW - handlePos / tW; + + t.hovered.style.left = handlePos + 'px'; + t.setTransformStyle(t.hovered, 'scaleX(' + hoverScaleX + ')'); + + if (hoverScaleX >= 0) { + (0, _dom.removeClass)(t.hovered, 'negative'); + } else { + (0, _dom.addClass)(t.hovered, 'negative'); + } + } + } + } + } +}); + +},{"17":17,"2":2,"24":24,"25":25,"30":30,"6":6}],13:[function(_dereq_,module,exports){ +'use strict'; + +var _document = _dereq_(2); + +var _document2 = _interopRequireDefault(_document); + +var _player = _dereq_(17); + +var _player2 = _interopRequireDefault(_player); + +var _time = _dereq_(30); + +var _dom = _dereq_(25); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +Object.assign(_player.config, { + duration: 0, + + timeAndDurationSeparator: ' | ' +}); + +Object.assign(_player2.default.prototype, { + buildcurrent: function buildcurrent(player, controls, layers, media) { + var t = this, + time = _document2.default.createElement('div'); + + time.className = t.options.classPrefix + 'time'; + time.setAttribute('role', 'timer'); + time.setAttribute('aria-live', 'off'); + time.innerHTML = '' + (0, _time.secondsToTimeCode)(0, player.options.alwaysShowHours, player.options.showTimecodeFrameCount, player.options.framesPerSecond, player.options.secondsDecimalLength, player.options.timeFormat) + ''; + + t.addControlElement(time, 'current'); + player.updateCurrent(); + t.updateTimeCallback = function () { + if (t.controlsAreVisible) { + player.updateCurrent(); + } + }; + media.addEventListener('timeupdate', t.updateTimeCallback); + }, + cleancurrent: function cleancurrent(player, controls, layers, media) { + media.removeEventListener('timeupdate', player.updateTimeCallback); + }, + buildduration: function buildduration(player, controls, layers, media) { + var t = this, + currTime = controls.lastChild.querySelector('.' + t.options.classPrefix + 'currenttime'); + + if (currTime) { + controls.querySelector('.' + t.options.classPrefix + 'time').innerHTML += t.options.timeAndDurationSeparator + '' + ((0, _time.secondsToTimeCode)(t.options.duration, t.options.alwaysShowHours, t.options.showTimecodeFrameCount, t.options.framesPerSecond, t.options.secondsDecimalLength, t.options.timeFormat) + ''); + } else { + if (controls.querySelector('.' + t.options.classPrefix + 'currenttime')) { + (0, _dom.addClass)(controls.querySelector('.' + t.options.classPrefix + 'currenttime').parentNode, t.options.classPrefix + 'currenttime-container'); + } + + var duration = _document2.default.createElement('div'); + duration.className = t.options.classPrefix + 'time ' + t.options.classPrefix + 'duration-container'; + duration.innerHTML = '' + ((0, _time.secondsToTimeCode)(t.options.duration, t.options.alwaysShowHours, t.options.showTimecodeFrameCount, t.options.framesPerSecond, t.options.secondsDecimalLength, t.options.timeFormat) + ''); + + t.addControlElement(duration, 'duration'); + } + + t.updateDurationCallback = function () { + if (t.controlsAreVisible) { + player.updateDuration(); + } + }; + + media.addEventListener('timeupdate', t.updateDurationCallback); + }, + cleanduration: function cleanduration(player, controls, layers, media) { + media.removeEventListener('timeupdate', player.updateDurationCallback); + }, + updateCurrent: function updateCurrent() { + var t = this; + + var currentTime = t.getCurrentTime(); + + if (isNaN(currentTime)) { + currentTime = 0; + } + + var timecode = (0, _time.secondsToTimeCode)(currentTime, t.options.alwaysShowHours, t.options.showTimecodeFrameCount, t.options.framesPerSecond, t.options.secondsDecimalLength, t.options.timeFormat); + + if (timecode.length > 5) { + (0, _dom.addClass)(t.getElement(t.container), t.options.classPrefix + 'long-video'); + } else { + (0, _dom.removeClass)(t.getElement(t.container), t.options.classPrefix + 'long-video'); + } + + if (t.getElement(t.controls).querySelector('.' + t.options.classPrefix + 'currenttime')) { + t.getElement(t.controls).querySelector('.' + t.options.classPrefix + 'currenttime').innerText = timecode; + } + }, + updateDuration: function updateDuration() { + var t = this; + + var duration = t.getDuration(); + + if (t.media !== undefined && (isNaN(duration) || duration === Infinity || duration < 0)) { + t.media.duration = t.options.duration = duration = 0; + } + + if (t.options.duration > 0) { + duration = t.options.duration; + } + + var timecode = (0, _time.secondsToTimeCode)(duration, t.options.alwaysShowHours, t.options.showTimecodeFrameCount, t.options.framesPerSecond, t.options.secondsDecimalLength, t.options.timeFormat); + + if (timecode.length > 5) { + (0, _dom.addClass)(t.getElement(t.container), t.options.classPrefix + 'long-video'); + } else { + (0, _dom.removeClass)(t.getElement(t.container), t.options.classPrefix + 'long-video'); + } + + if (t.getElement(t.controls).querySelector('.' + t.options.classPrefix + 'duration') && duration > 0) { + t.getElement(t.controls).querySelector('.' + t.options.classPrefix + 'duration').innerHTML = timecode; + } + } +}); + +},{"17":17,"2":2,"25":25,"30":30}],14:[function(_dereq_,module,exports){ +'use strict'; + +var _document = _dereq_(2); + +var _document2 = _interopRequireDefault(_document); + +var _mejs = _dereq_(8); + +var _mejs2 = _interopRequireDefault(_mejs); + +var _i18n = _dereq_(6); + +var _i18n2 = _interopRequireDefault(_i18n); + +var _player = _dereq_(17); + +var _player2 = _interopRequireDefault(_player); + +var _general = _dereq_(26); + +var _dom = _dereq_(25); + +var _generate = _dereq_(27); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +Object.assign(_player.config, { + autoplayCaptionLanguage: null, + + defaultTrackLine: -3, + + tracksText: null, + + chaptersText: null, + + chaptersLanguage: null, + + hideCaptionsButtonWhenEmpty: true, + + toggleCaptionsButtonWhenOnlyOne: false +}); + +Object.assign(_player2.default.prototype, { + hasChapters: false, + + buildtracks: function buildtracks(player, controls) { + this.initTracks(player); + + if (!player.tracks.length && (!player.trackFiles || !(player.trackFiles.length === 0))) { + return; + } + + var t = this, + tracksTitle = (0, _general.isString)(t.options.tracksText) ? t.options.tracksText : _i18n2.default.t('mejs.captions-subtitles'), + chaptersTitle = (0, _general.isString)(t.options.chaptersText) ? t.options.chaptersText : _i18n2.default.t('mejs.captions-chapters'); + + t.hideAllTracks(); + + t.clearTrackHtml(player); + + player.captionsButton = _document2.default.createElement('div'); + player.captionsButton.className = t.options.classPrefix + 'button ' + t.options.classPrefix + 'captions-button'; + player.captionsButton.innerHTML = (0, _generate.generateControlButton)(t.id, tracksTitle, tracksTitle, '' + t.media.options.iconSprite, ['icon-captions'], '' + t.options.classPrefix) + ('
') + ('
    ') + ('
  • ') + ('' + ('') + '
  • ' + '
' + '
'; + + t.addControlElement(player.captionsButton, 'tracks'); + + player.captionsButton.querySelector('.' + t.options.classPrefix + 'captions-selector-input').disabled = false; + + player.chaptersButton = _document2.default.createElement('div'); + player.chaptersButton.className = t.options.classPrefix + 'button ' + t.options.classPrefix + 'chapters-button'; + player.chaptersButton.innerHTML = (0, _generate.generateControlButton)(t.id, chaptersTitle, chaptersTitle, '' + t.media.options.iconSprite, ['icon-chapters'], '' + t.options.classPrefix) + ('
') + ('
    ') + '
    '; + + var subtitles = t.getSubtitles(); + var chapters = t.getChapters(); + + if (chapters.length > 0 && !controls.querySelector('.' + t.options.classPrefix + 'chapter-selector')) { + player.captionsButton.parentNode.insertBefore(player.chaptersButton, player.captionsButton); + } + + for (var i = 0; i < subtitles.length; i++) { + player.addTrackButton(subtitles[i]); + if (subtitles[i].isLoaded) { + t.enableTrackButton(subtitles[i]); + } + } + + player.trackToLoad = -1; + player.selectedTrack = null; + player.isLoadingTrack = false; + + var inEvents = ['mouseenter', 'focusin'], + outEvents = ['mouseleave', 'focusout']; + + if (t.options.toggleCaptionsButtonWhenOnlyOne && subtitles.length === 1) { + player.captionsButton.classList.add(t.options.classPrefix + 'captions-button-toggle'); + player.captionsButton.addEventListener('click', function () { + var trackId = 'none'; + if (player.selectedTrack === null) { + trackId = player.getSubtitles()[0].trackId; + } + player.setTrack(trackId); + }); + } else { + var labels = player.captionsButton.querySelectorAll('.' + t.options.classPrefix + 'captions-selector-label'), + captions = player.captionsButton.querySelectorAll('input[type=radio]'); + + for (var _i = 0; _i < inEvents.length; _i++) { + player.captionsButton.addEventListener(inEvents[_i], function () { + (0, _dom.removeClass)(this.querySelector('.' + t.options.classPrefix + 'captions-selector'), t.options.classPrefix + 'offscreen'); + }); + } + + for (var _i2 = 0; _i2 < outEvents.length; _i2++) { + player.captionsButton.addEventListener(outEvents[_i2], function () { + var _this = this; + + setTimeout(function () { + (0, _dom.addClass)(_this.querySelector('.' + t.options.classPrefix + 'captions-selector'), t.options.classPrefix + 'offscreen'); + }, 0); + }); + } + + for (var _i3 = 0; _i3 < captions.length; _i3++) { + captions[_i3].addEventListener('click', function (e) { + if (!e.target.disabled) { + player.setTrack(this.value); + } + }); + } + + for (var _i4 = 0; _i4 < labels.length; _i4++) { + labels[_i4].addEventListener('click', function (e) { + var radio = (0, _dom.siblings)(this, function (el) { + return el.tagName === 'INPUT'; + })[0], + event = (0, _general.createEvent)('click', radio); + radio.dispatchEvent(event); + e.preventDefault(); + }); + } + + player.captionsButton.addEventListener('keydown', function (e) { + e.stopPropagation(); + }); + } + + for (var _i5 = 0; _i5 < inEvents.length; _i5++) { + player.chaptersButton.addEventListener(inEvents[_i5], function () { + if (this.querySelector('.' + t.options.classPrefix + 'chapters-selector-list').children.length) { + (0, _dom.removeClass)(this.querySelector('.' + t.options.classPrefix + 'chapters-selector'), t.options.classPrefix + 'offscreen'); + } + }); + } + + for (var _i6 = 0; _i6 < outEvents.length; _i6++) { + player.chaptersButton.addEventListener(outEvents[_i6], function () { + var _this2 = this; + + setTimeout(function () { + (0, _dom.addClass)(_this2.querySelector('.' + t.options.classPrefix + 'chapters-selector'), t.options.classPrefix + 'offscreen'); + }, 0); + }); + } + + player.chaptersButton.addEventListener('keydown', function (e) { + e.stopPropagation(); + }); + + t.checkAllCaptionsLoadedOrError(); + t.checkAllChaptersLoadedOrError(); + }, + clearTrackHtml: function clearTrackHtml(player) { + if (player) { + if (player.captionsButton) { + player.captionsButton.remove(); + } + if (player.chaptersButton) { + player.chaptersButton.remove(); + } + } + }, + initTracks: function initTracks(player) { + var t = this, + trackFiles = t.trackFiles === null ? t.node.querySelectorAll('track') : t.trackFiles; + + t.tracks = []; + + if (trackFiles) { + player.trackFiles = trackFiles; + for (var i = 0; i < trackFiles.length; i++) { + var track = trackFiles[i], + srclang = track.getAttribute('srclang').toLowerCase() || '', + trackId = track.getAttribute('id') || t.id + '_track_' + i + '_' + track.getAttribute('kind') + '_' + srclang; + track.setAttribute('id', trackId); + + var trackData = { + trackId: trackId, + srclang: srclang, + src: track.getAttribute('src'), + kind: track.getAttribute('kind'), + label: track.getAttribute('label') || '', + entries: [], + isDefault: track.hasAttribute('default'), + isError: false, + isLoaded: false + }; + t.tracks.push(trackData); + + if (track.getAttribute('kind') === 'captions' || track.getAttribute('kind') === 'subtitles') { + switch (track.readyState) { + case 2: + t.handleCaptionsLoaded(track); + break; + case 3: + t.handleCaptionsError(track); + break; + default: + track.addEventListener('load', function (event) { + t.handleCaptionsLoaded(event.target); + }); + track.addEventListener('error', function (event) { + t.handleCaptionsError(event.target); + }); + break; + } + } else if (track.getAttribute('kind') === 'chapters') { + switch (track.readyState) { + case 2: + t.handleChaptersLoaded(track); + break; + case 3: + t.handleChaptersError(track); + break; + default: + track.addEventListener('load', function (event) { + t.handleChaptersLoaded(event.target); + }); + track.addEventListener('error', function (event) { + t.handleChaptersError(event.target); + }); + break; + } + } + } + } + }, + handleCaptionsLoaded: function handleCaptionsLoaded(target) { + var textTracks = this.node.textTracks, + playerTrack = this.getTrackById(target.getAttribute('id')); + + if (Number.isInteger(this.options.defaultTrackLine)) { + for (var i = 0; i < textTracks.length; i++) { + if (target.getAttribute('srclang') === textTracks[i].language && target.getAttribute('kind') === textTracks[i].kind) { + var cues = textTracks[i].cues; + for (var c = 0; c < cues.length; c++) { + if (cues[c].line === 'auto' || cues[c].line === undefined || cues[c].line === null) { + cues[c].line = this.options.defaultTrackLine; + } + } + break; + } + } + } + + playerTrack.isLoaded = true; + this.enableTrackButton(playerTrack); + this.checkAllCaptionsLoadedOrError(); + }, + handleCaptionsError: function handleCaptionsError(target) { + var playerTrack = this.getTrackById(target.getAttribute('id')); + + playerTrack.isError = true; + this.removeTrackButton(playerTrack); + this.checkAllCaptionsLoadedOrError(); + }, + handleChaptersLoaded: function handleChaptersLoaded(target) { + var playerTrack = this.getTrackById(target.getAttribute('id')); + + this.hasChapters = true; + playerTrack.isLoaded = true; + this.checkAllChaptersLoadedOrError(); + }, + handleChaptersError: function handleChaptersError(target) { + var playerTrack = this.getTrackById(target.getAttribute('id')); + playerTrack.isError = true; + this.checkAllChaptersLoadedOrError(); + }, + checkAllCaptionsLoadedOrError: function checkAllCaptionsLoadedOrError() { + var subtitles = this.getSubtitles(); + if (subtitles.length === subtitles.filter(function (_ref) { + var isLoaded = _ref.isLoaded, + isError = _ref.isError; + return isLoaded || isError; + }).length) { + this.removeCaptionsIfEmpty(); + this.checkForAutoPlay(); + } + }, + checkAllChaptersLoadedOrError: function checkAllChaptersLoadedOrError() { + var _this3 = this; + + var chapters = this.getChapters(), + readyChapters = chapters.filter(function (_ref2) { + var isLoaded = _ref2.isLoaded; + return isLoaded; + }); + if (chapters.length === chapters.filter(function (_ref3) { + var isLoaded = _ref3.isLoaded, + isError = _ref3.isError; + return isLoaded || isError; + }).length) { + if (readyChapters.length === 0) { + this.chaptersButton.remove(); + } else { + var langChapter = readyChapters.find(function (_ref4) { + var srclang = _ref4.srclang; + return srclang === _this3.options.chaptersLanguage; + }); + + langChapter = langChapter || readyChapters.find(function (_ref5) { + var srclang = _ref5.srclang; + return srclang === _i18n2.default.lang; + }); + + if (readyChapters.length === 1 || !langChapter) { + this.drawChapters(readyChapters[0].trackId); + } else { + this.drawChapters(langChapter.trackId); + } + } + } + }, + setTrack: function setTrack(trackId) { + var t = this, + radios = t.captionsButton.querySelectorAll('input[type="radio"]'), + captions = t.captionsButton.querySelectorAll('.' + t.options.classPrefix + 'captions-selected'), + track = t.captionsButton.querySelector('input[value="' + trackId + '"]'); + + for (var i = 0; i < radios.length; i++) { + radios[i].checked = false; + } + + for (var _i7 = 0; _i7 < captions.length; _i7++) { + (0, _dom.removeClass)(captions[_i7], t.options.classPrefix + 'captions-selected'); + } + + track.checked = true; + var labels = (0, _dom.siblings)(track, function (el) { + return (0, _dom.hasClass)(el, t.options.classPrefix + 'captions-selector-label'); + }); + for (var _i8 = 0; _i8 < labels.length; _i8++) { + (0, _dom.addClass)(labels[_i8], t.options.classPrefix + 'captions-selected'); + } + + if (trackId === 'none') { + t.selectedTrack = null; + (0, _dom.removeClass)(t.captionsButton, t.options.classPrefix + 'captions-enabled'); + t.deactivateVideoTracks(); + } else { + var _track = t.getTrackById(trackId); + if (_track) { + if (t.selectedTrack === null) { + (0, _dom.addClass)(t.captionsButton, t.options.classPrefix + 'captions-enabled'); + } + t.selectedTrack = _track; + t.activateVideoTrack(t.selectedTrack.srclang); + } + } + + var event = (0, _general.createEvent)('captionschange', t.media); + event.detail.caption = t.selectedTrack; + t.media.dispatchEvent(event); + }, + hideAllTracks: function hideAllTracks() { + if (this.node.textTracks) { + for (var i = 0; i < this.node.textTracks.length; i++) { + this.node.textTracks[i].mode = 'hidden'; + } + } + }, + deactivateVideoTracks: function deactivateVideoTracks() { + if (this.node.textTracks) { + for (var i = 0; i < this.node.textTracks.length; i++) { + var track = this.node.textTracks[i]; + if (track.kind === 'subtitles' || track.kind === 'captions') { + track.mode = 'hidden'; + } + } + } + if (this.options.toggleCaptionsButtonWhenOnlyOne && this.getSubtitles().length === 1) { + this.captionsButton.classList.remove(this.options.classPrefix + 'captions-button-toggle-on'); + } + }, + activateVideoTrack: function activateVideoTrack(srclang) { + for (var i = 0; i < this.node.textTracks.length; i++) { + var track = this.node.textTracks[i]; + + if (track.kind === 'subtitles' || track.kind === 'captions') { + if (track.language === srclang) { + track.mode = 'showing'; + if (this.options.toggleCaptionsButtonWhenOnlyOne && this.getSubtitles().length === 1) { + this.captionsButton.classList.add(this.options.classPrefix + 'captions-button-toggle-on'); + } + } else { + track.mode = 'hidden'; + } + } + } + }, + checkForAutoPlay: function checkForAutoPlay() { + var _this4 = this; + + var readySubtitles = this.getSubtitles().filter(function (_ref6) { + var isError = _ref6.isError; + return !isError; + }), + autoplayTrack = readySubtitles.find(function (_ref7) { + var srclang = _ref7.srclang; + return _this4.options.autoplayCaptionLanguage === srclang; + }) || readySubtitles.find(function (_ref8) { + var isDefault = _ref8.isDefault; + return isDefault; + }); + + if (autoplayTrack) { + if (this.options.toggleCaptionsButtonWhenOnlyOne && readySubtitles.length === 1 && this.captionsButton) { + this.captionsButton.dispatchEvent((0, _general.createEvent)('click', this.captionsButton)); + } else { + var target = _document2.default.getElementById(autoplayTrack.trackId + '-btn'); + if (target) { + target.checked = true; + target.dispatchEvent((0, _general.createEvent)('click', target)); + } + } + } + }, + enableTrackButton: function enableTrackButton(track) { + var t = this, + lang = track.srclang, + target = _document2.default.getElementById(track.trackId + '-btn'); + if (!target) { + return; + } + + var label = track.label; + + if (label === '') { + label = _i18n2.default.t(_mejs2.default.language.codes[lang]) || lang; + } + target.disabled = false; + var targetSiblings = (0, _dom.siblings)(target, function (el) { + return (0, _dom.hasClass)(el, t.options.classPrefix + 'captions-selector-label'); + }); + for (var i = 0; i < targetSiblings.length; i++) { + targetSiblings[i].innerHTML = label; + } + }, + removeTrackButton: function removeTrackButton(track) { + var element = _document2.default.getElementById(track.trackId + '-btn'); + if (element) { + var button = element.closest('li'); + if (button) { + button.remove(); + } + } + }, + addTrackButton: function addTrackButton(track) { + var t = this, + label = track.label || _i18n2.default.t(_mejs2.default.language.codes[track.srclang]) || track.srclang; + + t.captionsButton.querySelector('ul').innerHTML += '
  • ' + ('') + ('') + '
  • '; + }, + removeCaptionsIfEmpty: function removeCaptionsIfEmpty() { + if (this.captionsButton && this.options.hideCaptionsButtonWhenEmpty) { + var subtitleCount = this.getSubtitles().filter(function (_ref9) { + var isError = _ref9.isError; + return !isError; + }).length; + this.captionsButton.style.display = subtitleCount > 0 ? '' : 'none'; + this.setControlsSize(); + } + }, + drawChapters: function drawChapters(chapterTrackId) { + var t = this, + chapter = this.node.textTracks.getTrackById(chapterTrackId), + numberOfChapters = chapter.cues.length; + + if (!numberOfChapters) { + return; + } + + t.chaptersButton.querySelector('ul').innerHTML = ''; + + for (var i = 0; i < numberOfChapters; i++) { + t.chaptersButton.querySelector('ul').innerHTML += '
  • ' + ('') + ('') + '
  • '; + } + + var radios = t.chaptersButton.querySelectorAll('input[type="radio"]'), + labels = t.chaptersButton.querySelectorAll('.' + t.options.classPrefix + 'chapters-selector-label'); + + for (var _i9 = 0; _i9 < radios.length; _i9++) { + radios[_i9].disabled = false; + radios[_i9].checked = false; + radios[_i9].addEventListener('click', function (e) { + var self = this, + listItems = t.chaptersButton.querySelectorAll('li'), + label = (0, _dom.siblings)(self, function (el) { + return (0, _dom.hasClass)(el, t.options.classPrefix + 'chapters-selector-label'); + })[0]; + + self.checked = true; + self.parentNode.setAttribute('aria-checked', true); + (0, _dom.addClass)(label, t.options.classPrefix + 'chapters-selected'); + (0, _dom.removeClass)(t.chaptersButton.querySelector('.' + t.options.classPrefix + 'chapters-selected'), t.options.classPrefix + 'chapters-selected'); + + for (var _i10 = 0; _i10 < listItems.length; _i10++) { + listItems[_i10].setAttribute('aria-checked', false); + } + + var keyboard = e.keyCode || e.which; + if (typeof keyboard === 'undefined') { + setTimeout(function () { + t.getElement(t.container).focus(); + }, 500); + } + + t.media.setCurrentTime(parseFloat(self.value)); + if (t.media.paused) { + t.media.play(); + } + }); + } + + for (var _i11 = 0; _i11 < labels.length; _i11++) { + labels[_i11].addEventListener('click', function (e) { + var radio = (0, _dom.siblings)(this, function (el) { + return el.tagName === 'INPUT'; + })[0], + event = (0, _general.createEvent)('click', radio); + radio.dispatchEvent(event); + e.preventDefault(); + }); + } + }, + getTrackById: function getTrackById(trackId) { + return this.tracks.find(function (track) { + return track.trackId === trackId; + }); + }, + getChapters: function getChapters() { + return this.tracks.filter(function (_ref10) { + var kind = _ref10.kind; + return kind === 'chapters'; + }); + }, + getSubtitles: function getSubtitles() { + return this.tracks.filter(function (_ref11) { + var kind = _ref11.kind; + return kind === 'subtitles' || kind === 'captions'; + }); + }, + searchTrackPosition: function searchTrackPosition(tracks, currentTime) { + var lo = 0, + hi = tracks.length - 1, + mid = void 0, + start = void 0, + stop = void 0; + + while (lo <= hi) { + mid = lo + hi >> 1; + start = tracks[mid].start; + stop = tracks[mid].stop; + + if (currentTime >= start && currentTime < stop) { + return mid; + } else if (start < currentTime) { + lo = mid + 1; + } else if (start > currentTime) { + hi = mid - 1; + } + } + + return -1; + } +}); + +_mejs2.default.language = { + codes: { + af: 'mejs.afrikaans', + sq: 'mejs.albanian', + ar: 'mejs.arabic', + be: 'mejs.belarusian', + bg: 'mejs.bulgarian', + ca: 'mejs.catalan', + zh: 'mejs.chinese', + 'zh-cn': 'mejs.chinese-simplified', + 'zh-tw': 'mejs.chines-traditional', + hr: 'mejs.croatian', + cs: 'mejs.czech', + da: 'mejs.danish', + nl: 'mejs.dutch', + en: 'mejs.english', + et: 'mejs.estonian', + fl: 'mejs.filipino', + fi: 'mejs.finnish', + fr: 'mejs.french', + gl: 'mejs.galician', + de: 'mejs.german', + el: 'mejs.greek', + ht: 'mejs.haitian-creole', + iw: 'mejs.hebrew', + hi: 'mejs.hindi', + hu: 'mejs.hungarian', + is: 'mejs.icelandic', + id: 'mejs.indonesian', + ga: 'mejs.irish', + it: 'mejs.italian', + ja: 'mejs.japanese', + ko: 'mejs.korean', + lv: 'mejs.latvian', + lt: 'mejs.lithuanian', + mk: 'mejs.macedonian', + ms: 'mejs.malay', + mt: 'mejs.maltese', + no: 'mejs.norwegian', + fa: 'mejs.persian', + pl: 'mejs.polish', + pt: 'mejs.portuguese', + ro: 'mejs.romanian', + ru: 'mejs.russian', + sr: 'mejs.serbian', + sk: 'mejs.slovak', + sl: 'mejs.slovenian', + es: 'mejs.spanish', + sw: 'mejs.swahili', + sv: 'mejs.swedish', + tl: 'mejs.tagalog', + th: 'mejs.thai', + tr: 'mejs.turkish', + uk: 'mejs.ukrainian', + vi: 'mejs.vietnamese', + cy: 'mejs.welsh', + yi: 'mejs.yiddish' + } +}; + +},{"17":17,"2":2,"25":25,"26":26,"27":27,"6":6,"8":8}],15:[function(_dereq_,module,exports){ +'use strict'; + +var _document = _dereq_(2); + +var _document2 = _interopRequireDefault(_document); + +var _player = _dereq_(17); + +var _player2 = _interopRequireDefault(_player); + +var _i18n = _dereq_(6); + +var _i18n2 = _interopRequireDefault(_i18n); + +var _constants = _dereq_(24); + +var _general = _dereq_(26); + +var _dom = _dereq_(25); + +var _generate = _dereq_(27); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +Object.assign(_player.config, { + muteText: null, + + unmuteText: null, + + allyVolumeControlText: null, + + hideVolumeOnTouchDevices: true, + + audioVolume: 'horizontal', + + videoVolume: 'vertical', + + startVolume: 0.8 +}); + +Object.assign(_player2.default.prototype, { + buildvolume: function buildvolume(player, controls, layers, media) { + if ((_constants.IS_ANDROID || _constants.IS_IOS) && this.options.hideVolumeOnTouchDevices) { + return; + } + + var t = this, + mode = t.isVideo ? t.options.videoVolume : t.options.audioVolume, + muteText = (0, _general.isString)(t.options.muteText) ? t.options.muteText : _i18n2.default.t('mejs.mute'), + unmuteText = (0, _general.isString)(t.options.unmuteText) ? t.options.unmuteText : _i18n2.default.t('mejs.unmute'), + volumeControlText = (0, _general.isString)(t.options.allyVolumeControlText) ? t.options.allyVolumeControlText : _i18n2.default.t('mejs.volume-help-text'), + mute = _document2.default.createElement('div'); + + mute.className = t.options.classPrefix + 'button ' + t.options.classPrefix + 'volume-button ' + t.options.classPrefix + 'mute'; + mute.innerHTML = mode === 'horizontal' ? (0, _generate.generateControlButton)(t.id, muteText, muteText, '' + t.media.options.iconSprite, ['icon-mute', 'icon-unmute'], '' + t.options.classPrefix, '', t.options.classPrefix + 'horizontal-volume-slider') : (0, _generate.generateControlButton)(t.id, muteText, muteText, '' + t.media.options.iconSprite, ['icon-mute', 'icon-unmute'], '' + t.options.classPrefix, '', t.options.classPrefix + 'volume-slider') + ('' + ('' + volumeControlText + '') + ('
    ') + ('
    ') + ('
    ') + '
    ' + '
    '; + + t.addControlElement(mute, 'volume'); + + t.options.keyActions.push({ + keys: [38], + action: function action(player) { + var volumeSlider = player.getElement(player.container).querySelector('.' + t.options.classPrefix + 'volume-slider'); + if (volumeSlider && volumeSlider.matches(':focus')) { + volumeSlider.style.display = 'block'; + } + if (player.isVideo) { + player.showControls(); + player.startControlsTimer(); + } + + var newVolume = Math.min(player.volume + 0.1, 1); + player.setVolume(newVolume); + if (newVolume > 0) { + player.setMuted(false); + } + } + }, { + keys: [40], + action: function action(player) { + var volumeSlider = player.getElement(player.container).querySelector('.' + t.options.classPrefix + 'volume-slider'); + if (volumeSlider) { + volumeSlider.style.display = 'block'; + } + + if (player.isVideo) { + player.showControls(); + player.startControlsTimer(); + } + + var newVolume = Math.max(player.volume - 0.1, 0); + player.setVolume(newVolume); + + if (newVolume <= 0.1) { + player.setMuted(true); + } + } + }, { + keys: [77], + action: function action(player) { + var volumeSlider = player.getElement(player.container).querySelector('.' + t.options.classPrefix + 'volume-slider'); + if (volumeSlider) { + volumeSlider.style.display = 'block'; + } + + if (player.isVideo) { + player.showControls(); + player.startControlsTimer(); + } + if (player.media.muted) { + player.setMuted(false); + } else { + player.setMuted(true); + } + } + }); + + if (mode === 'horizontal') { + var anchor = _document2.default.createElement('a'); + anchor.className = t.options.classPrefix + 'horizontal-volume-slider'; + anchor.setAttribute('aria-label', _i18n2.default.t('mejs.volume-slider')); + anchor.setAttribute('aria-valuemin', 0); + anchor.setAttribute('aria-valuemax', 100); + anchor.setAttribute('aria-valuenow', 100); + anchor.setAttribute('role', 'slider'); + anchor.innerHTML += '' + volumeControlText + '' + ('
    ') + ('
    ') + ('
    ') + '
    '; + mute.parentNode.insertBefore(anchor, mute.nextSibling); + } + + var mouseIsDown = false, + mouseIsOver = false, + modified = false, + updateVolumeSlider = function updateVolumeSlider() { + var volume = Math.floor(media.volume * 100); + volumeSlider.setAttribute('aria-valuenow', volume); + volumeSlider.setAttribute('aria-valuetext', volume + '%'); + }; + + var volumeSlider = mode === 'vertical' ? t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'volume-slider') : t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'horizontal-volume-slider'), + volumeTotal = mode === 'vertical' ? t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'volume-total') : t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'horizontal-volume-total'), + volumeCurrent = mode === 'vertical' ? t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'volume-current') : t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'horizontal-volume-current'), + volumeHandle = mode === 'vertical' ? t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'volume-handle') : t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'horizontal-volume-handle'), + positionVolumeHandle = function positionVolumeHandle(volume) { + + if (volume === null || isNaN(volume) || volume === undefined) { + return; + } + + volume = Math.max(0, volume); + volume = Math.min(volume, 1); + + if (volume === 0) { + (0, _dom.removeClass)(mute, t.options.classPrefix + 'mute'); + (0, _dom.addClass)(mute, t.options.classPrefix + 'unmute'); + var button = mute.firstElementChild; + button.setAttribute('title', unmuteText); + button.setAttribute('aria-label', unmuteText); + } else { + (0, _dom.removeClass)(mute, t.options.classPrefix + 'unmute'); + (0, _dom.addClass)(mute, t.options.classPrefix + 'mute'); + var _button = mute.firstElementChild; + _button.setAttribute('title', muteText); + _button.setAttribute('aria-label', muteText); + } + + var volumePercentage = volume * 100 + '%', + volumeStyles = getComputedStyle(volumeHandle); + + if (mode === 'vertical') { + volumeCurrent.style.bottom = 0; + volumeCurrent.style.height = volumePercentage; + volumeHandle.style.bottom = volumePercentage; + volumeHandle.style.marginBottom = -parseFloat(volumeStyles.height) / 2 + 'px'; + } else { + volumeCurrent.style.left = 0; + volumeCurrent.style.width = volumePercentage; + volumeHandle.style.left = volumePercentage; + volumeHandle.style.marginLeft = -parseFloat(volumeStyles.width) / 2 + 'px'; + } + }, + handleVolumeMove = function handleVolumeMove(e) { + var totalOffset = (0, _dom.offset)(volumeTotal), + volumeStyles = getComputedStyle(volumeTotal); + + modified = true; + + var volume = null; + + if (mode === 'vertical') { + var railHeight = parseFloat(volumeStyles.height), + newY = e.pageY - totalOffset.top; + + volume = (railHeight - newY) / railHeight; + + if (totalOffset.top === 0 || totalOffset.left === 0) { + return; + } + } else { + var railWidth = parseFloat(volumeStyles.width), + newX = e.pageX - totalOffset.left; + + volume = newX / railWidth; + } + + volume = Math.max(0, volume); + volume = Math.min(volume, 1); + + positionVolumeHandle(volume); + + t.setMuted(volume === 0); + t.setVolume(volume); + + e.preventDefault(); + e.stopPropagation(); + }, + toggleMute = function toggleMute() { + if (t.muted) { + positionVolumeHandle(0); + (0, _dom.removeClass)(mute, t.options.classPrefix + 'mute'); + (0, _dom.addClass)(mute, t.options.classPrefix + 'unmute'); + } else { + + positionVolumeHandle(media.volume); + (0, _dom.removeClass)(mute, t.options.classPrefix + 'unmute'); + (0, _dom.addClass)(mute, t.options.classPrefix + 'mute'); + } + }; + + player.getElement(player.container).addEventListener('keydown', function (e) { + var hasFocus = !!e.target.closest('.' + t.options.classPrefix + 'container'); + if (!hasFocus && mode === 'vertical') { + volumeSlider.style.display = 'none'; + } + }); + + mute.addEventListener('mouseenter', function (e) { + if (e.target === mute) { + volumeSlider.style.display = 'block'; + mouseIsOver = true; + e.preventDefault(); + e.stopPropagation(); + } + }); + mute.addEventListener('focusin', function () { + volumeSlider.style.display = 'block'; + mouseIsOver = true; + }); + + mute.addEventListener('focusout', function (e) { + if ((!e.relatedTarget || e.relatedTarget && !e.relatedTarget.matches('.' + t.options.classPrefix + 'volume-slider')) && mode === 'vertical') { + volumeSlider.style.display = 'none'; + } + }); + mute.addEventListener('mouseleave', function () { + mouseIsOver = false; + if (!mouseIsDown && mode === 'vertical') { + volumeSlider.style.display = 'none'; + } + }); + mute.addEventListener('focusout', function () { + mouseIsOver = false; + }); + mute.addEventListener('keydown', function (e) { + if (t.options.enableKeyboard && t.options.keyActions.length) { + var keyCode = e.which || e.keyCode || 0, + volume = media.volume; + + switch (keyCode) { + case 38: + volume = Math.min(volume + 0.1, 1); + break; + case 40: + volume = Math.max(0, volume - 0.1); + break; + default: + return true; + } + + mouseIsDown = false; + positionVolumeHandle(volume); + media.setVolume(volume); + + e.preventDefault(); + e.stopPropagation(); + } + }); + mute.querySelector('button').addEventListener('click', function () { + media.setMuted(!media.muted); + var event = (0, _general.createEvent)('volumechange', media); + media.dispatchEvent(event); + }); + + volumeSlider.addEventListener('dragstart', function () { + return false; + }); + + volumeSlider.addEventListener('mouseover', function () { + mouseIsOver = true; + }); + volumeSlider.addEventListener('focusin', function () { + volumeSlider.style.display = 'block'; + mouseIsOver = true; + }); + volumeSlider.addEventListener('focusout', function () { + mouseIsOver = false; + if (!mouseIsDown && mode === 'vertical') { + volumeSlider.style.display = 'none'; + } + }); + volumeSlider.addEventListener('mousedown', function (e) { + handleVolumeMove(e); + t.globalBind('mousemove.vol', function (event) { + var target = event.target; + + var targetHasClosest = typeof target.closest == 'function'; + var targetSliderElement = target.closest(mode === 'vertical' ? '.' + t.options.classPrefix + 'volume-slider' : '.' + t.options.classPrefix + 'horizontal-volume-slider'); + if (mouseIsDown && (target === volumeSlider || targetHasClosest && targetSliderElement)) { + handleVolumeMove(event); + } + }); + t.globalBind('mouseup.vol', function () { + mouseIsDown = false; + if (!mouseIsOver && mode === 'vertical') { + volumeSlider.style.display = 'none'; + } + }); + mouseIsDown = true; + e.preventDefault(); + e.stopPropagation(); + }); + + media.addEventListener('volumechange', function (e) { + if (!mouseIsDown) { + toggleMute(); + } + updateVolumeSlider(e); + }); + + var rendered = false; + media.addEventListener('rendererready', function () { + if (!modified) { + setTimeout(function () { + rendered = true; + if (player.options.startVolume === 0 || media.originalNode.muted) { + media.setMuted(true); + } + media.setVolume(player.options.startVolume); + t.setControlsSize(); + }, 250); + } + }); + + media.addEventListener('loadedmetadata', function () { + setTimeout(function () { + if (!modified && !rendered) { + if (player.options.startVolume === 0 || media.originalNode.muted) { + media.setMuted(true); + } + if (player.options.startVolume === 0) { + player.options.startVolume = 0; + } + media.setVolume(player.options.startVolume); + t.setControlsSize(); + } + rendered = false; + }, 250); + }); + + if (player.options.startVolume === 0 || media.originalNode.muted) { + media.setMuted(true); + if (player.options.startVolume === 0) { + player.options.startVolume = 0; + } + toggleMute(); + } + + t.getElement(t.container).addEventListener('controlsresize', function () { + toggleMute(); + }); + } +}); + +},{"17":17,"2":2,"24":24,"25":25,"26":26,"27":27,"6":6}],16:[function(_dereq_,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +var EN = exports.EN = { + 'mejs.plural-form': 1, + + 'mejs.download-file': 'Download File', + + 'mejs.fullscreen': 'Fullscreen', + + 'mejs.play': 'Play', + 'mejs.pause': 'Pause', + + 'mejs.time-slider': 'Time Slider', + 'mejs.time-help-text': 'Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.', + 'mejs.live-broadcast': 'Live Broadcast', + + 'mejs.volume-help-text': 'Use Up/Down Arrow keys to increase or decrease volume.', + 'mejs.unmute': 'Unmute', + 'mejs.mute': 'Mute', + 'mejs.volume-slider': 'Volume Slider', + + 'mejs.video-player': 'Video Player', + 'mejs.audio-player': 'Audio Player', + + 'mejs.captions-subtitles': 'Captions/Subtitles', + 'mejs.captions-chapters': 'Chapters', + 'mejs.none': 'None', + 'mejs.afrikaans': 'Afrikaans', + 'mejs.albanian': 'Albanian', + 'mejs.arabic': 'Arabic', + 'mejs.belarusian': 'Belarusian', + 'mejs.bulgarian': 'Bulgarian', + 'mejs.catalan': 'Catalan', + 'mejs.chinese': 'Chinese', + 'mejs.chinese-simplified': 'Chinese (Simplified)', + 'mejs.chinese-traditional': 'Chinese (Traditional)', + 'mejs.croatian': 'Croatian', + 'mejs.czech': 'Czech', + 'mejs.danish': 'Danish', + 'mejs.dutch': 'Dutch', + 'mejs.english': 'English', + 'mejs.estonian': 'Estonian', + 'mejs.filipino': 'Filipino', + 'mejs.finnish': 'Finnish', + 'mejs.french': 'French', + 'mejs.galician': 'Galician', + 'mejs.german': 'German', + 'mejs.greek': 'Greek', + 'mejs.haitian-creole': 'Haitian Creole', + 'mejs.hebrew': 'Hebrew', + 'mejs.hindi': 'Hindi', + 'mejs.hungarian': 'Hungarian', + 'mejs.icelandic': 'Icelandic', + 'mejs.indonesian': 'Indonesian', + 'mejs.irish': 'Irish', + 'mejs.italian': 'Italian', + 'mejs.japanese': 'Japanese', + 'mejs.korean': 'Korean', + 'mejs.latvian': 'Latvian', + 'mejs.lithuanian': 'Lithuanian', + 'mejs.macedonian': 'Macedonian', + 'mejs.malay': 'Malay', + 'mejs.maltese': 'Maltese', + 'mejs.norwegian': 'Norwegian', + 'mejs.persian': 'Persian', + 'mejs.polish': 'Polish', + 'mejs.portuguese': 'Portuguese', + 'mejs.romanian': 'Romanian', + 'mejs.russian': 'Russian', + 'mejs.serbian': 'Serbian', + 'mejs.slovak': 'Slovak', + 'mejs.slovenian': 'Slovenian', + 'mejs.spanish': 'Spanish', + 'mejs.swahili': 'Swahili', + 'mejs.swedish': 'Swedish', + 'mejs.tagalog': 'Tagalog', + 'mejs.thai': 'Thai', + 'mejs.turkish': 'Turkish', + 'mejs.ukrainian': 'Ukrainian', + 'mejs.vietnamese': 'Vietnamese', + 'mejs.welsh': 'Welsh', + 'mejs.yiddish': 'Yiddish' +}; + +},{}],17:[function(_dereq_,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.config = undefined; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _window = _dereq_(3); + +var _window2 = _interopRequireDefault(_window); + +var _document = _dereq_(2); + +var _document2 = _interopRequireDefault(_document); + +var _mejs = _dereq_(8); + +var _mejs2 = _interopRequireDefault(_mejs); + +var _mediaelement = _dereq_(7); + +var _mediaelement2 = _interopRequireDefault(_mediaelement); + +var _default = _dereq_(18); + +var _default2 = _interopRequireDefault(_default); + +var _i18n = _dereq_(6); + +var _i18n2 = _interopRequireDefault(_i18n); + +var _constants = _dereq_(24); + +var _general = _dereq_(26); + +var _time = _dereq_(30); + +var _media = _dereq_(28); + +var _dom = _dereq_(25); + +var dom = _interopRequireWildcard(_dom); + +var _generate = _dereq_(27); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +_mejs2.default.mepIndex = 0; + +_mejs2.default.players = {}; + +var config = exports.config = { + poster: '', + + showPosterWhenEnded: false, + + showPosterWhenPaused: false, + + defaultVideoWidth: 480, + + defaultVideoHeight: 270, + + videoWidth: -1, + + videoHeight: -1, + + defaultAudioWidth: 400, + + defaultAudioHeight: 40, + + defaultSeekBackwardInterval: function defaultSeekBackwardInterval(media) { + return media.getDuration() * 0.05; + }, + + defaultSeekForwardInterval: function defaultSeekForwardInterval(media) { + return media.getDuration() * 0.05; + }, + + setDimensions: true, + + audioWidth: -1, + + audioHeight: -1, + + loop: false, + + autoRewind: true, + + enableAutosize: true, + + timeFormat: '', + + alwaysShowHours: false, + + showTimecodeFrameCount: false, + + framesPerSecond: 25, + + alwaysShowControls: false, + + hideVideoControlsOnLoad: false, + + hideVideoControlsOnPause: false, + + clickToPlayPause: true, + + controlsTimeoutDefault: 1500, + + controlsTimeoutMouseEnter: 2500, + + controlsTimeoutMouseLeave: 1000, + + iPadUseNativeControls: false, + + iPhoneUseNativeControls: false, + + AndroidUseNativeControls: false, + + features: ['playpause', 'current', 'progress', 'duration', 'tracks', 'volume', 'fullscreen'], + + useDefaultControls: false, + + isVideo: true, + + stretching: 'auto', + + classPrefix: 'mejs__', + + enableKeyboard: true, + + pauseOtherPlayers: true, + + secondsDecimalLength: 0, + + customError: null, + + keyActions: [], + + hideScreenReaderTitle: false +}; + +_mejs2.default.MepDefaults = config; + +var MediaElementPlayer = function () { + function MediaElementPlayer(node, o) { + _classCallCheck(this, MediaElementPlayer); + + var t = this, + element = typeof node === 'string' ? _document2.default.getElementById(node) : node; + + if (!(t instanceof MediaElementPlayer)) { + return new MediaElementPlayer(element, o); + } + + t.node = t.media = element; + + if (!t.node) { + return; + } + + if (t.media.player) { + return t.media.player; + } + + t.hasFocus = false; + + t.controlsAreVisible = true; + + t.controlsEnabled = true; + + t.controlsTimer = null; + + t.currentMediaTime = 0; + + t.proxy = null; + + if (o === undefined) { + var options = t.node.getAttribute('data-mejsoptions'); + o = options ? JSON.parse(options) : {}; + } + + t.options = Object.assign({}, config, o); + + if (t.options.loop && !t.media.getAttribute('loop')) { + t.media.loop = true; + t.node.loop = true; + } else if (t.media.loop) { + t.options.loop = true; + } + + if (!t.options.timeFormat) { + t.options.timeFormat = 'mm:ss'; + if (t.options.alwaysShowHours) { + t.options.timeFormat = 'hh:mm:ss'; + } + if (t.options.showTimecodeFrameCount) { + t.options.timeFormat += ':ff'; + } + } + + (0, _time.calculateTimeFormat)(0, t.options, t.options.framesPerSecond || 25); + + t.id = 'mep_' + _mejs2.default.mepIndex++; + + _mejs2.default.players[t.id] = t; + + t.init(); + + return t; + } + + _createClass(MediaElementPlayer, [{ + key: 'getElement', + value: function getElement(element) { + return element; + } + }, { + key: 'init', + value: function init() { + var t = this, + playerOptions = Object.assign({}, t.options, { + success: function success(media, domNode) { + t._meReady(media, domNode); + }, + error: function error(e) { + t._handleError(e); + } + }), + tagName = t.node.tagName.toLowerCase(); + + t.isDynamic = tagName !== 'audio' && tagName !== 'video' && tagName !== 'iframe'; + t.isVideo = t.isDynamic ? t.options.isVideo : tagName !== 'audio' && t.options.isVideo; + t.mediaFiles = null; + t.trackFiles = null; + + t.media.addEventListener('rendererready', this.updateNode.bind(this)); + + if (_constants.IS_IPAD && t.options.iPadUseNativeControls || _constants.IS_IPHONE && t.options.iPhoneUseNativeControls) { + t.node.setAttribute('controls', true); + + if (_constants.IS_IPAD && t.node.getAttribute('autoplay')) { + t.play(); + } + } else if ((t.isVideo || !t.isVideo && (t.options.features.length || t.options.useDefaultControls)) && !(_constants.IS_ANDROID && t.options.AndroidUseNativeControls)) { + t.node.removeAttribute('controls'); + var videoPlayerTitle = t.isVideo ? _i18n2.default.t('mejs.video-player') : _i18n2.default.t('mejs.audio-player'); + + if (!t.options.hideScreenReaderTitle) { + var offscreen = _document2.default.createElement('span'); + offscreen.className = t.options.classPrefix + 'offscreen'; + offscreen.innerText = videoPlayerTitle; + t.media.parentNode.insertBefore(offscreen, t.media); + } + + t.container = _document2.default.createElement('div'); + t.getElement(t.container).id = t.id; + t.getElement(t.container).className = t.options.classPrefix + 'container ' + t.options.classPrefix + 'container-keyboard-inactive ' + t.media.className; + t.getElement(t.container).tabIndex = 0; + t.getElement(t.container).setAttribute('role', 'application'); + t.getElement(t.container).setAttribute('aria-label', videoPlayerTitle); + t.getElement(t.container).innerHTML = '
    ' + ('
    ') + ('
    ') + ('
    ') + '
    '; + + t.getElement(t.container).addEventListener('focus', function (e) { + if (!t.controlsAreVisible && !t.hasFocus && t.controlsEnabled) { + t.showControls(true); + + var btnSelector = (0, _general.isNodeAfter)(e.relatedTarget, t.getElement(t.container)) ? '.' + t.options.classPrefix + 'controls .' + t.options.classPrefix + 'button:last-child > button' : '.' + t.options.classPrefix + 'playpause-button > button', + button = t.getElement(t.container).querySelector(btnSelector); + + button.focus(); + } + }); + t.node.parentNode.insertBefore(t.getElement(t.container), t.node); + + if (!t.options.features.length && !t.options.useDefaultControls) { + t.getElement(t.container).style.background = 'transparent'; + t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'controls').style.display = 'none'; + } + + if (t.isVideo && t.options.stretching === 'fill' && !dom.hasClass(t.getElement(t.container).parentNode, t.options.classPrefix + 'fill-container')) { + t.outerContainer = t.media.parentNode; + + var wrapper = _document2.default.createElement('div'); + wrapper.className = t.options.classPrefix + 'fill-container'; + t.getElement(t.container).parentNode.insertBefore(wrapper, t.getElement(t.container)); + wrapper.appendChild(t.getElement(t.container)); + } + + if (_constants.IS_ANDROID) { + dom.addClass(t.getElement(t.container), t.options.classPrefix + 'android'); + } + if (_constants.IS_IOS) { + dom.addClass(t.getElement(t.container), t.options.classPrefix + 'ios'); + } + if (_constants.IS_IPAD) { + dom.addClass(t.getElement(t.container), t.options.classPrefix + 'ipad'); + } + if (_constants.IS_IPHONE) { + dom.addClass(t.getElement(t.container), t.options.classPrefix + 'iphone'); + } + dom.addClass(t.getElement(t.container), t.isVideo ? t.options.classPrefix + 'video' : t.options.classPrefix + 'audio'); + + t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'mediaelement').appendChild(t.node); + + t.media.player = t; + + t.controls = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'controls'); + t.layers = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'layers'); + + var tagType = t.isVideo ? 'video' : 'audio', + capsTagName = tagType.substring(0, 1).toUpperCase() + tagType.substring(1); + + if (t.options[tagType + 'Width'] > 0 || t.options[tagType + 'Width'].toString().indexOf('%') > -1) { + t.width = t.options[tagType + 'Width']; + } else if (t.node.style.width !== '' && t.node.style.width !== null) { + t.width = t.node.style.width; + } else if (t.node.getAttribute('width')) { + t.width = t.node.getAttribute('width'); + } else { + t.width = t.options['default' + capsTagName + 'Width']; + } + + if (t.options[tagType + 'Height'] > 0 || t.options[tagType + 'Height'].toString().indexOf('%') > -1) { + t.height = t.options[tagType + 'Height']; + } else if (t.node.style.height !== '' && t.node.style.height !== null) { + t.height = t.node.style.height; + } else if (t.node.getAttribute('height')) { + t.height = t.node.getAttribute('height'); + } else { + t.height = t.options['default' + capsTagName + 'Height']; + } + t.initialAspectRatio = t.height >= t.width ? t.width / t.height : t.height / t.width; + + t.setPlayerSize(t.width, t.height); + } else if (!t.isVideo && !t.options.features.length && !t.options.useDefaultControls) { + t.node.style.display = 'none'; + } + + playerOptions.pluginWidth = t.width; + playerOptions.pluginHeight = t.height; + + _mejs2.default.MepDefaults = playerOptions; + + new _mediaelement2.default(t.media, playerOptions, t.mediaFiles); + + if (t.getElement(t.container) !== undefined && t.options.features.length && t.controlsAreVisible && !t.options.hideVideoControlsOnLoad) { + var event = (0, _general.createEvent)('controlsshown', t.getElement(t.container)); + t.getElement(t.container).dispatchEvent(event); + } + } + }, { + key: 'updateNode', + value: function updateNode(event) { + var node = void 0, + iframeId = void 0; + var mediaElement = event.detail.target.hasOwnProperty('mediaElement') ? event.detail.target.mediaElement : event.detail.target; + var originalNode = mediaElement.originalNode; + + if (event.detail.isIframe) { + iframeId = mediaElement.renderer.id; + node = mediaElement.querySelector('#' + iframeId); + node.style.position = 'absolute'; + + if (originalNode.style.maxWidth) { + node.style.maxWidth = originalNode.style.maxWidth; + } + } else { + node = event.detail.target; + } + this.domNode = node; + this.node = node; + } + }, { + key: 'showControls', + value: function showControls(doAnimation) { + var t = this; + + doAnimation = doAnimation === undefined || doAnimation; + + if (t.controlsAreVisible || !t.isVideo) { + return; + } + + if (doAnimation) { + (function () { + dom.fadeIn(t.getElement(t.controls), 200, function () { + dom.removeClass(t.getElement(t.controls), t.options.classPrefix + 'offscreen'); + var event = (0, _general.createEvent)('controlsshown', t.getElement(t.container)); + t.getElement(t.container).dispatchEvent(event); + }); + + var controls = t.getElement(t.container).querySelectorAll('.' + t.options.classPrefix + 'control'); + + var _loop = function _loop(i, total) { + dom.fadeIn(controls[i], 200, function () { + dom.removeClass(controls[i], t.options.classPrefix + 'offscreen'); + }); + }; + + for (var i = 0, total = controls.length; i < total; i++) { + _loop(i, total); + } + })(); + } else { + dom.removeClass(t.getElement(t.controls), t.options.classPrefix + 'offscreen'); + t.getElement(t.controls).style.display = ''; + t.getElement(t.controls).style.opacity = 1; + + var controls = t.getElement(t.container).querySelectorAll('.' + t.options.classPrefix + 'control'); + for (var i = 0, total = controls.length; i < total; i++) { + dom.removeClass(controls[i], t.options.classPrefix + 'offscreen'); + controls[i].style.display = ''; + } + + var event = (0, _general.createEvent)('controlsshown', t.getElement(t.container)); + t.getElement(t.container).dispatchEvent(event); + } + + t.controlsAreVisible = true; + t.setControlsSize(); + } + }, { + key: 'hideControls', + value: function hideControls(doAnimation, forceHide) { + var t = this; + + doAnimation = doAnimation === undefined || doAnimation; + + if (forceHide !== true && (!t.controlsAreVisible || t.options.alwaysShowControls || t.paused && t.readyState === 4 && (!t.options.hideVideoControlsOnLoad && t.currentTime <= 0 || !t.options.hideVideoControlsOnPause && t.currentTime > 0) || t.isVideo && !t.options.hideVideoControlsOnLoad && !t.readyState || t.ended)) { + return; + } + + if (doAnimation) { + (function () { + dom.fadeOut(t.getElement(t.controls), 200, function () { + dom.addClass(t.getElement(t.controls), t.options.classPrefix + 'offscreen'); + t.getElement(t.controls).style.display = ''; + var event = (0, _general.createEvent)('controlshidden', t.getElement(t.container)); + t.getElement(t.container).dispatchEvent(event); + }); + + var controls = t.getElement(t.container).querySelectorAll('.' + t.options.classPrefix + 'control'); + + var _loop2 = function _loop2(i, total) { + dom.fadeOut(controls[i], 200, function () { + dom.addClass(controls[i], t.options.classPrefix + 'offscreen'); + controls[i].style.display = ''; + }); + }; + + for (var i = 0, total = controls.length; i < total; i++) { + _loop2(i, total); + } + })(); + } else { + dom.addClass(t.getElement(t.controls), t.options.classPrefix + 'offscreen'); + t.getElement(t.controls).style.display = ''; + t.getElement(t.controls).style.opacity = 0; + + var controls = t.getElement(t.container).querySelectorAll('.' + t.options.classPrefix + 'control'); + for (var i = 0, total = controls.length; i < total; i++) { + dom.addClass(controls[i], t.options.classPrefix + 'offscreen'); + controls[i].style.display = ''; + } + + var event = (0, _general.createEvent)('controlshidden', t.getElement(t.container)); + t.getElement(t.container).dispatchEvent(event); + } + + t.controlsAreVisible = false; + } + }, { + key: 'startControlsTimer', + value: function startControlsTimer(timeout) { + var t = this; + + timeout = typeof timeout !== 'undefined' ? timeout : t.options.controlsTimeoutDefault; + + t.killControlsTimer('start'); + + t.controlsTimer = setTimeout(function () { + t.hideControls(); + t.killControlsTimer('hide'); + }, timeout); + } + }, { + key: 'killControlsTimer', + value: function killControlsTimer() { + var t = this; + + if (t.controlsTimer !== null) { + clearTimeout(t.controlsTimer); + delete t.controlsTimer; + t.controlsTimer = null; + } + } + }, { + key: 'disableControls', + value: function disableControls() { + var t = this; + + t.killControlsTimer(); + t.controlsEnabled = false; + t.hideControls(false, true); + } + }, { + key: 'enableControls', + value: function enableControls() { + var t = this; + + t.controlsEnabled = true; + t.showControls(false); + } + }, { + key: '_setDefaultPlayer', + value: function _setDefaultPlayer() { + var t = this; + if (t.proxy) { + t.proxy.pause(); + } + t.proxy = new _default2.default(t); + t.media.addEventListener('loadedmetadata', function () { + if (t.getCurrentTime() > 0 && t.currentMediaTime > 0) { + t.setCurrentTime(t.currentMediaTime); + if (!_constants.IS_IOS && !_constants.IS_ANDROID) { + t.play(); + } + } + }); + } + }, { + key: '_meReady', + value: function _meReady(media, domNode) { + var t = this, + autoplayAttr = domNode.getAttribute('autoplay'), + autoplay = !(autoplayAttr === undefined || autoplayAttr === null || autoplayAttr === 'false'), + isNative = media.rendererName !== null && /(native|html5)/i.test(media.rendererName); + + if (t.getElement(t.controls)) { + t.enableControls(); + } + + if (t.getElement(t.container) && t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'overlay-play')) { + t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'overlay-play').style.display = ''; + } + + if (t.created) { + return; + } + + t.created = true; + t.media = media; + t.domNode = domNode; + + if (!(_constants.IS_ANDROID && t.options.AndroidUseNativeControls) && !(_constants.IS_IPAD && t.options.iPadUseNativeControls) && !(_constants.IS_IPHONE && t.options.iPhoneUseNativeControls)) { + if (!t.isVideo && !t.options.features.length && !t.options.useDefaultControls) { + if (autoplay && isNative) { + t.play(); + } + + if (t.options.success) { + + if (typeof t.options.success === 'string') { + _window2.default[t.options.success](t.media, t.domNode, t); + } else { + t.options.success(t.media, t.domNode, t); + } + } + + return; + } + + t.featurePosition = {}; + + t._setDefaultPlayer(); + + t.buildposter(t, t.getElement(t.controls), t.getElement(t.layers), t.media); + t.buildkeyboard(t, t.getElement(t.controls), t.getElement(t.layers), t.media); + t.buildoverlays(t, t.getElement(t.controls), t.getElement(t.layers), t.media); + + if (t.options.useDefaultControls) { + var defaultControls = ['playpause', 'current', 'progress', 'duration', 'tracks', 'volume', 'fullscreen']; + t.options.features = defaultControls.concat(t.options.features.filter(function (item) { + return defaultControls.indexOf(item) === -1; + })); + } + + t.buildfeatures(t, t.getElement(t.controls), t.getElement(t.layers), t.media); + + var event = (0, _general.createEvent)('controlsready', t.getElement(t.container)); + t.getElement(t.container).dispatchEvent(event); + + t.setPlayerSize(t.width, t.height); + t.setControlsSize(); + + if (t.isVideo) { + t.clickToPlayPauseCallback = function () { + if (t.options.clickToPlayPause) { + var button = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'overlay-button'), + pressed = button.getAttribute('aria-pressed'); + + if (t.paused && pressed) { + t.pause(); + } else if (t.paused) { + t.play(); + } else { + t.pause(); + } + + button.setAttribute('aria-pressed', !pressed); + t.getElement(t.container).focus(); + } + }; + + t.createIframeLayer(); + + t.media.addEventListener('click', t.clickToPlayPauseCallback); + + if ((_constants.IS_ANDROID || _constants.IS_IOS) && !t.options.alwaysShowControls) { + t.node.addEventListener('touchstart', function () { + if (t.controlsAreVisible) { + t.hideControls(false); + } else { + if (t.controlsEnabled) { + t.showControls(false); + } + } + }, _constants.SUPPORT_PASSIVE_EVENT ? { passive: true } : false); + } else { + t.getElement(t.container).addEventListener('mouseenter', function () { + if (t.controlsEnabled) { + if (!t.options.alwaysShowControls) { + t.killControlsTimer('enter'); + t.showControls(); + t.startControlsTimer(t.options.controlsTimeoutMouseEnter); + } + } + }); + t.getElement(t.container).addEventListener('mousemove', function () { + if (t.controlsEnabled) { + if (!t.controlsAreVisible) { + t.showControls(); + } + if (!t.options.alwaysShowControls) { + t.startControlsTimer(t.options.controlsTimeoutMouseEnter); + } + } + }); + t.getElement(t.container).addEventListener('mouseleave', function () { + if (t.controlsEnabled) { + if (!t.paused && !t.options.alwaysShowControls) { + t.startControlsTimer(t.options.controlsTimeoutMouseLeave); + } + } + }); + } + + if (t.options.hideVideoControlsOnLoad) { + t.hideControls(false); + } + + if (t.options.enableAutosize) { + t.media.addEventListener('loadedmetadata', function (e) { + var target = e !== undefined ? e.detail.target || e.target : t.media; + if (t.options.videoHeight <= 0 && !t.domNode.getAttribute('height') && !t.domNode.style.height && target !== null && !isNaN(target.videoHeight)) { + t.setPlayerSize(target.videoWidth, target.videoHeight); + t.setControlsSize(); + t.media.setSize(target.videoWidth, target.videoHeight); + } + }); + } + } + + t.media.addEventListener('play', function () { + t.hasFocus = true; + + for (var playerIndex in _mejs2.default.players) { + if (_mejs2.default.players.hasOwnProperty(playerIndex)) { + var p = _mejs2.default.players[playerIndex]; + + if (p.id !== t.id && t.options.pauseOtherPlayers && !p.paused && !p.ended && p.options.ignorePauseOtherPlayersOption !== true) { + p.pause(); + p.hasFocus = false; + } + } + } + + if (!(_constants.IS_ANDROID || _constants.IS_IOS) && !t.options.alwaysShowControls && t.isVideo) { + t.hideControls(); + } + }); + + t.media.addEventListener('ended', function () { + if (t.options.autoRewind) { + try { + t.setCurrentTime(0); + + setTimeout(function () { + var loadingElement = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'overlay-loading'); + if (loadingElement && loadingElement.parentNode) { + loadingElement.parentNode.style.display = 'none'; + } + }, 20); + } catch (exp) { + + } + } + + t.pause(); + + if (t.setProgressRail) { + t.setProgressRail(); + } + if (t.setCurrentRail) { + t.setCurrentRail(); + } + + if (t.options.loop) { + t.play(); + } else if (!t.options.alwaysShowControls && t.controlsEnabled) { + t.showControls(); + } + }); + + t.media.addEventListener('loadedmetadata', function () { + + (0, _time.calculateTimeFormat)(t.getDuration(), t.options, t.options.framesPerSecond || 25); + + if (t.updateDuration) { + t.updateDuration(); + } + if (t.updateCurrent) { + t.updateCurrent(); + } + + if (!t.isFullScreen) { + t.setPlayerSize(t.width, t.height); + t.setControlsSize(); + } + }); + + var duration = null; + t.media.addEventListener('timeupdate', function () { + if (!isNaN(t.getDuration()) && duration !== t.getDuration()) { + duration = t.getDuration(); + (0, _time.calculateTimeFormat)(duration, t.options, t.options.framesPerSecond || 25); + + if (t.updateDuration) { + t.updateDuration(); + } + if (t.updateCurrent) { + t.updateCurrent(); + } + + t.setControlsSize(); + } + }); + + t.getElement(t.container).addEventListener('click', function (e) { + dom.addClass(e.currentTarget, t.options.classPrefix + 'container-keyboard-inactive'); + }); + + t.getElement(t.container).addEventListener('focusin', function (e) { + dom.removeClass(e.currentTarget, t.options.classPrefix + 'container-keyboard-inactive'); + if (t.isVideo && !_constants.IS_ANDROID && !_constants.IS_IOS && t.controlsEnabled && !t.options.alwaysShowControls) { + t.killControlsTimer('enter'); + t.showControls(); + t.startControlsTimer(t.options.controlsTimeoutMouseEnter); + } + }); + + t.getElement(t.container).addEventListener('focusout', function (e) { + setTimeout(function () { + if (e.relatedTarget) { + if (t.keyboardAction && !e.relatedTarget.closest('.' + t.options.classPrefix + 'container')) { + t.keyboardAction = false; + if (t.isVideo && !t.options.alwaysShowControls && !t.paused) { + t.startControlsTimer(t.options.controlsTimeoutMouseLeave); + } + } + } + }, 0); + }); + + setTimeout(function () { + t.setPlayerSize(t.width, t.height); + t.setControlsSize(); + }, 0); + + t.globalResizeCallback = function () { + if (!(t.isFullScreen || _constants.HAS_TRUE_NATIVE_FULLSCREEN && _document2.default.webkitIsFullScreen)) { + t.setPlayerSize(t.width, t.height); + } + + t.setControlsSize(); + }; + + t.globalBind('resize', t.globalResizeCallback); + } + + if (autoplay && isNative) { + t.play(); + } + + if (t.options.success) { + if (typeof t.options.success === 'string') { + _window2.default[t.options.success](t.media, t.domNode, t); + } else { + t.options.success(t.media, t.domNode, t); + } + } + } + }, { + key: '_handleError', + value: function _handleError(e, media, node) { + var t = this, + play = t.getElement(t.layers).querySelector('.' + t.options.classPrefix + 'overlay-play'); + + if (play) { + play.style.display = 'none'; + } + + if (t.options.error) { + t.options.error(e, media, node); + } + + if (t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'cannotplay')) { + t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'cannotplay').remove(); + } + + var errorContainer = _document2.default.createElement('div'); + errorContainer.className = t.options.classPrefix + 'cannotplay'; + errorContainer.style.width = '100%'; + errorContainer.style.height = '100%'; + + var errorContent = typeof t.options.customError === 'function' ? t.options.customError(t.media, t.media.originalNode) : t.options.customError, + imgError = ''; + + if (!errorContent) { + var poster = t.media.originalNode.getAttribute('poster'); + if (poster) { + imgError = '' + _mejs2.default.i18n.t('mejs.download-file') + ''; + } + + if (e.message) { + errorContent = '

    ' + e.message + '

    '; + } + + if (e.urls) { + for (var i = 0, total = e.urls.length; i < total; i++) { + var url = e.urls[i]; + errorContent += '' + _mejs2.default.i18n.t('mejs.download-file') + ': ' + url.src + ''; + } + } + } + + if (errorContent && t.getElement(t.layers).querySelector('.' + t.options.classPrefix + 'overlay-error')) { + errorContainer.innerHTML = errorContent; + t.getElement(t.layers).querySelector('.' + t.options.classPrefix + 'overlay-error').innerHTML = '' + imgError + errorContainer.outerHTML; + t.getElement(t.layers).querySelector('.' + t.options.classPrefix + 'overlay-error').parentNode.style.display = 'block'; + } + + if (t.controlsEnabled) { + t.disableControls(); + } + } + }, { + key: 'setPlayerSize', + value: function setPlayerSize(width, height) { + var t = this; + + if (!t.options.setDimensions) { + return false; + } + + if (typeof width !== 'undefined') { + t.width = width; + } + + if (typeof height !== 'undefined') { + t.height = height; + } + + switch (t.options.stretching) { + case 'fill': + if (t.isVideo) { + t.setFillMode(); + } else { + t.setDimensions(t.width, t.height); + } + break; + case 'responsive': + t.setResponsiveMode(); + break; + case 'none': + t.setDimensions(t.width, t.height); + break; + + default: + if (t.hasFluidMode() === true) { + t.setResponsiveMode(); + } else { + t.setDimensions(t.width, t.height); + } + break; + } + } + }, { + key: 'hasFluidMode', + value: function hasFluidMode() { + var t = this; + + return t.height.toString().indexOf('%') !== -1 || t.node && t.node.style.maxWidth && t.node.style.maxWidth !== 'none' && t.node.style.maxWidth !== t.width || t.node && t.node.currentStyle && t.node.currentStyle.maxWidth === '100%'; + } + }, { + key: 'setResponsiveMode', + value: function setResponsiveMode() { + var t = this, + parent = function () { + var parentEl = void 0, + el = t.getElement(t.container); + + while (el) { + try { + if (_constants.IS_FIREFOX && el.tagName.toLowerCase() === 'html' && _window2.default.self !== _window2.default.top && _window2.default.frameElement !== null) { + return _window2.default.frameElement; + } else { + parentEl = el.parentElement; + } + } catch (e) { + parentEl = el.parentElement; + } + + if (parentEl && dom.visible(parentEl)) { + return parentEl; + } + el = parentEl; + } + return null; + }(), + parentStyles = parent ? getComputedStyle(parent, null) : getComputedStyle(_document2.default.body, null), + nativeWidth = function () { + if (t.isVideo) { + if (t.node.videoWidth && t.node.videoWidth > 0) { + return t.node.videoWidth; + } else if (t.node.getAttribute('width')) { + return t.node.getAttribute('width'); + } else { + return t.options.defaultVideoWidth; + } + } else { + return t.options.defaultAudioWidth; + } + }(), + nativeHeight = function () { + if (t.isVideo) { + if (t.node.videoHeight && t.node.videoHeight > 0) { + return t.node.videoHeight; + } else if (t.node.getAttribute('height')) { + return t.node.getAttribute('height'); + } else { + return t.options.defaultVideoHeight; + } + } else { + return t.options.defaultAudioHeight; + } + }(), + aspectRatio = function () { + if (!t.options.enableAutosize) { + return t.initialAspectRatio; + } + var ratio = 1; + if (!t.isVideo) { + return ratio; + } + + if (t.node.videoWidth && t.node.videoWidth > 0 && t.node.videoHeight && t.node.videoHeight > 0) { + ratio = t.height >= t.width ? t.node.videoWidth / t.node.videoHeight : t.node.videoHeight / t.node.videoWidth; + } else { + ratio = t.initialAspectRatio; + } + + if (isNaN(ratio) || ratio < 0.01 || ratio > 100) { + ratio = 1; + } + return ratio; + }(), + parentHeight = parseFloat(parentStyles.height); + + var newHeight = void 0, + parentWidth = parseFloat(parentStyles.width); + + if (t.isVideo) { + if (t.height === '100%' && t.width === '100%') { + newHeight = parentHeight; + } else if (t.height === '100%') { + newHeight = parseFloat(parentWidth * nativeHeight / nativeWidth, 10); + } else { + newHeight = t.height >= t.width ? parseFloat(parentWidth / aspectRatio, 10) : parseFloat(parentWidth * aspectRatio, 10); + } + } else { + newHeight = nativeHeight; + } + + if (newHeight <= t.container.querySelector('.' + t.options.classPrefix + 'inner').offsetHeight) { + newHeight = t.container.querySelector('.' + t.options.classPrefix + 'inner').offsetHeight; + } + + if (isNaN(newHeight)) { + newHeight = parentHeight; + } + + if (t.getElement(t.container).parentNode.length > 0 && t.getElement(t.container).parentNode.tagName.toLowerCase() === 'body') { + parentWidth = _window2.default.innerWidth || _document2.default.documentElement.clientWidth || _document2.default.body.clientWidth; + newHeight = _window2.default.innerHeight || _document2.default.documentElement.clientHeight || _document2.default.body.clientHeight; + } + + if (newHeight && parentWidth) { + t.getElement(t.container).style.width = parentWidth + 'px'; + t.getElement(t.container).style.height = newHeight + 'px'; + + t.node.style.width = '100%'; + t.node.style.height = '100%'; + + if (t.isVideo && t.media.setSize) { + t.media.setSize(parentWidth, newHeight); + } + + if (newHeight <= t.container.querySelector('.' + t.options.classPrefix + 'inner').offsetHeight) { + t.node.style.width = 'auto'; + t.node.style.height = 'auto'; + } + + var layerChildren = t.getElement(t.layers).children; + for (var i = 0, total = layerChildren.length; i < total; i++) { + layerChildren[i].style.width = '100%'; + layerChildren[i].style.height = '100%'; + } + } + } + }, { + key: 'setFillMode', + value: function setFillMode() { + var t = this; + var isIframe = _window2.default.self !== _window2.default.top && _window2.default.frameElement !== null; + var parent = function () { + var parentEl = void 0, + el = t.getElement(t.container); + + while (el) { + try { + if (_constants.IS_FIREFOX && el.tagName.toLowerCase() === 'html' && _window2.default.self !== _window2.default.top && _window2.default.frameElement !== null) { + return _window2.default.frameElement; + } else { + parentEl = el.parentElement; + } + } catch (e) { + parentEl = el.parentElement; + } + + if (parentEl && dom.visible(parentEl)) { + return parentEl; + } + el = parentEl; + } + + return null; + }(); + var parentStyles = parent ? getComputedStyle(parent, null) : getComputedStyle(_document2.default.body, null); + + if (t.node.style.height !== 'none' && t.node.style.height !== t.height) { + t.node.style.height = 'auto'; + } + if (t.node.style.maxWidth !== 'none' && t.node.style.maxWidth !== t.width) { + t.node.style.maxWidth = 'none'; + } + + if (t.node.style.maxHeight !== 'none' && t.node.style.maxHeight !== t.height) { + t.node.style.maxHeight = 'none'; + } + + if (t.node.currentStyle) { + if (t.node.currentStyle.height === '100%') { + t.node.currentStyle.height = 'auto'; + } + if (t.node.currentStyle.maxWidth === '100%') { + t.node.currentStyle.maxWidth = 'none'; + } + if (t.node.currentStyle.maxHeight === '100%') { + t.node.currentStyle.maxHeight = 'none'; + } + } + + if (!isIframe && !parseFloat(parentStyles.width)) { + parent.style.width = t.media.offsetWidth + 'px'; + } + + if (!isIframe && !parseFloat(parentStyles.height)) { + parent.style.height = t.media.offsetHeight + 'px'; + } + + parentStyles = getComputedStyle(parent); + + var parentWidth = parseFloat(parentStyles.width), + parentHeight = parseFloat(parentStyles.height); + t.setDimensions('100%', '100%'); + + var poster = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'poster>img'); + if (poster) { + poster.style.display = ''; + } + + var targetElement = t.getElement(t.container).querySelectorAll('object, embed, iframe, video'), + initHeight = parseFloat(t.height, 10), + initWidth = parseFloat(t.width, 10), + scaleX1 = parentWidth, + scaleY1 = initHeight * parentWidth / initWidth, + scaleX2 = initWidth * parentHeight / initHeight, + scaleY2 = parentHeight, + bScaleOnWidth = scaleX2 > parentWidth === false, + finalWidth = bScaleOnWidth ? Math.floor(scaleX1) : Math.floor(scaleX2), + finalHeight = bScaleOnWidth ? Math.floor(scaleY1) : Math.floor(scaleY2), + width = bScaleOnWidth ? parentWidth + 'px' : finalWidth + 'px', + height = bScaleOnWidth ? finalHeight + 'px' : parentHeight + 'px'; + + for (var i = 0, total = targetElement.length; i < total; i++) { + targetElement[i].style.height = height; + targetElement[i].style.width = width; + if (t.media.setSize) { + t.media.setSize(width, height); + } + + targetElement[i].style.marginLeft = Math.floor((parentWidth - finalWidth) / 2) + 'px'; + targetElement[i].style.marginTop = 0; + } + } + }, { + key: 'setDimensions', + value: function setDimensions(width, height) { + var t = this; + + width = (0, _general.isString)(width) && width.indexOf('%') > -1 ? width : parseFloat(width) + 'px'; + height = (0, _general.isString)(height) && height.indexOf('%') > -1 ? height : parseFloat(height) + 'px'; + + t.getElement(t.container).style.width = width; + t.getElement(t.container).style.height = height; + + var layers = t.getElement(t.layers).children; + for (var i = 0, total = layers.length; i < total; i++) { + layers[i].style.width = width; + layers[i].style.height = height; + } + } + }, { + key: 'setControlsSize', + value: function setControlsSize() { + var t = this; + + if (!dom.visible(t.getElement(t.container))) { + return; + } + + if (!(t.rail && dom.visible(t.rail))) { + var children = t.getElement(t.controls).children; + var minWidth = 0; + + for (var i = 0, total = children.length; i < total; i++) { + minWidth += children[i].offsetWidth; + } + + t.getElement(t.container).style.minWidth = minWidth + 'px'; + } + } + }, { + key: 'addControlElement', + value: function addControlElement(element, key) { + var t = this; + + if (t.featurePosition[key] !== undefined) { + var child = t.getElement(t.controls).children[t.featurePosition[key] - 1]; + child.parentNode.insertBefore(element, child.nextSibling); + } else { + t.getElement(t.controls).appendChild(element); + var children = t.getElement(t.controls).children; + for (var i = 0, total = children.length; i < total; i++) { + if (element === children[i]) { + t.featurePosition[key] = i; + break; + } + } + } + } + }, { + key: 'createIframeLayer', + value: function createIframeLayer() { + var t = this; + + if (t.isVideo && t.media.rendererName !== null && t.media.rendererName.indexOf('iframe') > -1 && !_document2.default.getElementById(t.media.id + '-iframe-overlay')) { + + var layer = _document2.default.createElement('div'), + target = _document2.default.getElementById(t.media.id + '_' + t.media.rendererName); + + layer.id = t.media.id + '-iframe-overlay'; + layer.className = t.options.classPrefix + 'iframe-overlay'; + layer.addEventListener('click', function (e) { + if (t.options.clickToPlayPause) { + if (t.paused) { + t.play(); + } else { + t.pause(); + } + + e.preventDefault(); + e.stopPropagation(); + } + }); + + target.parentNode.insertBefore(layer, target); + } + } + }, { + key: 'resetSize', + value: function resetSize() { + var t = this; + + setTimeout(function () { + t.setPlayerSize(t.width, t.height); + t.setControlsSize(); + }, 50); + } + }, { + key: 'setPoster', + value: function setPoster(url) { + var t = this; + + if (t.getElement(t.container)) { + var posterDiv = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'poster'); + + if (!posterDiv) { + posterDiv = _document2.default.createElement('div'); + posterDiv.className = t.options.classPrefix + 'poster ' + t.options.classPrefix + 'layer'; + t.getElement(t.layers).appendChild(posterDiv); + } + + var posterImg = posterDiv.querySelector('img'); + + if (!posterImg && url) { + posterImg = _document2.default.createElement('img'); + posterImg.alt = ''; + posterImg.className = t.options.classPrefix + 'poster-img'; + posterImg.width = '100%'; + posterImg.height = '100%'; + posterDiv.style.display = ''; + posterDiv.appendChild(posterImg); + } + + if (url) { + posterImg.setAttribute('src', url); + posterDiv.style.backgroundImage = 'url("' + url + '")'; + posterDiv.style.display = ''; + } else if (posterImg) { + posterDiv.style.backgroundImage = 'none'; + posterDiv.style.display = 'none'; + posterImg.remove(); + } else { + posterDiv.style.display = 'none'; + } + } else if (_constants.IS_IPAD && t.options.iPadUseNativeControls || _constants.IS_IPHONE && t.options.iPhoneUseNativeControls || _constants.IS_ANDROID && t.options.AndroidUseNativeControls) { + t.media.originalNode.poster = url; + } + } + }, { + key: 'changeSkin', + value: function changeSkin(className) { + var t = this; + + t.getElement(t.container).className = t.options.classPrefix + 'container ' + className; + t.setPlayerSize(t.width, t.height); + t.setControlsSize(); + } + }, { + key: 'globalBind', + value: function globalBind(events, callback) { + var t = this, + doc = t.node ? t.node.ownerDocument : _document2.default; + + events = (0, _general.splitEvents)(events, t.id); + if (events.d) { + var eventList = events.d.split(' '); + for (var i = 0, total = eventList.length; i < total; i++) { + eventList[i].split('.').reduce(function (part, e) { + doc.addEventListener(e, callback, false); + return e; + }, ''); + } + } + if (events.w) { + var _eventList = events.w.split(' '); + for (var _i = 0, _total = _eventList.length; _i < _total; _i++) { + _eventList[_i].split('.').reduce(function (part, e) { + _window2.default.addEventListener(e, callback, false); + return e; + }, ''); + } + } + } + }, { + key: 'globalUnbind', + value: function globalUnbind(events, callback) { + var t = this, + doc = t.node ? t.node.ownerDocument : _document2.default; + + events = (0, _general.splitEvents)(events, t.id); + if (events.d) { + var eventList = events.d.split(' '); + for (var i = 0, total = eventList.length; i < total; i++) { + eventList[i].split('.').reduce(function (part, e) { + doc.removeEventListener(e, callback, false); + return e; + }, ''); + } + } + if (events.w) { + var _eventList2 = events.w.split(' '); + for (var _i2 = 0, _total2 = _eventList2.length; _i2 < _total2; _i2++) { + _eventList2[_i2].split('.').reduce(function (part, e) { + _window2.default.removeEventListener(e, callback, false); + return e; + }, ''); + } + } + } + }, { + key: 'buildfeatures', + value: function buildfeatures(player, controls, layers, media) { + var t = this; + + for (var i = 0, total = t.options.features.length; i < total; i++) { + var feature = t.options.features[i]; + if (t['build' + feature]) { + try { + t['build' + feature](player, controls, layers, media); + } catch (e) { + console.error('error building ' + feature, e); + } + } + } + } + }, { + key: 'buildposter', + value: function buildposter(player, controls, layers, media) { + var t = this, + poster = _document2.default.createElement('div'); + + poster.className = t.options.classPrefix + 'poster ' + t.options.classPrefix + 'layer'; + layers.appendChild(poster); + + var posterUrl = media.originalNode.getAttribute('poster'); + + if (player.options.poster !== '') { + if (posterUrl && _constants.IS_IOS) { + media.originalNode.removeAttribute('poster'); + } + posterUrl = player.options.poster; + } + + if (posterUrl) { + t.setPoster(posterUrl); + } else if (t.media.renderer !== null && typeof t.media.renderer.getPosterUrl === 'function') { + t.setPoster(t.media.renderer.getPosterUrl()); + } else { + poster.style.display = 'none'; + } + + media.addEventListener('play', function () { + poster.style.display = 'none'; + }); + + media.addEventListener('playing', function () { + poster.style.display = 'none'; + }); + + if (player.options.showPosterWhenEnded && player.options.autoRewind) { + media.addEventListener('ended', function () { + poster.style.display = ''; + }); + } + + media.addEventListener('error', function () { + poster.style.display = 'none'; + }); + + if (player.options.showPosterWhenPaused) { + media.addEventListener('pause', function () { + if (!player.ended) { + poster.style.display = ''; + } + }); + } + } + }, { + key: 'buildoverlays', + value: function buildoverlays(player, controls, layers, media) { + if (!player.isVideo) { + return; + } + + var t = this, + loading = _document2.default.createElement('div'), + error = _document2.default.createElement('div'), + bigPlay = _document2.default.createElement('div'); + + loading.style.display = 'none'; + loading.className = t.options.classPrefix + 'overlay ' + t.options.classPrefix + 'layer'; + loading.innerHTML = '
    ' + ('
    \n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
    ') + '
    '; + layers.appendChild(loading); + + error.style.display = 'none'; + error.className = t.options.classPrefix + 'overlay ' + t.options.classPrefix + 'layer'; + error.innerHTML = '
    '; + layers.appendChild(error); + + bigPlay.className = t.options.classPrefix + 'overlay ' + t.options.classPrefix + 'layer ' + t.options.classPrefix + 'overlay-play'; + bigPlay.innerHTML = (0, _generate.generateControlButton)(t.id, _i18n2.default.t('mejs.play'), _i18n2.default.t('mejs.play'), '' + t.media.options.iconSprite, ['icon-overlay-play'], '' + t.options.classPrefix, t.options.classPrefix + 'overlay-button', '', false); + + bigPlay.addEventListener('click', function () { + if (t.options.clickToPlayPause) { + + var button = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'overlay-button'), + pressed = button.getAttribute('aria-pressed'); + + if (t.paused) { + t.play(); + } else { + t.pause(); + } + + button.setAttribute('aria-pressed', !!pressed); + t.getElement(t.container).focus(); + } + }); + + bigPlay.addEventListener('keydown', function (e) { + var keyPressed = e.keyCode || e.which || 0; + + if (keyPressed === 13 || _constants.IS_FIREFOX && keyPressed === 32) { + var event = (0, _general.createEvent)('click', bigPlay); + bigPlay.dispatchEvent(event); + return false; + } + }); + + layers.appendChild(bigPlay); + + if (t.media.rendererName !== null && (/(youtube|facebook)/i.test(t.media.rendererName) && !(t.media.originalNode.getAttribute('poster') || player.options.poster || typeof t.media.renderer.getPosterUrl === 'function' && t.media.renderer.getPosterUrl()) || _constants.IS_STOCK_ANDROID || t.media.originalNode.getAttribute('autoplay'))) { + bigPlay.style.display = 'none'; + } + + var hasError = false; + + media.addEventListener('play', function () { + bigPlay.style.display = 'none'; + loading.style.display = 'none'; + error.style.display = 'none'; + hasError = false; + }); + media.addEventListener('playing', function () { + bigPlay.style.display = 'none'; + loading.style.display = 'none'; + error.style.display = 'none'; + hasError = false; + }); + media.addEventListener('seeking', function () { + bigPlay.style.display = 'none'; + loading.style.display = ''; + hasError = false; + }); + media.addEventListener('seeked', function () { + bigPlay.style.display = t.paused && !_constants.IS_STOCK_ANDROID ? '' : 'none'; + loading.style.display = 'none'; + hasError = false; + }); + media.addEventListener('pause', function () { + loading.style.display = 'none'; + if (!_constants.IS_STOCK_ANDROID && !hasError) { + bigPlay.style.display = ''; + } + hasError = false; + }); + media.addEventListener('waiting', function () { + loading.style.display = ''; + hasError = false; + }); + + media.addEventListener('loadeddata', function () { + loading.style.display = ''; + + if (_constants.IS_ANDROID) { + media.canplayTimeout = setTimeout(function () { + if (_document2.default.createEvent) { + var evt = _document2.default.createEvent('HTMLEvents'); + evt.initEvent('canplay', true, true); + return media.dispatchEvent(evt); + } + }, 300); + } + hasError = false; + }); + media.addEventListener('canplay', function () { + loading.style.display = 'none'; + + clearTimeout(media.canplayTimeout); + hasError = false; + }); + + media.addEventListener('error', function (e) { + t._handleError(e, t.media, t.node); + loading.style.display = 'none'; + bigPlay.style.display = 'none'; + hasError = true; + }); + + media.addEventListener('loadedmetadata', function () { + if (!t.controlsEnabled) { + t.enableControls(); + } + }); + + media.addEventListener('keydown', function (e) { + t.onkeydown(player, media, e); + hasError = false; + }); + } + }, { + key: 'buildkeyboard', + value: function buildkeyboard(player, controls, layers, media) { + var t = this; + + t.getElement(t.container).addEventListener('keydown', function () { + t.keyboardAction = true; + }); + + t.globalKeydownCallback = function (event) { + if (!_document2.default.activeElement) { + return true; + } + + var container = _document2.default.activeElement.closest('.' + t.options.classPrefix + 'container'), + target = t.media.closest('.' + t.options.classPrefix + 'container'); + t.hasFocus = !!(container && target && container.id === target.id); + return t.onkeydown(player, media, event); + }; + + t.globalClickCallback = function (event) { + t.hasFocus = !!event.target.closest('.' + t.options.classPrefix + 'container'); + }; + + t.globalBind('keydown', t.globalKeydownCallback); + + t.globalBind('click', t.globalClickCallback); + } + }, { + key: 'onkeydown', + value: function onkeydown(player, media, e) { + if (player.hasFocus && player.options.enableKeyboard) { + for (var i = 0, total = player.options.keyActions.length; i < total; i++) { + var keyAction = player.options.keyActions[i]; + + for (var j = 0, jl = keyAction.keys.length; j < jl; j++) { + if (e.keyCode === keyAction.keys[j]) { + keyAction.action(player, media, e.keyCode, e); + e.preventDefault(); + e.stopPropagation(); + return; + } + } + } + } + + return true; + } + }, { + key: 'play', + value: function play() { + return this.proxy.play(); + } + }, { + key: 'pause', + value: function pause() { + return this.proxy.pause(); + } + }, { + key: 'load', + value: function load() { + return this.proxy.load(); + } + }, { + key: 'setCurrentTime', + value: function setCurrentTime(time) { + var userInteraction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + + this.seekUserInteraction = userInteraction; + this.proxy.setCurrentTime(time); + } + }, { + key: 'getCurrentTime', + value: function getCurrentTime() { + return this.proxy.currentTime; + } + }, { + key: 'getDuration', + value: function getDuration() { + return this.proxy.duration; + } + }, { + key: 'setVolume', + value: function setVolume(volume) { + this.proxy.volume = volume; + } + }, { + key: 'getVolume', + value: function getVolume() { + return this.proxy.getVolume(); + } + }, { + key: 'setMuted', + value: function setMuted(value) { + this.proxy.setMuted(value); + } + }, { + key: 'setSrc', + value: function setSrc(src) { + if (!this.controlsEnabled) { + this.enableControls(); + } + this.proxy.setSrc(src); + } + }, { + key: 'getSrc', + value: function getSrc() { + return this.proxy.getSrc(); + } + }, { + key: 'canPlayType', + value: function canPlayType(type) { + return this.proxy.canPlayType(type); + } + }, { + key: 'remove', + value: function remove() { + var t = this, + rendererName = t.media.rendererName, + src = t.media.originalNode.src; + + for (var featureIndex in t.options.features) { + var feature = t.options.features[featureIndex]; + if (t['clean' + feature]) { + try { + t['clean' + feature](t, t.getElement(t.layers), t.getElement(t.controls), t.media); + } catch (e) { + console.error('error cleaning ' + feature, e); + } + } + } + + var nativeWidth = t.node.getAttribute('width'), + nativeHeight = t.node.getAttribute('height'); + + if (nativeWidth) { + if (nativeWidth.indexOf('%') === -1) { + nativeWidth = nativeWidth + 'px'; + } + } else { + nativeWidth = 'auto'; + } + + if (nativeHeight) { + if (nativeHeight.indexOf('%') === -1) { + nativeHeight = nativeHeight + 'px'; + } + } else { + nativeHeight = 'auto'; + } + + t.node.style.width = nativeWidth; + t.node.style.height = nativeHeight; + + t.setPlayerSize(0, 0); + + if (!t.isDynamic) { + (function () { + t.node.setAttribute('controls', true); + t.node.setAttribute('id', t.node.getAttribute('id').replace('_' + rendererName, '').replace('_from_mejs', '')); + var poster = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'poster>img'); + if (poster) { + t.node.setAttribute('poster', poster.src); + } + + delete t.node.autoplay; + + t.node.setAttribute('src', ''); + if (t.media.canPlayType((0, _media.getTypeFromFile)(src)) !== '') { + t.node.setAttribute('src', src); + } + + if (rendererName && rendererName.indexOf('iframe') > -1) { + var layer = _document2.default.getElementById(t.media.id + '-iframe-overlay'); + layer.remove(); + } + + var node = t.node.cloneNode(); + node.style.display = ''; + t.getElement(t.container).parentNode.insertBefore(node, t.getElement(t.container)); + t.node.remove(); + + if (t.mediaFiles) { + for (var i = 0, total = t.mediaFiles.length; i < total; i++) { + var source = _document2.default.createElement('source'); + source.setAttribute('src', t.mediaFiles[i].src); + source.setAttribute('type', t.mediaFiles[i].type); + node.appendChild(source); + } + } + if (t.trackFiles) { + var _loop3 = function _loop3(_i3, _total3) { + var track = t.trackFiles[_i3]; + var newTrack = _document2.default.createElement('track'); + newTrack.kind = track.kind; + newTrack.label = track.label; + newTrack.srclang = track.srclang; + newTrack.src = track.src; + + node.appendChild(newTrack); + newTrack.addEventListener('load', function () { + this.mode = 'showing'; + node.textTracks[_i3].mode = 'showing'; + }); + }; + + for (var _i3 = 0, _total3 = t.trackFiles.length; _i3 < _total3; _i3++) { + _loop3(_i3, _total3); + } + } + + delete t.node; + delete t.mediaFiles; + delete t.trackFiles; + })(); + } else { + t.getElement(t.container).parentNode.insertBefore(t.node, t.getElement(t.container)); + } + + if (t.media.renderer && typeof t.media.renderer.destroy === 'function') { + t.media.renderer.destroy(); + } + + if (_typeof(t.getElement(t.container)) === 'object') { + var offscreen = t.getElement(t.container).parentNode.querySelector('.' + t.options.classPrefix + 'offscreen'); + if (offscreen) { + offscreen.remove(); + } + t.getElement(t.container).remove(); + } + t.globalUnbind('resize', t.globalResizeCallback); + t.globalUnbind('keydown', t.globalKeydownCallback); + t.globalUnbind('click', t.globalClickCallback); + + delete t.media.player; + } + }, { + key: 'paused', + get: function get() { + return this.proxy.paused; + } + }, { + key: 'muted', + get: function get() { + return this.proxy.muted; + }, + set: function set(muted) { + this.setMuted(muted); + } + }, { + key: 'ended', + get: function get() { + return this.proxy.ended; + } + }, { + key: 'readyState', + get: function get() { + return this.proxy.readyState; + } + }, { + key: 'currentTime', + set: function set(time) { + this.setCurrentTime(time); + }, + get: function get() { + return this.getCurrentTime(); + } + }, { + key: 'duration', + get: function get() { + return this.getDuration(); + } + }, { + key: 'volume', + set: function set(volume) { + this.setVolume(volume); + }, + get: function get() { + return this.getVolume(); + } + }, { + key: 'src', + set: function set(src) { + this.setSrc(src); + }, + get: function get() { + return this.getSrc(); + } + }]); + + return MediaElementPlayer; +}(); + +_window2.default.MediaElementPlayer = MediaElementPlayer; +_mejs2.default.MediaElementPlayer = MediaElementPlayer; + +exports.default = MediaElementPlayer; + +},{"18":18,"2":2,"24":24,"25":25,"26":26,"27":27,"28":28,"3":3,"30":30,"6":6,"7":7,"8":8}],18:[function(_dereq_,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + +var _window = _dereq_(3); + +var _window2 = _interopRequireDefault(_window); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var DefaultPlayer = function () { + function DefaultPlayer(player) { + _classCallCheck(this, DefaultPlayer); + + this.media = player.media; + this.isVideo = player.isVideo; + this.classPrefix = player.options.classPrefix; + this.createIframeLayer = function () { + return player.createIframeLayer(); + }; + this.setPoster = function (url) { + return player.setPoster(url); + }; + return this; + } + + _createClass(DefaultPlayer, [{ + key: 'play', + value: function play() { + return this.media.play(); + } + }, { + key: 'pause', + value: function pause() { + return this.media.pause(); + } + }, { + key: 'load', + value: function load() { + var t = this; + + if (!t.isLoaded) { + t.media.load(); + } + + t.isLoaded = true; + } + }, { + key: 'setCurrentTime', + value: function setCurrentTime(time) { + this.media.setCurrentTime(time); + } + }, { + key: 'getCurrentTime', + value: function getCurrentTime() { + return this.media.currentTime; + } + }, { + key: 'getDuration', + value: function getDuration() { + var duration = this.media.getDuration(); + if (duration === Infinity && this.media.seekable && this.media.seekable.length) { + duration = this.media.seekable.end(0); + } + return duration; + } + }, { + key: 'setVolume', + value: function setVolume(volume) { + this.media.setVolume(volume); + } + }, { + key: 'getVolume', + value: function getVolume() { + return this.media.getVolume(); + } + }, { + key: 'setMuted', + value: function setMuted(value) { + this.media.setMuted(value); + } + }, { + key: 'setSrc', + value: function setSrc(src) { + var t = this, + layer = document.getElementById(t.media.id + '-iframe-overlay'); + + if (layer) { + layer.remove(); + } + + t.media.setSrc(src); + t.createIframeLayer(); + if (t.media.renderer !== null && typeof t.media.renderer.getPosterUrl === 'function') { + t.setPoster(t.media.renderer.getPosterUrl()); + } + } + }, { + key: 'getSrc', + value: function getSrc() { + return this.media.getSrc(); + } + }, { + key: 'canPlayType', + value: function canPlayType(type) { + return this.media.canPlayType(type); + } + }, { + key: 'paused', + get: function get() { + return this.media.paused; + } + }, { + key: 'muted', + set: function set(muted) { + this.setMuted(muted); + }, + get: function get() { + return this.media.muted; + } + }, { + key: 'ended', + get: function get() { + return this.media.ended; + } + }, { + key: 'readyState', + get: function get() { + return this.media.readyState; + } + }, { + key: 'currentTime', + set: function set(time) { + this.setCurrentTime(time); + }, + get: function get() { + return this.getCurrentTime(); + } + }, { + key: 'duration', + get: function get() { + return this.getDuration(); + } + }, { + key: 'remainingTime', + get: function get() { + return this.getDuration() - this.currentTime(); + } + }, { + key: 'volume', + set: function set(volume) { + this.setVolume(volume); + }, + get: function get() { + return this.getVolume(); + } + }, { + key: 'src', + set: function set(src) { + this.setSrc(src); + }, + get: function get() { + return this.getSrc(); + } + }]); + + return DefaultPlayer; +}(); + +exports.default = DefaultPlayer; + + +_window2.default.DefaultPlayer = DefaultPlayer; + +},{"3":3}],19:[function(_dereq_,module,exports){ +'use strict'; + +var _window = _dereq_(3); + +var _window2 = _interopRequireDefault(_window); + +var _mejs = _dereq_(8); + +var _mejs2 = _interopRequireDefault(_mejs); + +var _player = _dereq_(17); + +var _player2 = _interopRequireDefault(_player); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +if (typeof jQuery !== 'undefined') { + _mejs2.default.$ = jQuery; +} else if (typeof Zepto !== 'undefined') { + _mejs2.default.$ = Zepto; +} else if (typeof ender !== 'undefined') { + _mejs2.default.$ = ender; +} + +(function ($) { + if (typeof $ !== 'undefined') { + $.fn.mediaelementplayer = function (options) { + if (options === false) { + this.each(function () { + var player = $(this).data('mediaelementplayer'); + if (player) { + player.remove(); + } + $(this).removeData('mediaelementplayer'); + }); + } else { + this.each(function () { + $(this).data('mediaelementplayer', new _player2.default(this, options)); + }); + } + return this; + }; + + $(document).ready(function () { + $('.' + _mejs2.default.MepDefaults.classPrefix + 'player').mediaelementplayer(); + }); + } +})(_mejs2.default.$); + +},{"17":17,"3":3,"8":8}],20:[function(_dereq_,module,exports){ +'use strict'; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +var _window = _dereq_(3); + +var _window2 = _interopRequireDefault(_window); + +var _mejs = _dereq_(8); + +var _mejs2 = _interopRequireDefault(_mejs); + +var _renderer = _dereq_(9); + +var _general = _dereq_(26); + +var _media = _dereq_(28); + +var _constants = _dereq_(24); + +var _dom = _dereq_(25); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var NativeDash = { + + promise: null, + + load: function load(settings) { + if (typeof dashjs !== 'undefined') { + NativeDash.promise = new Promise(function (resolve) { + resolve(); + }).then(function () { + NativeDash._createPlayer(settings); + }); + } else { + settings.options.path = typeof settings.options.path === 'string' ? settings.options.path : 'https://cdn.dashjs.org/latest/dash.all.min.js'; + + NativeDash.promise = NativeDash.promise || (0, _dom.loadScript)(settings.options.path); + NativeDash.promise.then(function () { + NativeDash._createPlayer(settings); + }); + } + + return NativeDash.promise; + }, + + _createPlayer: function _createPlayer(settings) { + var player = dashjs.MediaPlayer().create(); + _window2.default['__ready__' + settings.id](player); + return player; + } +}; + +var DashNativeRenderer = { + name: 'native_dash', + options: { + prefix: 'native_dash', + dash: { + path: 'https://cdn.dashjs.org/latest/dash.all.min.js', + debug: false, + drm: {}, + + robustnessLevel: '' + } + }, + + canPlayType: function canPlayType(type) { + return _constants.HAS_MSE && ['application/dash+xml'].indexOf(type.toLowerCase()) > -1; + }, + + create: function create(mediaElement, options, mediaFiles) { + + var originalNode = mediaElement.originalNode, + id = mediaElement.id + '_' + options.prefix, + autoplay = originalNode.autoplay, + children = originalNode.children; + + var node = null, + dashPlayer = null; + + originalNode.removeAttribute('type'); + for (var i = 0, total = children.length; i < total; i++) { + children[i].removeAttribute('type'); + } + + node = originalNode.cloneNode(true); + options = Object.assign(options, mediaElement.options); + + var props = _mejs2.default.html5media.properties, + events = _mejs2.default.html5media.events.concat(['click', 'mouseover', 'mouseout']).filter(function (e) { + return e !== 'error'; + }), + attachNativeEvents = function attachNativeEvents(e) { + var event = (0, _general.createEvent)(e.type, mediaElement); + mediaElement.dispatchEvent(event); + }, + assignGettersSetters = function assignGettersSetters(propName) { + var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1); + + node['get' + capName] = function () { + return dashPlayer !== null ? node[propName] : null; + }; + + node['set' + capName] = function (value) { + if (_mejs2.default.html5media.readOnlyProperties.indexOf(propName) === -1) { + if (propName === 'src') { + var source = (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value.src ? value.src : value; + node[propName] = source; + if (dashPlayer !== null) { + dashPlayer.reset(); + for (var _i = 0, _total = events.length; _i < _total; _i++) { + node.removeEventListener(events[_i], attachNativeEvents); + } + dashPlayer = NativeDash._createPlayer({ + options: options.dash, + id: id + }); + + if (value && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && _typeof(value.drm) === 'object') { + dashPlayer.setProtectionData(value.drm); + if ((0, _general.isString)(options.dash.robustnessLevel) && options.dash.robustnessLevel) { + dashPlayer.getProtectionController().setRobustnessLevel(options.dash.robustnessLevel); + } + } + dashPlayer.attachSource(source); + if (autoplay) { + dashPlayer.play(); + } + } + } else { + node[propName] = value; + } + } + }; + }; + + for (var _i2 = 0, _total2 = props.length; _i2 < _total2; _i2++) { + assignGettersSetters(props[_i2]); + } + + _window2.default['__ready__' + id] = function (_dashPlayer) { + mediaElement.dashPlayer = dashPlayer = _dashPlayer; + + var dashEvents = dashjs.MediaPlayer.events, + assignEvents = function assignEvents(eventName) { + if (eventName === 'loadedmetadata') { + dashPlayer.initialize(); + dashPlayer.attachView(node); + dashPlayer.setAutoPlay(false); + + if (_typeof(options.dash.drm) === 'object' && !_mejs2.default.Utils.isObjectEmpty(options.dash.drm)) { + dashPlayer.setProtectionData(options.dash.drm); + if ((0, _general.isString)(options.dash.robustnessLevel) && options.dash.robustnessLevel) { + dashPlayer.getProtectionController().setRobustnessLevel(options.dash.robustnessLevel); + } + } + dashPlayer.attachSource(node.getSrc()); + } + + node.addEventListener(eventName, attachNativeEvents); + }; + + for (var _i3 = 0, _total3 = events.length; _i3 < _total3; _i3++) { + assignEvents(events[_i3]); + } + + var assignMdashEvents = function assignMdashEvents(e) { + if (e.type.toLowerCase() === 'error') { + mediaElement.generateError(e.message, node.src); + console.error(e); + } else { + var _event = (0, _general.createEvent)(e.type, mediaElement); + _event.data = e; + mediaElement.dispatchEvent(_event); + } + }; + + for (var eventType in dashEvents) { + if (dashEvents.hasOwnProperty(eventType)) { + dashPlayer.on(dashEvents[eventType], function (e) { + return assignMdashEvents(e); + }); + } + } + }; + + if (mediaFiles && mediaFiles.length > 0) { + for (var _i4 = 0, _total4 = mediaFiles.length; _i4 < _total4; _i4++) { + if (_renderer.renderer.renderers[options.prefix].canPlayType(mediaFiles[_i4].type)) { + node.setAttribute('src', mediaFiles[_i4].src); + if (typeof mediaFiles[_i4].drm !== 'undefined') { + options.dash.drm = mediaFiles[_i4].drm; + } + break; + } + } + } + + node.setAttribute('id', id); + + originalNode.parentNode.insertBefore(node, originalNode); + originalNode.autoplay = false; + originalNode.style.display = 'none'; + + node.setSize = function (width, height) { + node.style.width = width + 'px'; + node.style.height = height + 'px'; + return node; + }; + + node.hide = function () { + node.pause(); + node.style.display = 'none'; + return node; + }; + + node.show = function () { + node.style.display = ''; + return node; + }; + + node.destroy = function () { + if (dashPlayer !== null) { + dashPlayer.reset(); + } + }; + + var event = (0, _general.createEvent)('rendererready', node, false); + mediaElement.originalNode.dispatchEvent(event); + + mediaElement.promises.push(NativeDash.load({ + options: options.dash, + id: id + })); + + return node; + } +}; + +_media.typeChecks.push(function (url) { + return ~url.toLowerCase().indexOf('.mpd') ? 'application/dash+xml' : null; +}); + +_renderer.renderer.add(DashNativeRenderer); + +},{"24":24,"25":25,"26":26,"28":28,"3":3,"8":8,"9":9}],21:[function(_dereq_,module,exports){ +'use strict'; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +var _window = _dereq_(3); + +var _window2 = _interopRequireDefault(_window); + +var _mejs = _dereq_(8); + +var _mejs2 = _interopRequireDefault(_mejs); + +var _renderer = _dereq_(9); + +var _general = _dereq_(26); + +var _constants = _dereq_(24); + +var _media = _dereq_(28); + +var _dom = _dereq_(25); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var NativeHls = { + + promise: null, + + load: function load(settings) { + if (typeof Hls !== 'undefined') { + NativeHls.promise = new Promise(function (resolve) { + resolve(); + }).then(function () { + NativeHls._createPlayer(settings); + }); + } else { + settings.options.path = typeof settings.options.path === 'string' ? settings.options.path : 'https://cdn.jsdelivr.net/npm/hls.js@latest'; + + NativeHls.promise = NativeHls.promise || (0, _dom.loadScript)(settings.options.path); + NativeHls.promise.then(function () { + NativeHls._createPlayer(settings); + }); + } + + return NativeHls.promise; + }, + + _createPlayer: function _createPlayer(settings) { + var player = new Hls(settings.options); + _window2.default['__ready__' + settings.id](player); + return player; + } +}; + +var HlsNativeRenderer = { + name: 'native_hls', + options: { + prefix: 'native_hls', + hls: { + path: 'https://cdn.jsdelivr.net/npm/hls.js@latest', + + autoStartLoad: false, + debug: false + } + }, + + canPlayType: function canPlayType(type) { + return _constants.HAS_MSE && ['application/x-mpegurl', 'application/vnd.apple.mpegurl', 'audio/mpegurl', 'audio/hls', 'video/hls'].indexOf(type.toLowerCase()) > -1; + }, + + create: function create(mediaElement, options, mediaFiles) { + + var originalNode = mediaElement.originalNode, + id = mediaElement.id + '_' + options.prefix, + preload = originalNode.getAttribute('preload'), + autoplay = originalNode.autoplay; + + var hlsPlayer = null, + node = null, + index = 0, + total = mediaFiles.length; + + node = originalNode.cloneNode(true); + options = Object.assign(options, mediaElement.options); + options.hls.autoStartLoad = preload && preload !== 'none' || autoplay; + + var props = _mejs2.default.html5media.properties, + events = _mejs2.default.html5media.events.concat(['click', 'mouseover', 'mouseout']).filter(function (e) { + return e !== 'error'; + }), + attachNativeEvents = function attachNativeEvents(e) { + var event = (0, _general.createEvent)(e.type, mediaElement); + mediaElement.dispatchEvent(event); + }, + assignGettersSetters = function assignGettersSetters(propName) { + var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1); + + node['get' + capName] = function () { + return hlsPlayer !== null ? node[propName] : null; + }; + + node['set' + capName] = function (value) { + if (_mejs2.default.html5media.readOnlyProperties.indexOf(propName) === -1) { + if (propName === 'src') { + node[propName] = (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value.src ? value.src : value; + if (hlsPlayer !== null) { + hlsPlayer.destroy(); + for (var i = 0, _total = events.length; i < _total; i++) { + node.removeEventListener(events[i], attachNativeEvents); + } + hlsPlayer = NativeHls._createPlayer({ + options: options.hls, + id: id + }); + hlsPlayer.loadSource(value); + hlsPlayer.attachMedia(node); + } + } else { + node[propName] = value; + } + } + }; + }; + + for (var i = 0, _total2 = props.length; i < _total2; i++) { + assignGettersSetters(props[i]); + } + + _window2.default['__ready__' + id] = function (_hlsPlayer) { + mediaElement.hlsPlayer = hlsPlayer = _hlsPlayer; + var hlsEvents = Hls.Events, + assignEvents = function assignEvents(eventName) { + if (eventName === 'loadedmetadata') { + var url = mediaElement.originalNode.src; + hlsPlayer.detachMedia(); + hlsPlayer.loadSource(url); + hlsPlayer.attachMedia(node); + } + + node.addEventListener(eventName, attachNativeEvents); + }; + + for (var _i = 0, _total3 = events.length; _i < _total3; _i++) { + assignEvents(events[_i]); + } + + var recoverDecodingErrorDate = void 0, + recoverSwapAudioCodecDate = void 0; + var assignHlsEvents = function assignHlsEvents(name, data) { + if (name === 'hlsError') { + console.warn(data); + data = data[1]; + + if (data.fatal) { + switch (data.type) { + case 'mediaError': + var now = new Date().getTime(); + if (!recoverDecodingErrorDate || now - recoverDecodingErrorDate > 3000) { + recoverDecodingErrorDate = new Date().getTime(); + hlsPlayer.recoverMediaError(); + } else if (!recoverSwapAudioCodecDate || now - recoverSwapAudioCodecDate > 3000) { + recoverSwapAudioCodecDate = new Date().getTime(); + console.warn('Attempting to swap Audio Codec and recover from media error'); + hlsPlayer.swapAudioCodec(); + hlsPlayer.recoverMediaError(); + } else { + var message = 'Cannot recover, last media error recovery failed'; + mediaElement.generateError(message, node.src); + console.error(message); + } + break; + case 'networkError': + if (data.details === 'manifestLoadError') { + if (index < total && mediaFiles[index + 1] !== undefined) { + node.setSrc(mediaFiles[index++].src); + node.load(); + node.play(); + } else { + var _message = 'Network error'; + mediaElement.generateError(_message, mediaFiles); + console.error(_message); + } + } else { + var _message2 = 'Network error'; + mediaElement.generateError(_message2, mediaFiles); + console.error(_message2); + } + break; + default: + hlsPlayer.destroy(); + break; + } + return; + } + } + var event = (0, _general.createEvent)(name, mediaElement); + event.data = data; + mediaElement.dispatchEvent(event); + }; + + var _loop = function _loop(eventType) { + if (hlsEvents.hasOwnProperty(eventType)) { + hlsPlayer.on(hlsEvents[eventType], function () { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return assignHlsEvents(hlsEvents[eventType], args); + }); + } + }; + + for (var eventType in hlsEvents) { + _loop(eventType); + } + }; + + if (total > 0) { + for (; index < total; index++) { + if (_renderer.renderer.renderers[options.prefix].canPlayType(mediaFiles[index].type)) { + node.setAttribute('src', mediaFiles[index].src); + break; + } + } + } + + if (preload !== 'auto' && !autoplay) { + node.addEventListener('play', function () { + if (hlsPlayer !== null) { + hlsPlayer.startLoad(); + } + }); + + node.addEventListener('pause', function () { + if (hlsPlayer !== null) { + hlsPlayer.stopLoad(); + } + }); + } + + node.setAttribute('id', id); + + originalNode.parentNode.insertBefore(node, originalNode); + originalNode.autoplay = false; + originalNode.style.display = 'none'; + + node.setSize = function (width, height) { + node.style.width = width + 'px'; + node.style.height = height + 'px'; + return node; + }; + + node.hide = function () { + node.pause(); + node.style.display = 'none'; + return node; + }; + + node.show = function () { + node.style.display = ''; + return node; + }; + + node.destroy = function () { + if (hlsPlayer !== null) { + hlsPlayer.stopLoad(); + hlsPlayer.destroy(); + } + }; + + var event = (0, _general.createEvent)('rendererready', node, false); + mediaElement.originalNode.dispatchEvent(event); + + mediaElement.promises.push(NativeHls.load({ + options: options.hls, + id: id + })); + + return node; + } +}; + +_media.typeChecks.push(function (url) { + return ~url.toLowerCase().indexOf('.m3u8') ? 'application/x-mpegURL' : null; +}); + +_renderer.renderer.add(HlsNativeRenderer); + +},{"24":24,"25":25,"26":26,"28":28,"3":3,"8":8,"9":9}],22:[function(_dereq_,module,exports){ +'use strict'; + +var _window = _dereq_(3); + +var _window2 = _interopRequireDefault(_window); + +var _document = _dereq_(2); + +var _document2 = _interopRequireDefault(_document); + +var _mejs = _dereq_(8); + +var _mejs2 = _interopRequireDefault(_mejs); + +var _renderer = _dereq_(9); + +var _general = _dereq_(26); + +var _constants = _dereq_(24); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var HtmlMediaElement = { + name: 'html5', + options: { + prefix: 'html5' + }, + + canPlayType: function canPlayType(type) { + + var mediaElement = _document2.default.createElement('video'); + + if (_constants.IS_ANDROID && /\/mp(3|4)$/i.test(type) || ~['application/x-mpegurl', 'vnd.apple.mpegurl', 'audio/mpegurl', 'audio/hls', 'video/hls'].indexOf(type.toLowerCase()) && _constants.SUPPORTS_NATIVE_HLS) { + return 'yes'; + } else if (mediaElement.canPlayType) { + return mediaElement.canPlayType(type.toLowerCase()).replace(/no/, ''); + } else { + return ''; + } + }, + + create: function create(mediaElement, options, mediaFiles) { + + var id = mediaElement.id + '_' + options.prefix; + var isActive = false; + + var node = null; + + if (mediaElement.originalNode === undefined || mediaElement.originalNode === null) { + node = _document2.default.createElement('audio'); + mediaElement.appendChild(node); + } else { + node = mediaElement.originalNode; + } + + node.setAttribute('id', id); + + var props = _mejs2.default.html5media.properties, + assignGettersSetters = function assignGettersSetters(propName) { + var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1); + + node['get' + capName] = function () { + return node[propName]; + }; + + node['set' + capName] = function (value) { + if (_mejs2.default.html5media.readOnlyProperties.indexOf(propName) === -1) { + node[propName] = value; + } + }; + }; + + for (var i = 0, _total = props.length; i < _total; i++) { + assignGettersSetters(props[i]); + } + + var events = _mejs2.default.html5media.events.concat(['click', 'mouseover', 'mouseout']).filter(function (e) { + return e !== 'error'; + }), + assignEvents = function assignEvents(eventName) { + node.addEventListener(eventName, function (e) { + if (isActive) { + var _event = (0, _general.createEvent)(e.type, e.target); + mediaElement.dispatchEvent(_event); + } + }); + }; + + for (var _i = 0, _total2 = events.length; _i < _total2; _i++) { + assignEvents(events[_i]); + } + + node.setSize = function (width, height) { + node.style.width = width + 'px'; + node.style.height = height + 'px'; + return node; + }; + + node.hide = function () { + isActive = false; + node.style.display = 'none'; + + return node; + }; + + node.show = function () { + isActive = true; + node.style.display = ''; + + return node; + }; + + var index = 0, + total = mediaFiles.length; + if (total > 0) { + for (; index < total; index++) { + if (_renderer.renderer.renderers[options.prefix].canPlayType(mediaFiles[index].type)) { + node.setAttribute('src', mediaFiles[index].src); + break; + } + } + } + + node.addEventListener('error', function (e) { + if (e && e.target && e.target.error && e.target.error.code === 4 && isActive) { + if (index < total && mediaFiles[index + 1] !== undefined) { + node.src = mediaFiles[index++].src; + node.load(); + node.play(); + } else { + mediaElement.generateError('Media error: Format(s) not supported or source(s) not found', mediaFiles); + } + } + }); + + var event = (0, _general.createEvent)('rendererready', node, false); + mediaElement.originalNode.dispatchEvent(event); + + return node; + } +}; + +_window2.default.HtmlMediaElement = _mejs2.default.HtmlMediaElement = HtmlMediaElement; + +_renderer.renderer.add(HtmlMediaElement); + +},{"2":2,"24":24,"26":26,"3":3,"8":8,"9":9}],23:[function(_dereq_,module,exports){ +'use strict'; + +var _window = _dereq_(3); + +var _window2 = _interopRequireDefault(_window); + +var _document = _dereq_(2); + +var _document2 = _interopRequireDefault(_document); + +var _mejs = _dereq_(8); + +var _mejs2 = _interopRequireDefault(_mejs); + +var _renderer = _dereq_(9); + +var _general = _dereq_(26); + +var _media = _dereq_(28); + +var _dom = _dereq_(25); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var YouTubeApi = { + isIframeStarted: false, + + isIframeLoaded: false, + + iframeQueue: [], + + enqueueIframe: function enqueueIframe(settings) { + YouTubeApi.isLoaded = typeof YT !== 'undefined' && YT.loaded; + + if (YouTubeApi.isLoaded) { + YouTubeApi.createIframe(settings); + } else { + YouTubeApi.loadIframeApi(); + YouTubeApi.iframeQueue.push(settings); + } + }, + + loadIframeApi: function loadIframeApi() { + if (!YouTubeApi.isIframeStarted) { + (0, _dom.loadScript)('https://www.youtube.com/player_api'); + YouTubeApi.isIframeStarted = true; + } + }, + + iFrameReady: function iFrameReady() { + + YouTubeApi.isLoaded = true; + YouTubeApi.isIframeLoaded = true; + + while (YouTubeApi.iframeQueue.length > 0) { + var settings = YouTubeApi.iframeQueue.pop(); + YouTubeApi.createIframe(settings); + } + }, + + createIframe: function createIframe(settings) { + return new YT.Player(settings.containerId, settings); + }, + + getYouTubeId: function getYouTubeId(url) { + + var youTubeId = ''; + + if (url.indexOf('?') > 0) { + youTubeId = YouTubeApi.getYouTubeIdFromParam(url); + + if (youTubeId === '') { + youTubeId = YouTubeApi.getYouTubeIdFromUrl(url); + } + } else { + youTubeId = YouTubeApi.getYouTubeIdFromUrl(url); + } + + var id = youTubeId.substring(youTubeId.lastIndexOf('/') + 1); + youTubeId = id.split('?'); + return youTubeId[0]; + }, + + getYouTubeIdFromParam: function getYouTubeIdFromParam(url) { + + if (url === undefined || url === null || !url.trim().length) { + return null; + } + + var parts = url.split('?'), + parameters = parts[1].split('&'); + + var youTubeId = ''; + + for (var i = 0, total = parameters.length; i < total; i++) { + var paramParts = parameters[i].split('='); + if (paramParts[0] === 'v') { + youTubeId = paramParts[1]; + break; + } + } + + return youTubeId; + }, + + getYouTubeIdFromUrl: function getYouTubeIdFromUrl(url) { + + if (url === undefined || url === null || !url.trim().length) { + return null; + } + + var parts = url.split('?'); + url = parts[0]; + return url.substring(url.lastIndexOf('/') + 1); + }, + + getYouTubeNoCookieUrl: function getYouTubeNoCookieUrl(url) { + if (url === undefined || url === null || !url.trim().length || url.indexOf('//www.youtube') === -1) { + return url; + } + + var parts = url.split('/'); + parts[2] = parts[2].replace('.com', '-nocookie.com'); + return parts.join('/'); + } +}; + +var YouTubeIframeRenderer = { + name: 'youtube_iframe', + + options: { + prefix: 'youtube_iframe', + + youtube: { + autoplay: 0, + controls: 0, + disablekb: 1, + end: 0, + loop: 0, + modestbranding: 0, + playsinline: 0, + rel: 0, + showinfo: 0, + start: 0, + iv_load_policy: 3, + + nocookie: false, + + imageQuality: null + } + }, + + canPlayType: function canPlayType(type) { + return ~['video/youtube', 'video/x-youtube'].indexOf(type.toLowerCase()); + }, + + create: function create(mediaElement, options, mediaFiles) { + + var youtube = {}, + apiStack = [], + readyState = 4; + + var youTubeApi = null, + paused = true, + ended = false, + youTubeIframe = null, + volume = 1; + + youtube.options = options; + youtube.id = mediaElement.id + '_' + options.prefix; + youtube.mediaElement = mediaElement; + + var props = _mejs2.default.html5media.properties, + assignGettersSetters = function assignGettersSetters(propName) { + + var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1); + + youtube['get' + capName] = function () { + if (youTubeApi !== null) { + var value = null; + + switch (propName) { + case 'currentTime': + return youTubeApi.getCurrentTime(); + case 'duration': + return youTubeApi.getDuration(); + case 'volume': + volume = youTubeApi.getVolume() / 100; + return volume; + case 'playbackRate': + return youTubeApi.getPlaybackRate(); + case 'paused': + return paused; + case 'ended': + return ended; + case 'muted': + return youTubeApi.isMuted(); + case 'buffered': + var percentLoaded = youTubeApi.getVideoLoadedFraction(), + duration = youTubeApi.getDuration(); + return { + start: function start() { + return 0; + }, + end: function end() { + return percentLoaded * duration; + }, + length: 1 + }; + case 'src': + return youTubeApi.getVideoUrl(); + case 'readyState': + return readyState; + } + + return value; + } else { + return null; + } + }; + + youtube['set' + capName] = function (value) { + if (youTubeApi !== null) { + switch (propName) { + case 'src': + var url = typeof value === 'string' ? value : value[0].src, + _videoId = YouTubeApi.getYouTubeId(url); + + if (mediaElement.originalNode.autoplay) { + youTubeApi.loadVideoById(_videoId); + } else { + youTubeApi.cueVideoById(_videoId); + } + break; + case 'currentTime': + youTubeApi.seekTo(value); + break; + case 'muted': + if (value) { + youTubeApi.mute(); + } else { + youTubeApi.unMute(); + } + setTimeout(function () { + var event = (0, _general.createEvent)('volumechange', youtube); + mediaElement.dispatchEvent(event); + }, 50); + break; + case 'volume': + volume = value; + youTubeApi.setVolume(value * 100); + setTimeout(function () { + var event = (0, _general.createEvent)('volumechange', youtube); + mediaElement.dispatchEvent(event); + }, 50); + break; + case 'playbackRate': + youTubeApi.setPlaybackRate(value); + setTimeout(function () { + var event = (0, _general.createEvent)('ratechange', youtube); + mediaElement.dispatchEvent(event); + }, 50); + break; + case 'readyState': + var event = (0, _general.createEvent)('canplay', youtube); + mediaElement.dispatchEvent(event); + break; + default: + + break; + } + } else { + apiStack.push({ type: 'set', propName: propName, value: value }); + } + }; + }; + + for (var i = 0, total = props.length; i < total; i++) { + assignGettersSetters(props[i]); + } + + var methods = _mejs2.default.html5media.methods, + assignMethods = function assignMethods(methodName) { + youtube[methodName] = function () { + if (youTubeApi !== null) { + switch (methodName) { + case 'play': + paused = false; + return youTubeApi.playVideo(); + case 'pause': + paused = true; + return youTubeApi.pauseVideo(); + case 'load': + return null; + } + } else { + apiStack.push({ type: 'call', methodName: methodName }); + } + }; + }; + + for (var _i = 0, _total = methods.length; _i < _total; _i++) { + assignMethods(methods[_i]); + } + + var errorHandler = function errorHandler(error) { + var message = ''; + switch (error.data) { + case 2: + message = 'The request contains an invalid parameter value. Verify that video ID has 11 characters and that contains no invalid characters, such as exclamation points or asterisks.'; + break; + case 5: + message = 'The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.'; + break; + case 100: + message = 'The video requested was not found. Either video has been removed or has been marked as private.'; + break; + case 101: + case 105: + message = 'The owner of the requested video does not allow it to be played in embedded players.'; + break; + default: + message = 'Unknown error.'; + break; + } + mediaElement.generateError('Code ' + error.data + ': ' + message, mediaFiles); + }; + + var youtubeContainer = _document2.default.createElement('div'); + youtubeContainer.id = youtube.id; + + if (youtube.options.youtube.nocookie) { + mediaElement.originalNode.src = YouTubeApi.getYouTubeNoCookieUrl(mediaFiles[0].src); + } + + mediaElement.originalNode.parentNode.insertBefore(youtubeContainer, mediaElement.originalNode); + mediaElement.originalNode.style.display = 'none'; + + var isAudio = mediaElement.originalNode.tagName.toLowerCase() === 'audio', + height = isAudio ? '1' : mediaElement.originalNode.height, + width = isAudio ? '1' : mediaElement.originalNode.width, + videoId = YouTubeApi.getYouTubeId(mediaFiles[0].src), + youtubeSettings = { + id: youtube.id, + containerId: youtubeContainer.id, + videoId: videoId, + height: height, + width: width, + host: youtube.options.youtube && youtube.options.youtube.nocookie ? 'https://www.youtube-nocookie.com' : undefined, + playerVars: Object.assign({ + controls: 0, + rel: 0, + disablekb: 1, + showinfo: 0, + modestbranding: 0, + html5: 1, + iv_load_policy: 3 + }, youtube.options.youtube), + origin: _window2.default.location.host, + events: { + onReady: function onReady(e) { + mediaElement.youTubeApi = youTubeApi = e.target; + mediaElement.youTubeState = { + paused: true, + ended: false + }; + + if (apiStack.length) { + for (var _i2 = 0, _total2 = apiStack.length; _i2 < _total2; _i2++) { + + var stackItem = apiStack[_i2]; + + if (stackItem.type === 'set') { + var propName = stackItem.propName, + capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1); + + youtube['set' + capName](stackItem.value); + } else if (stackItem.type === 'call') { + youtube[stackItem.methodName](); + } + } + } + + youTubeIframe = youTubeApi.getIframe(); + + if (mediaElement.originalNode.muted) { + youTubeApi.mute(); + } + + var events = ['mouseover', 'mouseout'], + assignEvents = function assignEvents(e) { + var newEvent = (0, _general.createEvent)(e.type, youtube); + mediaElement.dispatchEvent(newEvent); + }; + + for (var _i3 = 0, _total3 = events.length; _i3 < _total3; _i3++) { + youTubeIframe.addEventListener(events[_i3], assignEvents, false); + } + + var initEvents = ['rendererready', 'loadedmetadata', 'loadeddata', 'canplay']; + + for (var _i4 = 0, _total4 = initEvents.length; _i4 < _total4; _i4++) { + var event = (0, _general.createEvent)(initEvents[_i4], youtube, true); + mediaElement.dispatchEvent(event); + } + }, + onStateChange: function onStateChange(e) { + var events = []; + + switch (e.data) { + case -1: + events = ['loadedmetadata']; + paused = true; + ended = false; + break; + case 0: + events = ['ended']; + paused = false; + ended = !youtube.options.youtube.loop; + if (!youtube.options.youtube.loop) { + youtube.stopInterval(); + } + break; + case 1: + events = ['play', 'playing']; + paused = false; + ended = false; + youtube.startInterval(); + break; + case 2: + events = ['pause']; + paused = true; + ended = false; + youtube.stopInterval(); + break; + case 3: + events = ['progress']; + ended = false; + break; + case 5: + events = ['loadeddata', 'loadedmetadata', 'canplay']; + paused = true; + ended = false; + break; + } + + for (var _i5 = 0, _total5 = events.length; _i5 < _total5; _i5++) { + var event = (0, _general.createEvent)(events[_i5], youtube); + mediaElement.dispatchEvent(event); + } + }, + onError: function onError(e) { + return errorHandler(e); + } + } + }; + + if (isAudio || mediaElement.originalNode.hasAttribute('playsinline')) { + youtubeSettings.playerVars.playsinline = 1; + } + + if (mediaElement.originalNode.controls) { + youtubeSettings.playerVars.controls = 1; + } + if (mediaElement.originalNode.autoplay) { + youtubeSettings.playerVars.autoplay = 1; + } + if (mediaElement.originalNode.loop) { + youtubeSettings.playerVars.loop = 1; + } + + if ((youtubeSettings.playerVars.loop && parseInt(youtubeSettings.playerVars.loop, 10) === 1 || mediaElement.originalNode.src.indexOf('loop=') > -1) && !youtubeSettings.playerVars.playlist && mediaElement.originalNode.src.indexOf('playlist=') === -1) { + youtubeSettings.playerVars.playlist = YouTubeApi.getYouTubeId(mediaElement.originalNode.src); + } + + YouTubeApi.enqueueIframe(youtubeSettings); + + youtube.onEvent = function (eventName, player, _youTubeState) { + if (_youTubeState !== null && _youTubeState !== undefined) { + mediaElement.youTubeState = _youTubeState; + } + }; + + youtube.setSize = function (width, height) { + if (youTubeApi !== null) { + youTubeApi.setSize(width, height); + } + }; + youtube.hide = function () { + youtube.stopInterval(); + youtube.pause(); + if (youTubeIframe) { + youTubeIframe.style.display = 'none'; + } + }; + youtube.show = function () { + if (youTubeIframe) { + youTubeIframe.style.display = ''; + } + }; + youtube.destroy = function () { + youTubeApi.destroy(); + }; + youtube.interval = null; + + youtube.startInterval = function () { + youtube.interval = setInterval(function () { + var event = (0, _general.createEvent)('timeupdate', youtube); + mediaElement.dispatchEvent(event); + }, 250); + }; + youtube.stopInterval = function () { + if (youtube.interval) { + clearInterval(youtube.interval); + } + }; + youtube.getPosterUrl = function () { + var quality = options.youtube.imageQuality, + resolutions = ['default', 'hqdefault', 'mqdefault', 'sddefault', 'maxresdefault'], + id = YouTubeApi.getYouTubeId(mediaElement.originalNode.src); + return quality && resolutions.indexOf(quality) > -1 && id ? 'https://img.youtube.com/vi/' + id + '/' + quality + '.jpg' : ''; + }; + + return youtube; + } +}; + +_window2.default.onYouTubePlayerAPIReady = function () { + YouTubeApi.iFrameReady(); +}; + +_media.typeChecks.push(function (url) { + return (/\/\/(www\.youtube|youtu\.?be)/i.test(url) ? 'video/x-youtube' : null + ); +}); + +_renderer.renderer.add(YouTubeIframeRenderer); + +},{"2":2,"25":25,"26":26,"28":28,"3":3,"8":8,"9":9}],24:[function(_dereq_,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.cancelFullScreen = exports.requestFullScreen = exports.isFullScreen = exports.FULLSCREEN_EVENT_NAME = exports.HAS_NATIVE_FULLSCREEN_ENABLED = exports.HAS_TRUE_NATIVE_FULLSCREEN = exports.HAS_IOS_FULLSCREEN = exports.HAS_MS_NATIVE_FULLSCREEN = exports.HAS_MOZ_NATIVE_FULLSCREEN = exports.HAS_WEBKIT_NATIVE_FULLSCREEN = exports.HAS_NATIVE_FULLSCREEN = exports.SUPPORTS_NATIVE_HLS = exports.SUPPORT_PASSIVE_EVENT = exports.SUPPORT_POINTER_EVENTS = exports.HAS_MSE = exports.IS_STOCK_ANDROID = exports.IS_SAFARI = exports.IS_FIREFOX = exports.IS_CHROME = exports.IS_EDGE = exports.IS_IE = exports.IS_ANDROID = exports.IS_IOS = exports.IS_IPOD = exports.IS_IPHONE = exports.IS_IPAD = exports.UA = exports.NAV = undefined; + +var _window = _dereq_(3); + +var _window2 = _interopRequireDefault(_window); + +var _document = _dereq_(2); + +var _document2 = _interopRequireDefault(_document); + +var _mejs = _dereq_(8); + +var _mejs2 = _interopRequireDefault(_mejs); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var NAV = exports.NAV = _window2.default.navigator; +var UA = exports.UA = NAV.userAgent.toLowerCase(); +var IS_IPAD = exports.IS_IPAD = /ipad/i.test(UA) && !_window2.default.MSStream; +var IS_IPHONE = exports.IS_IPHONE = /iphone/i.test(UA) && !_window2.default.MSStream; +var IS_IPOD = exports.IS_IPOD = /ipod/i.test(UA) && !_window2.default.MSStream; +var IS_IOS = exports.IS_IOS = /ipad|iphone|ipod/i.test(UA) && !_window2.default.MSStream; +var IS_ANDROID = exports.IS_ANDROID = /android/i.test(UA); +var IS_IE = exports.IS_IE = /(trident|microsoft)/i.test(NAV.appName); +var IS_EDGE = exports.IS_EDGE = 'msLaunchUri' in NAV && !('documentMode' in _document2.default); +var IS_CHROME = exports.IS_CHROME = /chrome/i.test(UA); +var IS_FIREFOX = exports.IS_FIREFOX = /firefox/i.test(UA); +var IS_SAFARI = exports.IS_SAFARI = /safari/i.test(UA) && !IS_CHROME; +var IS_STOCK_ANDROID = exports.IS_STOCK_ANDROID = /^mozilla\/\d+\.\d+\s\(linux;\su;/i.test(UA); +var HAS_MSE = exports.HAS_MSE = 'MediaSource' in _window2.default; +var SUPPORT_POINTER_EVENTS = exports.SUPPORT_POINTER_EVENTS = true;var SUPPORT_PASSIVE_EVENT = exports.SUPPORT_PASSIVE_EVENT = function () { + var supportsPassive = false; + try { + var opts = Object.defineProperty({}, 'passive', { + get: function get() { + supportsPassive = true; + } + }); + _window2.default.addEventListener('test', null, opts); + } catch (e) {} + + return supportsPassive; +}(); + +var html5Elements = ['source', 'track', 'audio', 'video']; +var video = void 0; + +for (var i = 0, total = html5Elements.length; i < total; i++) { + video = _document2.default.createElement(html5Elements[i]); +} + +var SUPPORTS_NATIVE_HLS = exports.SUPPORTS_NATIVE_HLS = IS_SAFARI || IS_IE && /edge/i.test(UA); + +var hasiOSFullScreen = video.webkitEnterFullscreen !== undefined; + +var hasNativeFullscreen = video.requestFullscreen !== undefined; + +if (hasiOSFullScreen && /mac os x 10_5/i.test(UA)) { + hasNativeFullscreen = false; + hasiOSFullScreen = false; +} + +var hasWebkitNativeFullScreen = video.webkitRequestFullScreen !== undefined; +var hasMozNativeFullScreen = video.mozRequestFullScreen !== undefined; +var hasMsNativeFullScreen = video.msRequestFullscreen !== undefined; +var hasTrueNativeFullScreen = hasWebkitNativeFullScreen || hasMozNativeFullScreen || hasMsNativeFullScreen; +var nativeFullScreenEnabled = hasTrueNativeFullScreen; +var fullScreenEventName = ''; +var isFullScreen = void 0, + requestFullScreen = void 0, + cancelFullScreen = void 0; + +if (hasMozNativeFullScreen) { + nativeFullScreenEnabled = _document2.default.mozFullScreenEnabled; +} else if (hasMsNativeFullScreen) { + nativeFullScreenEnabled = _document2.default.msFullscreenEnabled; +} + +if (IS_CHROME) { + hasiOSFullScreen = false; +} + +if (hasTrueNativeFullScreen) { + if (hasWebkitNativeFullScreen) { + fullScreenEventName = 'webkitfullscreenchange'; + } else if (hasMozNativeFullScreen) { + fullScreenEventName = 'fullscreenchange'; + } else if (hasMsNativeFullScreen) { + fullScreenEventName = 'MSFullscreenChange'; + } + + exports.isFullScreen = isFullScreen = function isFullScreen() { + if (hasMozNativeFullScreen) { + return _document2.default.mozFullScreen; + } else if (hasWebkitNativeFullScreen) { + return _document2.default.webkitIsFullScreen; + } else if (hasMsNativeFullScreen) { + return _document2.default.msFullscreenElement !== null; + } + }; + + exports.requestFullScreen = requestFullScreen = function requestFullScreen(el) { + if (hasWebkitNativeFullScreen) { + el.webkitRequestFullScreen(); + } else if (hasMozNativeFullScreen) { + el.mozRequestFullScreen(); + } else if (hasMsNativeFullScreen) { + el.msRequestFullscreen(); + } + }; + + exports.cancelFullScreen = cancelFullScreen = function cancelFullScreen() { + if (hasWebkitNativeFullScreen) { + _document2.default.webkitCancelFullScreen(); + } else if (hasMozNativeFullScreen) { + _document2.default.mozCancelFullScreen(); + } else if (hasMsNativeFullScreen) { + _document2.default.msExitFullscreen(); + } + }; +} + +var HAS_NATIVE_FULLSCREEN = exports.HAS_NATIVE_FULLSCREEN = hasNativeFullscreen; +var HAS_WEBKIT_NATIVE_FULLSCREEN = exports.HAS_WEBKIT_NATIVE_FULLSCREEN = hasWebkitNativeFullScreen; +var HAS_MOZ_NATIVE_FULLSCREEN = exports.HAS_MOZ_NATIVE_FULLSCREEN = hasMozNativeFullScreen; +var HAS_MS_NATIVE_FULLSCREEN = exports.HAS_MS_NATIVE_FULLSCREEN = hasMsNativeFullScreen; +var HAS_IOS_FULLSCREEN = exports.HAS_IOS_FULLSCREEN = hasiOSFullScreen; +var HAS_TRUE_NATIVE_FULLSCREEN = exports.HAS_TRUE_NATIVE_FULLSCREEN = hasTrueNativeFullScreen; +var HAS_NATIVE_FULLSCREEN_ENABLED = exports.HAS_NATIVE_FULLSCREEN_ENABLED = nativeFullScreenEnabled; +var FULLSCREEN_EVENT_NAME = exports.FULLSCREEN_EVENT_NAME = fullScreenEventName; +exports.isFullScreen = isFullScreen; +exports.requestFullScreen = requestFullScreen; +exports.cancelFullScreen = cancelFullScreen; + + +_mejs2.default.Features = _mejs2.default.Features || {}; +_mejs2.default.Features.isiPad = IS_IPAD; +_mejs2.default.Features.isiPod = IS_IPOD; +_mejs2.default.Features.isiPhone = IS_IPHONE; +_mejs2.default.Features.isiOS = _mejs2.default.Features.isiPhone || _mejs2.default.Features.isiPad; +_mejs2.default.Features.isAndroid = IS_ANDROID; +_mejs2.default.Features.isIE = IS_IE; +_mejs2.default.Features.isEdge = IS_EDGE; +_mejs2.default.Features.isChrome = IS_CHROME; +_mejs2.default.Features.isFirefox = IS_FIREFOX; +_mejs2.default.Features.isSafari = IS_SAFARI; +_mejs2.default.Features.isStockAndroid = IS_STOCK_ANDROID; +_mejs2.default.Features.hasMSE = HAS_MSE; +_mejs2.default.Features.supportsNativeHLS = SUPPORTS_NATIVE_HLS; +_mejs2.default.Features.supportsPointerEvents = SUPPORT_POINTER_EVENTS; +_mejs2.default.Features.supportsPassiveEvent = SUPPORT_PASSIVE_EVENT; +_mejs2.default.Features.hasiOSFullScreen = HAS_IOS_FULLSCREEN; +_mejs2.default.Features.hasNativeFullscreen = HAS_NATIVE_FULLSCREEN; +_mejs2.default.Features.hasWebkitNativeFullScreen = HAS_WEBKIT_NATIVE_FULLSCREEN; +_mejs2.default.Features.hasMozNativeFullScreen = HAS_MOZ_NATIVE_FULLSCREEN; +_mejs2.default.Features.hasMsNativeFullScreen = HAS_MS_NATIVE_FULLSCREEN; +_mejs2.default.Features.hasTrueNativeFullScreen = HAS_TRUE_NATIVE_FULLSCREEN; +_mejs2.default.Features.nativeFullScreenEnabled = HAS_NATIVE_FULLSCREEN_ENABLED; +_mejs2.default.Features.fullScreenEventName = FULLSCREEN_EVENT_NAME; +_mejs2.default.Features.isFullScreen = isFullScreen; +_mejs2.default.Features.requestFullScreen = requestFullScreen; +_mejs2.default.Features.cancelFullScreen = cancelFullScreen; + +},{"2":2,"3":3,"8":8}],25:[function(_dereq_,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.removeClass = exports.addClass = exports.hasClass = undefined; +exports.loadScript = loadScript; +exports.offset = offset; +exports.toggleClass = toggleClass; +exports.fadeOut = fadeOut; +exports.fadeIn = fadeIn; +exports.siblings = siblings; +exports.visible = visible; +exports.ajax = ajax; + +var _window = _dereq_(3); + +var _window2 = _interopRequireDefault(_window); + +var _document = _dereq_(2); + +var _document2 = _interopRequireDefault(_document); + +var _mejs = _dereq_(8); + +var _mejs2 = _interopRequireDefault(_mejs); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function loadScript(url) { + return new Promise(function (resolve, reject) { + var script = _document2.default.createElement('script'); + script.src = url; + script.async = true; + script.onload = function () { + script.remove(); + resolve(); + }; + script.onerror = function () { + script.remove(); + reject(); + }; + _document2.default.head.appendChild(script); + }); +} + +function offset(el) { + var rect = el.getBoundingClientRect(), + scrollLeft = _window2.default.pageXOffset || _document2.default.documentElement.scrollLeft, + scrollTop = _window2.default.pageYOffset || _document2.default.documentElement.scrollTop; + return { top: rect.top + scrollTop, left: rect.left + scrollLeft }; +} + +var hasClassMethod = void 0, + addClassMethod = void 0, + removeClassMethod = void 0; + +if ('classList' in _document2.default.documentElement) { + hasClassMethod = function hasClassMethod(el, className) { + return el.classList !== undefined && el.classList.contains(className); + }; + addClassMethod = function addClassMethod(el, className) { + return el.classList.add(className); + }; + removeClassMethod = function removeClassMethod(el, className) { + return el.classList.remove(className); + }; +} else { + hasClassMethod = function hasClassMethod(el, className) { + return new RegExp('\\b' + className + '\\b').test(el.className); + }; + addClassMethod = function addClassMethod(el, className) { + if (!hasClass(el, className)) { + el.className += ' ' + className; + } + }; + removeClassMethod = function removeClassMethod(el, className) { + el.className = el.className.replace(new RegExp('\\b' + className + '\\b', 'g'), ''); + }; +} + +var hasClass = exports.hasClass = hasClassMethod; +var addClass = exports.addClass = addClassMethod; +var removeClass = exports.removeClass = removeClassMethod; + +function toggleClass(el, className) { + hasClass(el, className) ? removeClass(el, className) : addClass(el, className); +} + +function fadeOut(el) { + var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 400; + var callback = arguments[2]; + + if (!el.style.opacity) { + el.style.opacity = 1; + } + + var start = null; + _window2.default.requestAnimationFrame(function animate(timestamp) { + start = start || timestamp; + var progress = timestamp - start; + var opacity = parseFloat(1 - progress / duration, 2); + el.style.opacity = opacity < 0 ? 0 : opacity; + if (progress > duration) { + if (callback && typeof callback === 'function') { + callback(); + } + } else { + _window2.default.requestAnimationFrame(animate); + } + }); +} + +function fadeIn(el) { + var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 400; + var callback = arguments[2]; + + if (!el.style.opacity) { + el.style.opacity = 0; + } + + var start = null; + _window2.default.requestAnimationFrame(function animate(timestamp) { + start = start || timestamp; + var progress = timestamp - start; + var opacity = parseFloat(progress / duration, 2); + el.style.opacity = opacity > 1 ? 1 : opacity; + if (progress > duration) { + if (callback && typeof callback === 'function') { + callback(); + } + } else { + _window2.default.requestAnimationFrame(animate); + } + }); +} + +function siblings(el, filter) { + var siblings = []; + el = el.parentNode.firstChild; + do { + if (!filter || filter(el)) { + siblings.push(el); + } + } while (el = el.nextSibling); + return siblings; +} + +function visible(elem) { + if (elem.getClientRects !== undefined && elem.getClientRects === 'function') { + return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length); + } + return !!(elem.offsetWidth || elem.offsetHeight); +} + +function ajax(url, dataType, success, error) { + var xhr = _window2.default.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'); + + var type = 'application/x-www-form-urlencoded; charset=UTF-8', + completed = false, + accept = '*/'.concat('*'); + + switch (dataType) { + case 'text': + type = 'text/plain'; + break; + case 'json': + type = 'application/json, text/javascript'; + break; + case 'html': + type = 'text/html'; + break; + case 'xml': + type = 'application/xml, text/xml'; + break; + } + + if (type !== 'application/x-www-form-urlencoded') { + accept = type + ', */*; q=0.01'; + } + + if (xhr) { + xhr.open('GET', url, true); + xhr.setRequestHeader('Accept', accept); + xhr.onreadystatechange = function () { + if (completed) { + return; + } + + if (xhr.readyState === 4) { + if (xhr.status === 200) { + completed = true; + var data = void 0; + switch (dataType) { + case 'json': + data = JSON.parse(xhr.responseText); + break; + case 'xml': + data = xhr.responseXML; + break; + default: + data = xhr.responseText; + break; + } + success(data); + } else if (typeof error === 'function') { + error(xhr.status); + } + } + }; + + xhr.send(); + } +} + +_mejs2.default.Utils = _mejs2.default.Utils || {}; +_mejs2.default.Utils.offset = offset; +_mejs2.default.Utils.hasClass = hasClass; +_mejs2.default.Utils.addClass = addClass; +_mejs2.default.Utils.removeClass = removeClass; +_mejs2.default.Utils.toggleClass = toggleClass; +_mejs2.default.Utils.fadeIn = fadeIn; +_mejs2.default.Utils.fadeOut = fadeOut; +_mejs2.default.Utils.siblings = siblings; +_mejs2.default.Utils.visible = visible; +_mejs2.default.Utils.ajax = ajax; +_mejs2.default.Utils.loadScript = loadScript; + +},{"2":2,"3":3,"8":8}],26:[function(_dereq_,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.escapeHTML = escapeHTML; +exports.debounce = debounce; +exports.isObjectEmpty = isObjectEmpty; +exports.splitEvents = splitEvents; +exports.createEvent = createEvent; +exports.isNodeAfter = isNodeAfter; +exports.isString = isString; + +var _mejs = _dereq_(8); + +var _mejs2 = _interopRequireDefault(_mejs); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function escapeHTML(input) { + + if (typeof input !== 'string') { + throw new Error('Argument passed must be a string'); + } + + var map = { + '&': '&', + '<': '<', + '>': '>', + '"': '"' + }; + + return input.replace(/[&<>"]/g, function (c) { + return map[c]; + }); +} + +function debounce(func, wait) { + var _this = this, + _arguments = arguments; + + var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + + + if (typeof func !== 'function') { + throw new Error('First argument must be a function'); + } + + if (typeof wait !== 'number') { + throw new Error('Second argument must be a numeric value'); + } + + var timeout = void 0; + return function () { + var context = _this, + args = _arguments; + var later = function later() { + timeout = null; + if (!immediate) { + func.apply(context, args); + } + }; + var callNow = immediate && !timeout; + clearTimeout(timeout); + timeout = setTimeout(later, wait); + + if (callNow) { + func.apply(context, args); + } + }; +} + +function isObjectEmpty(instance) { + return Object.getOwnPropertyNames(instance).length <= 0; +} + +function splitEvents(events, id) { + var rwindow = /^((after|before)print|(before)?unload|hashchange|message|o(ff|n)line|page(hide|show)|popstate|resize|storage)\b/; + + var ret = { d: [], w: [] }; + (events || '').split(' ').forEach(function (v) { + var eventName = '' + v + (id ? '.' + id : ''); + + if (eventName.startsWith('.')) { + ret.d.push(eventName); + ret.w.push(eventName); + } else { + ret[rwindow.test(v) ? 'w' : 'd'].push(eventName); + } + }); + + ret.d = ret.d.join(' '); + ret.w = ret.w.join(' '); + return ret; +} + +function createEvent(eventName, target, isIframe) { + + if (typeof eventName !== 'string') { + throw new Error('Event name must be a string'); + } + + var eventFrags = eventName.match(/([a-z]+\.([a-z]+))/i), + detail = { + target: target, + isIframe: isIframe + }; + + if (eventFrags !== null) { + eventName = eventFrags[1]; + detail.namespace = eventFrags[2]; + } + + return new window.CustomEvent(eventName, { + detail: detail + }); +} + +function isNodeAfter(sourceNode, targetNode) { + + return !!(sourceNode && targetNode && sourceNode.compareDocumentPosition(targetNode) & 2); +} + +function isString(value) { + return typeof value === 'string'; +} + +_mejs2.default.Utils = _mejs2.default.Utils || {}; +_mejs2.default.Utils.escapeHTML = escapeHTML; +_mejs2.default.Utils.debounce = debounce; +_mejs2.default.Utils.isObjectEmpty = isObjectEmpty; +_mejs2.default.Utils.splitEvents = splitEvents; +_mejs2.default.Utils.createEvent = createEvent; +_mejs2.default.Utils.isNodeAfter = isNodeAfter; +_mejs2.default.Utils.isString = isString; + +},{"8":8}],27:[function(_dereq_,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.generateControlButton = generateControlButton; + +var _mejs = _dereq_(8); + +var _mejs2 = _interopRequireDefault(_mejs); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function generateControlButton(playerId, ariaLabel, title, iconSprite, icons, classPrefix) { + var buttonClass = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null; + var ariaDescribedby = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : ''; + var ariaPressed = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : null; + + + if (typeof playerId !== 'string') { + throw new Error('`ariaControls` argument must be a string'); + } + if (typeof ariaLabel !== 'string') { + throw new Error('`ariaLabel` argument must be a string'); + } + if (typeof title !== 'string') { + throw new Error('`title` argument must be a string'); + } + if (typeof iconSprite !== 'string') { + throw new Error('`iconSprite` argument must be a string'); + } + if (typeof ariaDescribedby !== 'string') { + throw new Error('`ariaDescribedby` argument must be a string'); + } + if (!Array.isArray(icons)) { + throw new Error('`icons` argument must be an array'); + } + if (typeof classPrefix !== 'string') { + throw new Error('`classPrefix` argument must be a string'); + } + + var className = buttonClass ? 'class="' + buttonClass + '" ' : ''; + + var ariaDescribedbyAttr = ariaDescribedby !== '' ? 'aria-describedby="' + ariaDescribedby + '" ' : ''; + + var ariaPressedAttr = ariaPressed !== null ? 'aria-pressed="' + ariaPressed + '"' : ''; + + var iconHtml = icons.map(function (icon) { + return '\n'; + }); + + return ''; +} + +_mejs2.default.Utils = _mejs2.default.Utils || {}; +_mejs2.default.Utils.generateControlButton = generateControlButton; + +},{"8":8}],28:[function(_dereq_,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.typeChecks = undefined; +exports.absolutizeUrl = absolutizeUrl; +exports.formatType = formatType; +exports.getMimeFromType = getMimeFromType; +exports.getTypeFromFile = getTypeFromFile; +exports.getExtension = getExtension; +exports.normalizeExtension = normalizeExtension; + +var _mejs = _dereq_(8); + +var _mejs2 = _interopRequireDefault(_mejs); + +var _general = _dereq_(26); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var typeChecks = exports.typeChecks = []; + +function absolutizeUrl(url) { + + if (typeof url !== 'string') { + throw new Error('`url` argument must be a string'); + } + + var el = document.createElement('div'); + el.innerHTML = 'x'; + return el.firstChild.href; +} + +function formatType(url) { + var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + + return url && !type ? getTypeFromFile(url) : type; +} + +function getMimeFromType(type) { + + if (typeof type !== 'string') { + throw new Error('`type` argument must be a string'); + } + + return type && type.indexOf(';') > -1 ? type.substr(0, type.indexOf(';')) : type; +} + +function getTypeFromFile(url) { + + if (typeof url !== 'string') { + throw new Error('`url` argument must be a string'); + } + + for (var i = 0, total = typeChecks.length; i < total; i++) { + var type = typeChecks[i](url); + + if (type) { + return type; + } + } + + var ext = getExtension(url), + normalizedExt = normalizeExtension(ext); + + var mime = 'video/mp4'; + + if (normalizedExt) { + if (~['mp4', 'm4v', 'ogg', 'ogv', 'webm', 'mpeg'].indexOf(normalizedExt)) { + mime = 'video/' + normalizedExt; + } else if ('mov' === normalizedExt) { + mime = 'video/quicktime'; + } else if (~['mp3', 'oga', 'wav', 'mid', 'midi'].indexOf(normalizedExt)) { + mime = 'audio/' + normalizedExt; + } + } + + return mime; +} + +function getExtension(url) { + + if (typeof url !== 'string') { + throw new Error('`url` argument must be a string'); + } + + var baseUrl = url.split('?')[0], + baseName = baseUrl.split('\\').pop().split('/').pop(); + return ~baseName.indexOf('.') ? baseName.substring(baseName.lastIndexOf('.') + 1) : ''; +} + +function normalizeExtension(extension) { + + if (typeof extension !== 'string') { + throw new Error('`extension` argument must be a string'); + } + + switch (extension) { + case 'mp4': + case 'm4v': + return 'mp4'; + case 'webm': + case 'webma': + case 'webmv': + return 'webm'; + case 'ogg': + case 'oga': + case 'ogv': + return 'ogg'; + default: + return extension; + } +} + +_mejs2.default.Utils = _mejs2.default.Utils || {}; +_mejs2.default.Utils.typeChecks = typeChecks; +_mejs2.default.Utils.absolutizeUrl = absolutizeUrl; +_mejs2.default.Utils.formatType = formatType; +_mejs2.default.Utils.getMimeFromType = getMimeFromType; +_mejs2.default.Utils.getTypeFromFile = getTypeFromFile; +_mejs2.default.Utils.getExtension = getExtension; +_mejs2.default.Utils.normalizeExtension = normalizeExtension; + +},{"26":26,"8":8}],29:[function(_dereq_,module,exports){ +'use strict'; + +var _document = _dereq_(2); + +var _document2 = _interopRequireDefault(_document); + +var _promisePolyfill = _dereq_(4); + +var _promisePolyfill2 = _interopRequireDefault(_promisePolyfill); + +var _svg4everybody = _dereq_(5); + +var _svg4everybody2 = _interopRequireDefault(_svg4everybody); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +(function (arr) { + arr.forEach(function (item) { + if (item.hasOwnProperty('remove')) { + return; + } + Object.defineProperty(item, 'remove', { + configurable: true, + enumerable: true, + writable: true, + value: function remove() { + this.parentNode.removeChild(this); + } + }); + }); +})([Element.prototype, CharacterData.prototype, DocumentType.prototype]); + +(function () { + + if (typeof window.CustomEvent === 'function') { + return false; + } + + function CustomEvent(event, params) { + params = params || { bubbles: false, cancelable: false, detail: undefined }; + var evt = _document2.default.createEvent('CustomEvent'); + evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); + return evt; + } + + CustomEvent.prototype = window.Event.prototype; + window.CustomEvent = CustomEvent; +})(); + +if (typeof Object.assign !== 'function') { + Object.assign = function (target) { + + if (target === null || target === undefined) { + throw new TypeError('Cannot convert undefined or null to object'); + } + + var to = Object(target); + + for (var index = 1, total = arguments.length; index < total; index++) { + var nextSource = arguments[index]; + + if (nextSource !== null) { + for (var nextKey in nextSource) { + if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { + to[nextKey] = nextSource[nextKey]; + } + } + } + } + return to; + }; +} + +if (!String.prototype.startsWith) { + String.prototype.startsWith = function (searchString, position) { + position = position || 0; + return this.substr(position, searchString.length) === searchString; + }; +} + +if (!Element.prototype.matches) { + Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector || function (s) { + var matches = (this.document || this.ownerDocument).querySelectorAll(s), + i = matches.length - 1; + while (--i >= 0 && matches.item(i) !== this) {} + return i > -1; + }; +} + +if (window.Element && !Element.prototype.closest) { + Element.prototype.closest = function (s) { + var matches = (this.document || this.ownerDocument).querySelectorAll(s), + i = void 0, + el = this; + do { + i = matches.length; + while (--i >= 0 && matches.item(i) !== el) {} + } while (i < 0 && (el = el.parentElement)); + return el; + }; +} + +(function () { + var lastTime = 0; + var vendors = ['ms', 'moz', 'webkit', 'o']; + for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { + window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']; + window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame']; + } + + if (!window.requestAnimationFrame) window.requestAnimationFrame = function (callback) { + var currTime = new Date().getTime(); + var timeToCall = Math.max(0, 16 - (currTime - lastTime)); + var id = window.setTimeout(function () { + callback(currTime + timeToCall); + }, timeToCall); + lastTime = currTime + timeToCall; + return id; + }; + + if (!window.cancelAnimationFrame) window.cancelAnimationFrame = function (id) { + clearTimeout(id); + }; +})(); + +if (/firefox/i.test(navigator.userAgent)) { + var getComputedStyle = window.getComputedStyle; + window.getComputedStyle = function (el, pseudoEl) { + var t = getComputedStyle(el, pseudoEl); + return t === null ? { getPropertyValue: function getPropertyValue() {} } : t; + }; +} + +if (!window.Promise) { + window.Promise = _promisePolyfill2.default; +} + +(0, _svg4everybody2.default)(); + +(function (constructor) { + if (constructor && constructor.prototype && constructor.prototype.children === null) { + Object.defineProperty(constructor.prototype, 'children', { + get: function get() { + var i = 0, + node = void 0, + nodes = this.childNodes, + children = []; + while (node = nodes[i++]) { + if (node.nodeType === 1) { + children.push(node); + } + } + return children; + } + }); + } +})(window.Node || window.Element); + +},{"2":2,"4":4,"5":5}],30:[function(_dereq_,module,exports){ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isDropFrame = isDropFrame; +exports.secondsToTimeCode = secondsToTimeCode; +exports.timeCodeToSeconds = timeCodeToSeconds; +exports.calculateTimeFormat = calculateTimeFormat; +exports.convertSMPTEtoSeconds = convertSMPTEtoSeconds; + +var _mejs = _dereq_(8); + +var _mejs2 = _interopRequireDefault(_mejs); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function isDropFrame() { + var fps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 25; + + return !(fps % 1 === 0); +} +function secondsToTimeCode(time) { + var forceHours = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + var showFrameCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var fps = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 25; + var secondsDecimalLength = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; + var timeFormat = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'hh:mm:ss'; + + + time = !time || typeof time !== 'number' || time < 0 ? 0 : time; + + var dropFrames = Math.round(fps * 0.066666), + timeBase = Math.round(fps), + framesPer24Hours = Math.round(fps * 3600) * 24, + framesPer10Minutes = Math.round(fps * 600), + frameSep = isDropFrame(fps) ? ';' : ':', + hours = void 0, + minutes = void 0, + seconds = void 0, + frames = void 0, + f = Math.round(time * fps); + + if (isDropFrame(fps)) { + + if (f < 0) { + f = framesPer24Hours + f; + } + + f = f % framesPer24Hours; + + var d = Math.floor(f / framesPer10Minutes); + var m = f % framesPer10Minutes; + f = f + dropFrames * 9 * d; + if (m > dropFrames) { + f = f + dropFrames * Math.floor((m - dropFrames) / Math.round(timeBase * 60 - dropFrames)); + } + + var timeBaseDivision = Math.floor(f / timeBase); + + hours = Math.floor(Math.floor(timeBaseDivision / 60) / 60); + minutes = Math.floor(timeBaseDivision / 60) % 60; + + if (showFrameCount) { + seconds = timeBaseDivision % 60; + } else { + seconds = Math.floor(f / timeBase % 60).toFixed(secondsDecimalLength); + } + } else { + hours = Math.floor(time / 3600) % 24; + minutes = Math.floor(time / 60) % 60; + if (showFrameCount) { + seconds = Math.floor(time % 60); + } else { + seconds = Math.floor(time % 60).toFixed(secondsDecimalLength); + } + } + hours = hours <= 0 ? 0 : hours; + minutes = minutes <= 0 ? 0 : minutes; + seconds = seconds <= 0 ? 0 : seconds; + + seconds = seconds === 60 ? 0 : seconds; + minutes = minutes === 60 ? 0 : minutes; + + var timeFormatFrags = timeFormat.split(':'); + var timeFormatSettings = {}; + for (var i = 0, total = timeFormatFrags.length; i < total; ++i) { + var unique = ''; + for (var j = 0, t = timeFormatFrags[i].length; j < t; j++) { + if (unique.indexOf(timeFormatFrags[i][j]) < 0) { + unique += timeFormatFrags[i][j]; + } + } + if (~['f', 's', 'm', 'h'].indexOf(unique)) { + timeFormatSettings[unique] = timeFormatFrags[i].length; + } + } + + var result = forceHours || hours > 0 ? (hours < 10 && timeFormatSettings.h > 1 ? '0' + hours : hours) + ':' : ''; + result += (minutes < 10 && timeFormatSettings.m > 1 ? '0' + minutes : minutes) + ':'; + result += '' + (seconds < 10 && timeFormatSettings.s > 1 ? '0' + seconds : seconds); + + if (showFrameCount) { + frames = (f % timeBase).toFixed(0); + frames = frames <= 0 ? 0 : frames; + result += frames < 10 && timeFormatSettings.f ? frameSep + '0' + frames : '' + frameSep + frames; + } + + return result; +} + +function timeCodeToSeconds(time) { + var fps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 25; + + + if (typeof time !== 'string') { + throw new TypeError('Time must be a string'); + } + + if (time.indexOf(';') > 0) { + time = time.replace(';', ':'); + } + + if (!/\d{2}(\:\d{2}){0,3}/i.test(time)) { + throw new TypeError('Time code must have the format `00:00:00`'); + } + + var parts = time.split(':'); + + var output = void 0, + hours = 0, + minutes = 0, + seconds = 0, + frames = 0, + totalMinutes = 0, + dropFrames = Math.round(fps * 0.066666), + timeBase = Math.round(fps), + hFrames = timeBase * 3600, + mFrames = timeBase * 60; + + switch (parts.length) { + default: + case 1: + seconds = parseInt(parts[0], 10); + break; + case 2: + minutes = parseInt(parts[0], 10); + seconds = parseInt(parts[1], 10); + break; + case 3: + hours = parseInt(parts[0], 10); + minutes = parseInt(parts[1], 10); + seconds = parseInt(parts[2], 10); + break; + case 4: + hours = parseInt(parts[0], 10); + minutes = parseInt(parts[1], 10); + seconds = parseInt(parts[2], 10); + frames = parseInt(parts[3], 10); + break; + } + + if (isDropFrame(fps)) { + totalMinutes = 60 * hours + minutes; + output = hFrames * hours + mFrames * minutes + timeBase * seconds + frames - dropFrames * (totalMinutes - Math.floor(totalMinutes / 10)); + } else { + output = (hFrames * hours + mFrames * minutes + fps * seconds + frames) / fps; + } + + return parseFloat(output.toFixed(3)); +} + +function calculateTimeFormat(time, options) { + var fps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 25; + + + time = !time || typeof time !== 'number' || time < 0 ? 0 : time; + + var hours = Math.floor(time / 3600) % 24, + minutes = Math.floor(time / 60) % 60, + seconds = Math.floor(time % 60), + frames = Math.floor((time % 1 * fps).toFixed(3)), + lis = [[frames, 'f'], [seconds, 's'], [minutes, 'm'], [hours, 'h']]; + + var format = options.timeFormat, + firstTwoPlaces = format[1] === format[0], + separatorIndex = firstTwoPlaces ? 2 : 1, + separator = format.length < separatorIndex ? format[separatorIndex] : ':', + firstChar = format[0], + required = false; + + for (var i = 0, len = lis.length; i < len; i++) { + if (~format.indexOf(lis[i][1])) { + required = true; + } else if (required) { + var hasNextValue = false; + for (var j = i; j < len; j++) { + if (lis[j][0] > 0) { + hasNextValue = true; + break; + } + } + + if (!hasNextValue) { + break; + } + + if (!firstTwoPlaces) { + format = firstChar + format; + } + format = lis[i][1] + separator + format; + if (firstTwoPlaces) { + format = lis[i][1] + format; + } + firstChar = lis[i][1]; + } + } + + options.timeFormat = format; +} + +function convertSMPTEtoSeconds(SMPTE) { + + if (typeof SMPTE !== 'string') { + throw new TypeError('Argument must be a string value'); + } + + SMPTE = SMPTE.replace(',', '.'); + + var decimalLen = ~SMPTE.indexOf('.') ? SMPTE.split('.')[1].length : 0; + + var secs = 0, + multiplier = 1; + + SMPTE = SMPTE.split(':').reverse(); + + for (var i = 0, total = SMPTE.length; i < total; i++) { + multiplier = 1; + if (i > 0) { + multiplier = Math.pow(60, i); + } + secs += Number(SMPTE[i]) * multiplier; + } + return Number(secs.toFixed(decimalLen)); +} + +_mejs2.default.Utils = _mejs2.default.Utils || {}; +_mejs2.default.Utils.secondsToTimeCode = secondsToTimeCode; +_mejs2.default.Utils.timeCodeToSeconds = timeCodeToSeconds; +_mejs2.default.Utils.calculateTimeFormat = calculateTimeFormat; +_mejs2.default.Utils.convertSMPTEtoSeconds = convertSMPTEtoSeconds; + +},{"8":8}]},{},[29,7,6,16,22,20,21,23,17,19,18,10,11,12,13,14,15]); +/*! + * MediaElement.js + * http://www.mediaelementjs.com/ + * + * Wrapper that mimics native HTML5 MediaElement (audio and video) + * using a variety of technologies (pure JavaScript, Flash, iframe) + * + * Copyright 2010-2017, John Dyer (http://j.hn/) + * License: MIT + * + */(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i'; + } + + currentItem.innerHTML += '

    ' + (player.options.currentMessage || '') + ' ' + player.playlist[player.currentPlaylistItem].title + ''; + if (typeof player.playlist[player.currentPlaylistItem].description !== 'undefined') { + currentItem.innerHTML += ' - ' + player.playlist[player.currentPlaylistItem].description + ''; + } + currentItem.innerHTML += '

    '; + player.resetSize(); + }; + currentItem.className = player.options.classPrefix + 'playlist-current ' + player.options.classPrefix + 'layer'; + audioCallback(); + layers.insertBefore(currentItem, layers.firstChild); + media.addEventListener('play', audioCallback); + } + + if (player.options.showPlaylist) { + player.playlistLayer = document.createElement('div'); + player.playlistLayer.className = player.options.classPrefix + 'playlist-layer ' + player.options.classPrefix + 'layer ' + (player.isVideo ? player.options.classPrefix + 'playlist-hidden' : '') + ' ' + player.options.classPrefix + 'playlist-selector'; + player.playlistLayer.innerHTML = '
      '; + layers.insertBefore(player.playlistLayer, layers.firstChild); + + for (var i = 0, total = player.listItems.length; i < total; i++) { + player.playlistLayer.querySelector('ul').innerHTML += player.listItems[i]; + } + + if (player.isVideo) { + player.playlistButton = document.createElement('div'); + player.playlistButton.className = player.options.classPrefix + 'button ' + player.options.classPrefix + 'playlist-button'; + player.playlistButton.innerHTML = ''; + player.playlistButton.addEventListener('click', function () { + mejs.Utils.toggleClass(player.playlistLayer, player.options.classPrefix + 'playlist-hidden'); + }); + player.addControlElement(player.playlistButton, 'playlist'); + } else { + var _items = player.playlistLayer.querySelectorAll('li'); + + if (_items.length <= 10) { + var height = 0; + for (var _i = 0, _total = _items.length; _i < _total; _i++) { + height += _items[_i].offsetHeight; + } + player.container.style.height = height + 'px'; + } + } + + var items = player.playlistLayer.querySelectorAll('.' + player.options.classPrefix + 'playlist-selector-list-item'), + inputs = player.playlistLayer.querySelectorAll('input[type=radio]'); + + for (var _i2 = 0, _total2 = inputs.length; _i2 < _total2; _i2++) { + inputs[_i2].disabled = false; + inputs[_i2].addEventListener('click', function () { + var radios = player.playlistLayer.querySelectorAll('input[type="radio"]'), + selected = player.playlistLayer.querySelectorAll('.' + player.options.classPrefix + 'playlist-selected'); + + for (var j = 0, total2 = radios.length; j < total2; j++) { + radios[j].checked = false; + } + for (var _j = 0, _total3 = selected.length; _j < _total3; _j++) { + mejs.Utils.removeClass(selected[_j], player.options.classPrefix + 'playlist-selected'); + selected[_j].querySelector('label').querySelector('span').remove(); + } + + this.checked = true; + this.closest('.' + player.options.classPrefix + 'playlist-selector-list-item').querySelector('label').innerHTML = '\u25B6 ' + this.closest('.' + player.options.classPrefix + 'playlist-selector-list-item').querySelector('label').innerHTML; + mejs.Utils.addClass(this.closest('.' + player.options.classPrefix + 'playlist-selector-list-item'), player.options.classPrefix + 'playlist-selected'); + player.currentPlaylistItem = this.getAttribute('data-playlist-index'); + player.setSrc(this.value); + player.load(); + player.play(); + + if (player.isVideo && player.options.autoClosePlaylist === true) { + mejs.Utils.toggleClass(player.playlistLayer, player.options.classPrefix + 'playlist-hidden'); + } + }); + } + + for (var _i3 = 0, _total4 = items.length; _i3 < _total4; _i3++) { + items[_i3].addEventListener('click', function () { + var radio = mejs.Utils.siblings(this.querySelector('.' + player.options.classPrefix + 'playlist-selector-label'), function (el) { + return el.tagName === 'INPUT'; + })[0], + event = mejs.Utils.createEvent('click', radio); + radio.dispatchEvent(event); + }); + } + + player.keydownCallback = function (e) { + var event = mejs.Utils.createEvent('click', e.target); + e.target.dispatchEvent(event); + return false; + }; + + player.playlistLayer.addEventListener('keydown', function (e) { + var keyCode = e.which || e.keyCode || 0; + if (~[13, 32, 38, 40].indexOf(keyCode)) { + player.keydownCallback(e); + } + }); + } else { + mejs.Utils.addClass(player.container, player.options.classPrefix + 'no-playlist'); + } + }, + cleanplaylist: function cleanplaylist(player, controls, layers, media) { + media.removeEventListener('ended', player.endedCallback); + }, + buildprevtrack: function buildprevtrack(player) { + + var defaultPrevTitle = mejs.i18n.t('mejs.playlist-prev'), + prevTitle = mejs.Utils.isString(player.options.prevText) ? player.options.prevText : defaultPrevTitle; + player.prevButton = document.createElement('div'); + player.prevButton.className = player.options.classPrefix + 'button ' + player.options.classPrefix + 'prev-button'; + player.prevButton.innerHTML = ''; + + player.prevPlaylistCallback = function () { + if (player.playlist[--player.currentPlaylistItem]) { + player.setSrc(player.playlist[player.currentPlaylistItem].src); + player.load(); + player.play(); + } else { + ++player.currentPlaylistItem; + } + }; + + player.prevButton.addEventListener('click', player.prevPlaylistCallback); + player.addControlElement(player.prevButton, 'prevtrack'); + }, + cleanprevtrack: function cleanprevtrack(player) { + player.prevButton.removeEventListener('click', player.prevPlaylistCallback); + }, + buildnexttrack: function buildnexttrack(player) { + var defaultNextTitle = mejs.i18n.t('mejs.playlist-next'), + nextTitle = mejs.Utils.isString(player.options.nextText) ? player.options.nextText : defaultNextTitle; + player.nextButton = document.createElement('div'); + player.nextButton.className = player.options.classPrefix + 'button ' + player.options.classPrefix + 'next-button'; + player.nextButton.innerHTML = ''; + + player.nextPlaylistCallback = function () { + if (player.playlist[++player.currentPlaylistItem]) { + player.setSrc(player.playlist[player.currentPlaylistItem].src); + player.load(); + player.play(); + } else { + --player.currentPlaylistItem; + } + }; + + player.nextButton.addEventListener('click', player.nextPlaylistCallback); + player.addControlElement(player.nextButton, 'nexttrack'); + }, + cleannexttrack: function cleannexttrack(player) { + player.nextButton.removeEventListener('click', player.nextPlaylistCallback); + }, + buildloop: function buildloop(player) { + var defaultLoopTitle = mejs.i18n.t('mejs.playlist-loop'), + loopTitle = mejs.Utils.isString(player.options.loopText) ? player.options.loopText : defaultLoopTitle; + + player.loopButton = document.createElement('div'); + player.loopButton.className = player.options.classPrefix + 'button ' + player.options.classPrefix + 'loop-button ' + (player.options.loop ? player.options.classPrefix + 'loop-on' : player.options.classPrefix + 'loop-off'); + player.loopButton.innerHTML = ''; + player.loopCallback = function () { + player.options.loop = !player.options.loop; + if (player.options.loop) { + mejs.Utils.removeClass(player.loopButton, player.options.classPrefix + 'loop-off'); + mejs.Utils.addClass(player.loopButton, player.options.classPrefix + 'loop-on'); + } else { + mejs.Utils.removeClass(player.loopButton, player.options.classPrefix + 'loop-on'); + mejs.Utils.addClass(player.loopButton, player.options.classPrefix + 'loop-off'); + } + }; + + player.loopButton.addEventListener('click', player.loopCallback); + player.addControlElement(player.loopButton, 'loop'); + }, + cleanloop: function cleanloop(player) { + player.loopButton.removeEventListener('click', player.loopCallback); + }, + buildshuffle: function buildshuffle(player) { + var defaultShuffleTitle = mejs.i18n.t('mejs.playlist-shuffle'), + shuffleTitle = mejs.Utils.isString(player.options.shuffleText) ? player.options.shuffleText : defaultShuffleTitle; + player.shuffleButton = document.createElement('div'); + player.shuffleButton.className = player.options.classPrefix + 'button ' + player.options.classPrefix + 'shuffle-button ' + player.options.classPrefix + 'shuffle-off'; + player.shuffleButton.innerHTML = ''; + player.shuffleButton.style.display = 'none'; + player.media.addEventListener('play', function () { + player.shuffleButton.style.display = ''; + player.resetSize(); + }); + + var enabled = false, + playedItems = []; + var randomizeCallback = function randomizeCallback() { + if (!player.options.loop) { + var randomItem = Math.floor(Math.random() * player.playlist.length); + if (playedItems.indexOf(randomItem) === -1) { + player.setSrc(player.playlist[randomItem].src); + player.load(); + player.play(); + player.currentPlaylistItem = randomItem; + playedItems.push(randomItem); + } else if (playedItems.length < player.playlist.length) { + player.shuffleCallback(); + } else if (playedItems.length < player.playlist.length) { + playedItems = []; + player.currentPlaylistItem = randomItem; + playedItems.push(randomItem); + } + } + }; + + player.shuffleCallback = function () { + if (!enabled) { + mejs.Utils.removeClass(player.shuffleButton, player.options.classPrefix + 'shuffle-off'); + mejs.Utils.addClass(player.shuffleButton, player.options.classPrefix + 'shuffle-on'); + enabled = true; + player.media.addEventListener('ended', randomizeCallback); + } else { + mejs.Utils.removeClass(player.shuffleButton, player.options.classPrefix + 'shuffle-on'); + mejs.Utils.addClass(player.shuffleButton, player.options.classPrefix + 'shuffle-off'); + enabled = false; + player.media.removeEventListener('ended', randomizeCallback); + } + }; + + player.shuffleButton.addEventListener('click', player.shuffleCallback); + player.addControlElement(player.shuffleButton, 'shuffle'); + }, + cleanshuffle: function cleanshuffle(player) { + player.shuffleButton.removeEventListener('click', player.shuffleCallback); + }, + createPlayList_: function createPlayList_() { + var t = this; + + t.playlist = t.options.playlist.length ? t.options.playlist : t.mediaFiles && t.mediaFiles.length ? t.mediaFiles : []; + + if (!t.playlist.length) { + var children = t.media.originalNode.children; + + for (var i = 0, total = children.length; i < total; i++) { + var childNode = children[i]; + + if (childNode.tagName.toLowerCase() === 'source') { + (function () { + var elements = {}; + Array.prototype.slice.call(childNode.attributes).forEach(function (item) { + elements[item.name] = item.value; + }); + + if (elements.src && elements.type && elements.title) { + elements.type = mejs.Utils.formatType(elements.src, elements.type); + t.playlist.push(elements); + } + })(); + } + } + } + + if (t.playlist.length < 2) { + return; + } + + t.listItems = []; + for (var _i4 = 0, _total5 = t.playlist.length; _i4 < _total5; _i4++) { + var element = t.playlist[_i4], + item = document.createElement('li'), + id = t.id + '_playlist_item_' + _i4, + thumbnail = element['data-playlist-thumbnail'] ? '
      ' : '', + description = element['data-playlist-description'] ? '
      ' + element['data-playlist-description'] + '
      ' : ''; + item.tabIndex = 0; + item.className = t.options.classPrefix + 'playlist-selector-list-item' + (_i4 === 0 ? ' ' + t.options.classPrefix + 'playlist-selected' : ''); + item.innerHTML = '
      ' + ('' + thumbnail) + ('
      ') + ('
      ') + ('
      ' + description + '
      '); + + t.listItems.push(item.outerHTML); + } + } +}); + +},{}]},{},[1]); +function A(h,g,b){var e=g||0,c=0;"string"==typeof h?(c=b||h.length,this.a=function(a){return h.charCodeAt(a+e)&255}):"unknown"==typeof h&&(c=b||IEBinary_getLength(h),this.a=function(a){return IEBinary_getByteAt(h,a+e)});this.l=function(a,f){for(var v=Array(f),b=0;ba&&(a+=65536);return a};this.i=function(a){var f=this.a(a),b=this.a(a+1),c= +this.a(a+2);a=this.a(a+3);f=(((f<<8)+b<<8)+c<<8)+a;0>f&&(f+=4294967296);return f};this.o=function(a){var f=this.a(a),b=this.a(a+1);a=this.a(a+2);f=((f<<8)+b<<8)+a;0>f&&(f+=16777216);return f};this.c=function(a,f){for(var b=[],c=a,d=0;cg||224<=g?b[m]=String.fromCharCode(l):(g=(a[d+e]<<8)+a[d+c],d+=2,b[m]=String.fromCharCode(l,g))}a=new String(b.join(""));a.g=d;break;case "utf-8":k=0;d=Math.min(d||a.length,a.length);239==a[0]&&187==a[1]&&191==a[2]&&(k=3);e=[];for(c=0;kb?e[c]=String.fromCharCode(b):194<=b&&224>b?(m=a[k++],e[c]=String.fromCharCode(((b&31)<<6)+(m&63))):224<=b&&240> +b?(m=a[k++],l=a[k++],e[c]=String.fromCharCode(((b&255)<<12)+((m&63)<<6)+(l&63))):240<=b&&245>b&&(m=a[k++],l=a[k++],g=a[k++],b=((b&7)<<18)+((m&63)<<12)+((l&63)<<6)+(g&63)-65536,e[c]=String.fromCharCode((b>>10)+55296,(b&1023)+56320));a=new String(e.join(""));a.g=k;break;default:d=[];e=e||a.length;for(k=0;k\r\nFunction IEBinary_getByteAt(strBinary, iOffset)\r\n\tIEBinary_getByteAt = AscB(MidB(strBinary,iOffset+1,1))\r\nEnd Function\r\nFunction IEBinary_getLength(strBinary)\r\n\tIEBinary_getLength = LenB(strBinary)\r\nEnd Function\r\n\x3c/script>\r\n");function B(h,g,b){function e(a,b,d,e,f,g){var l=c();l?("undefined"===typeof g&&(g=!0),b&&("undefined"!=typeof l.onload?l.onload=function(){"200"==l.status||"206"==l.status?(l.fileSize=f||l.getResponseHeader("Content-Length"),b(l)):d&&d();l=null}:l.onreadystatechange=function(){4==l.readyState&&("200"==l.status||"206"==l.status?(l.fileSize=f||l.getResponseHeader("Content-Length"),b(l)):d&&d(),l=null)}),l.open("GET",a,g),l.overrideMimeType&&l.overrideMimeType("text/plain; charset=x-user-defined"),e&& +l.setRequestHeader("Range","bytes="+e[0]+"-"+e[1]),l.setRequestHeader("If-Modified-Since","Sat, 1 Jan 1970 00:00:00 GMT"),l.send(null)):d&&d()}function c(){var a=null;window.XMLHttpRequest?a=new XMLHttpRequest:window.ActiveXObject&&(a=new ActiveXObject("Microsoft.XMLHTTP"));return a}function a(a,b){var d=c();d&&(b&&("undefined"!=typeof d.onload?d.onload=function(){"200"==d.status&&b(this);d=null}:d.onreadystatechange=function(){4==d.readyState&&("200"==d.status&&b(this),d=null)}),d.open("HEAD",a, +!0),d.send(null))}function f(a,c){var d,f;function g(a){var b=~~(a[0]/d)-f;a=~~(a[1]/d)+1+f;0>b&&(b=0);a>=blockTotal&&(a=blockTotal-1);return[b,a]}function h(f,g){for(;n[f[0]];)if(f[0]++,f[0]>f[1]){g&&g();return}for(;n[f[1]];)if(f[1]--,f[0]>f[1]){g&&g();return}var m=[f[0]*d,(f[1]+1)*d-1];e(a,function(a){parseInt(a.getResponseHeader("Content-Length"),10)==c&&(f[0]=0,f[1]=blockTotal-1,m[0]=0,m[1]=c-1);a={data:a.N||a.responseText,offset:m[0]};for(var b=f[0];b<=f[1];b++)n[b]=a;g&&g()},b,m,l,!!g)}var l, +r=new A("",0,c),n=[];d=d||2048;f="undefined"===typeof f?0:f;blockTotal=~~((c-1)/d)+1;for(var q in r)r.hasOwnProperty(q)&&"function"===typeof r[q]&&(this[q]=r[q]);this.a=function(a){var b;h(g([a,a]));b=n[~~(a/d)];if("string"==typeof b.data)return b.data.charCodeAt(a-b.offset)&255;if("unknown"==typeof b.data)return IEBinary_getByteAt(b.data,a-b.offset)};this.f=function(a,b){h(g(a),b)}}(function(){a(h,function(a){a=parseInt(a.getResponseHeader("Content-Length"),10)||-1;g(new f(h,a))})})()};(function(h){h.FileAPIReader=function(g,b){return function(e,c){var a=b||new FileReader;a.onload=function(a){c(new A(a.target.result))};a.readAsBinaryString(g)}}})(this);(function(h){var g=h.p={},b={},e=[0,7];g.t=function(c){delete b[c]};g.s=function(){b={}};g.B=function(c,a,f){f=f||{};(f.dataReader||B)(c,function(g){g.f(e,function(){var e="ftypM4A"==g.c(4,7)?ID4:"ID3"==g.c(0,3)?ID3v2:ID3v1;e.m(g,function(){var d=f.tags,h=e.n(g,d),d=b[c]||{},m;for(m in h)h.hasOwnProperty(m)&&(d[m]=h[m]);b[c]=d;a&&a()})})})};g.v=function(c){if(!b[c])return null;var a={},f;for(f in b[c])b[c].hasOwnProperty(f)&&(a[f]=b[c][f]);return a};g.A=function(c,a){return b[c]?b[c][a]:null};h.ID3= +h.p;g.loadTags=g.B;g.getAllTags=g.v;g.getTag=g.A;g.clearTags=g.t;g.clearAll=g.s})(this);(function(h){var g=h.q={},b="Blues;Classic Rock;Country;Dance;Disco;Funk;Grunge;Hip-Hop;Jazz;Metal;New Age;Oldies;Other;Pop;R&B;Rap;Reggae;Rock;Techno;Industrial;Alternative;Ska;Death Metal;Pranks;Soundtrack;Euro-Techno;Ambient;Trip-Hop;Vocal;Jazz+Funk;Fusion;Trance;Classical;Instrumental;Acid;House;Game;Sound Clip;Gospel;Noise;AlternRock;Bass;Soul;Punk;Space;Meditative;Instrumental Pop;Instrumental Rock;Ethnic;Gothic;Darkwave;Techno-Industrial;Electronic;Pop-Folk;Eurodance;Dream;Southern Rock;Comedy;Cult;Gangsta;Top 40;Christian Rap;Pop/Funk;Jungle;Native American;Cabaret;New Wave;Psychadelic;Rave;Showtunes;Trailer;Lo-Fi;Tribal;Acid Punk;Acid Jazz;Polka;Retro;Musical;Rock & Roll;Hard Rock;Folk;Folk-Rock;National Folk;Swing;Fast Fusion;Bebob;Latin;Revival;Celtic;Bluegrass;Avantgarde;Gothic Rock;Progressive Rock;Psychedelic Rock;Symphonic Rock;Slow Rock;Big Band;Chorus;Easy Listening;Acoustic;Humour;Speech;Chanson;Opera;Chamber Music;Sonata;Symphony;Booty Bass;Primus;Porn Groove;Satire;Slow Jam;Club;Tango;Samba;Folklore;Ballad;Power Ballad;Rhythmic Soul;Freestyle;Duet;Punk Rock;Drum Solo;Acapella;Euro-House;Dance Hall".split(";"); +g.m=function(b,c){var a=b.h();b.f([a-128-1,a],c)};g.n=function(e){var c=e.h()-128;if("TAG"==e.c(c,3)){var a=e.c(c+3,30).replace(/\0/g,""),f=e.c(c+33,30).replace(/\0/g,""),g=e.c(c+63,30).replace(/\0/g,""),k=e.c(c+93,4).replace(/\0/g,"");if(0==e.a(c+97+28))var d=e.c(c+97,28).replace(/\0/g,""),h=e.a(c+97+29);else d="",h=0;e=e.a(c+97+30);return{version:"1.1",title:a,artist:f,album:g,year:k,comment:d,track:h,genre:255>e?b[e]:""}}return{}};h.ID3v1=h.q})(this);(function(h){function g(a,b){var c=b.a(a),e=b.a(a+1),d=b.a(a+2);return b.a(a+3)&127|(d&127)<<7|(e&127)<<14|(c&127)<<21}var b=h.D={};b.b={};b.frames={BUF:"Recommended buffer size",CNT:"Play counter",COM:"Comments",CRA:"Audio encryption",CRM:"Encrypted meta frame",ETC:"Event timing codes",EQU:"Equalization",GEO:"General encapsulated object",IPL:"Involved people list",LNK:"Linked information",MCI:"Music CD Identifier",MLL:"MPEG location lookup table",PIC:"Attached picture",POP:"Popularimeter",REV:"Reverb", +RVA:"Relative volume adjustment",SLT:"Synchronized lyric/text",STC:"Synced tempo codes",TAL:"Album/Movie/Show title",TBP:"BPM (Beats Per Minute)",TCM:"Composer",TCO:"Content type",TCR:"Copyright message",TDA:"Date",TDY:"Playlist delay",TEN:"Encoded by",TFT:"File type",TIM:"Time",TKE:"Initial key",TLA:"Language(s)",TLE:"Length",TMT:"Media type",TOA:"Original artist(s)/performer(s)",TOF:"Original filename",TOL:"Original Lyricist(s)/text writer(s)",TOR:"Original release year",TOT:"Original album/Movie/Show title", +TP1:"Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group",TP2:"Band/Orchestra/Accompaniment",TP3:"Conductor/Performer refinement",TP4:"Interpreted, remixed, or otherwise modified by",TPA:"Part of a set",TPB:"Publisher",TRC:"ISRC (International Standard Recording Code)",TRD:"Recording dates",TRK:"Track number/Position in set",TSI:"Size",TSS:"Software/hardware and settings used for encoding",TT1:"Content group description",TT2:"Title/Songname/Content description",TT3:"Subtitle/Description refinement", +TXT:"Lyricist/text writer",TXX:"User defined text information frame",TYE:"Year",UFI:"Unique file identifier",ULT:"Unsychronized lyric/text transcription",WAF:"Official audio file webpage",WAR:"Official artist/performer webpage",WAS:"Official audio source webpage",WCM:"Commercial information",WCP:"Copyright/Legal information",WPB:"Publishers official webpage",WXX:"User defined URL link frame",AENC:"Audio encryption",APIC:"Attached picture",COMM:"Comments",COMR:"Commercial frame",ENCR:"Encryption method registration", +EQUA:"Equalization",ETCO:"Event timing codes",GEOB:"General encapsulated object",GRID:"Group identification registration",IPLS:"Involved people list",LINK:"Linked information",MCDI:"Music CD identifier",MLLT:"MPEG location lookup table",OWNE:"Ownership frame",PRIV:"Private frame",PCNT:"Play counter",POPM:"Popularimeter",POSS:"Position synchronisation frame",RBUF:"Recommended buffer size",RVAD:"Relative volume adjustment",RVRB:"Reverb",SYLT:"Synchronized lyric/text",SYTC:"Synchronized tempo codes", +TALB:"Album/Movie/Show title",TBPM:"BPM (beats per minute)",TCOM:"Composer",TCON:"Content type",TCOP:"Copyright message",TDAT:"Date",TDLY:"Playlist delay",TENC:"Encoded by",TEXT:"Lyricist/Text writer",TFLT:"File type",TIME:"Time",TIT1:"Content group description",TIT2:"Title/songname/content description",TIT3:"Subtitle/Description refinement",TKEY:"Initial key",TLAN:"Language(s)",TLEN:"Length",TMED:"Media type",TOAL:"Original album/movie/show title",TOFN:"Original filename",TOLY:"Original lyricist(s)/text writer(s)", +TOPE:"Original artist(s)/performer(s)",TORY:"Original release year",TOWN:"File owner/licensee",TPE1:"Lead performer(s)/Soloist(s)",TPE2:"Band/orchestra/accompaniment",TPE3:"Conductor/performer refinement",TPE4:"Interpreted, remixed, or otherwise modified by",TPOS:"Part of a set",TPUB:"Publisher",TRCK:"Track number/Position in set",TRDA:"Recording dates",TRSN:"Internet radio station name",TRSO:"Internet radio station owner",TSIZ:"Size",TSRC:"ISRC (international standard recording code)",TSSE:"Software/Hardware and settings used for encoding", +TYER:"Year",TXXX:"User defined text information frame",UFID:"Unique file identifier",USER:"Terms of use",USLT:"Unsychronized lyric/text transcription",WCOM:"Commercial information",WCOP:"Copyright/Legal information",WOAF:"Official audio file webpage",WOAR:"Official artist/performer webpage",WOAS:"Official audio source webpage",WORS:"Official internet radio station homepage",WPAY:"Payment",WPUB:"Publishers official webpage",WXXX:"User defined URL link frame"};var e={title:["TIT2","TT2"],artist:["TPE1", +"TP1"],album:["TALB","TAL"],year:["TYER","TYE"],comment:["COMM","COM"],track:["TRCK","TRK"],genre:["TCON","TCO"],picture:["APIC","PIC"],lyrics:["USLT","ULT"]},c=["title","artist","album","track"];b.m=function(a,b){a.f([0,g(6,a)],b)};b.n=function(a,f){var h=0,k=a.a(h+3);if(42.4"};var d=a.a(h+4),t=a.d(h+5,7),m=a.d(h+5,6),u=a.d(h+5,5),l=g(h+6,a),h=h+10;if(m)var r=a.i(h),h=h+(r+4);var k={version:"2."+k+"."+d,major:k,revision:d,flags:{unsynchronisation:t,extended_header:m,experimental_indicator:u}, +size:l},n;if(t)n={};else{for(var l=l-10,t=a,d=f,m={},u=k.major,r=[],q=0,p;p=(d||c)[q];q++)r=r.concat(e[p]||[p]);for(d=r;hd.indexOf(n)||(2 + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, + * modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY + * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE + * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS + * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT + * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH + * THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE */ + +var MyPlayer = function(_args) { + var failed = false; + var detached = false; + var player = null; + + var defaultArgs = { + detachable: true, + element: 'body', + id3: false, + mode: 'mp3url', + waveform: false, + autoplay: false, + loop: true, + shuffle: false, + list: [] + }; + + var mimeTypeFromSrc = function(src) { + var extension = src.split('.').pop().toLowerCase(); + + return { + "aac": "audio/aac", + "abw": "application/x-abiword", + "arc": "application/x-freearc", + "avi": "video/x-msvideo", + "azw": "application/vnd.amazon.ebook", + "bin": "application/octet-stream", + "bmp": "image/bmp", + "bz": "application/x-bzip", + "bz2": "application/x-bzip2", + "cda": "application/x-cdf", + "csh": "application/x-csh", + "css": "text/css", + "csv": "text/csv", + "doc": "application/msword", + "docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + "eot": "application/vnd.ms-fontobject", + "epub": "application/epub+zip", + "gz": "application/gzip", + "gif": "image/gif", + "htm": "text/html", + "html": "text/html", + "ico": "image/vnd.microsoft.icon", + "ics": "text/calendar", + "jar": "application/java-archive", + "jpeg": "image/jpeg", + "jpg": "image/jpeg", + "js": "text/javascript", + "json": "application/json", + "jsonld": "application/ld+json", + "mid": "audio/midi audio/x-midi", + "midi": "audio/midi audio/x-midi", + "mjs": "text/javascript", + "mp3": "audio/mpeg", + "mp4": "video/mp4", + "mpeg": "video/mpeg", + "mpkg": "application/vnd.apple.installer+xml", + "odp": "application/vnd.oasis.opendocument.presentation", + "ods": "application/vnd.oasis.opendocument.spreadsheet", + "odt": "application/vnd.oasis.opendocument.text", + "oga": "audio/ogg", + "ogv": "video/ogg", + "ogx": "application/ogg", + "opus": "audio/opus", + "otf": "font/otf", + "png": "image/png", + "pdf": "application/pdf", + "php": "application/x-httpd-php", + "ppt": "application/vnd.ms-powerpoint", + "pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation", + "rar": "application/vnd.rar", + "rtf": "application/rtf", + "sh": "application/x-sh", + "svg": "image/svg+xml", + "swf": "application/x-shockwave-flash", + "tar": "application/x-tar", + "tif": "image/tiff", + "tiff": "image/tiff", + "ts": "video/mp2t", + "ttf": "font/ttf", + "txt": "text/plain", + "vsd": "application/vnd.visio", + "wav": "audio/wav", + "weba": "audio/webm", + "webm": "video/webm", + "webp": "image/webp", + "woff": "font/woff", + "woff2": "font/woff2", + "xhtml": "application/xhtml+xml", + "xls": "application/vnd.ms-excel", + "xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + "xml": "application/xml", + "xul": "application/vnd.mozilla.xul+xml", + "zip": "application/zip", + "3gp": "video/3gpp", + "3g2": "video/3gpp2", + "7z": "application/x-7z-compressed" + }[extension] || "application/octet-stream"; + } + + var args = (typeof(_args)==='undefined') + ? defaultArgs + : $.extend({}, defaultArgs, _args); + + var createAudio = function() { + var autoplay = args.autoplay ? 'autoplay="true"' : ''; + + $(args.element).append( + '' + ); + + args.audio = args.element + ' audio'; + + $(args.audio).css({ + 'height': '500px', + }); + } + + var readId3 = function() { + $(args.element).find('ul.mejs li').each(function(i, track){ + var url = $(track).attr('data-url'); + + $(track).prepend('  '); + + ID3.loadTags(url, function() { + var tags = ID3.getAllTags(url); + + if(typeof(tags.title)!='undefined') { + var track_title = tags.title; + + if(typeof(tags.artist)!='undefined') + track_title = tags.artist + ' - ' + track_title; + + $(args.element).find('ul.mejs li').each(function(j, _track){ + if(i==j) + $(_track).html(track_title); + }); + } + }); + }); + } + + var playerCreated = function() { + restoreParams(); + + if(args.id3) + readId3(); + } + + var createPlayer = function() { + player = new MediaElementPlayer( + "myplayer", { + success: playerCreated, + features: ['playpause', 'current', 'progress', 'duration', 'volume', 'playlist', 'prevtrack', 'nexttrack', 'shuffle', 'loop'] + }); + + $(args.element).append( + '' + ); + } + + var param = function(name) { + var query = window.location.search.substring(1); + var vars = query.split("&"); + + for(var i=0; i'+ + ''+ + '' + ); + + $('.popupButton button').click(function(){ + var currentTime = player.getCurrentTime(); + var volume = player.getVolume(); + var paused = player.media.paused; + var trackNo = 0; + + $(args.element).find('ul.mejs li').each(function(i){ + if($(this).hasClass('current')) + trackNo = i; + }); + + popup( + $(location).attr('href')+'?'+ + 'popup&'+ + 'paused='+paused+'&'+ + 'currentTime='+currentTime+'&'+ + 'volume='+volume+'&'+ + 'trackNo='+trackNo + ) + }); + } + else { + var windowHeight = $(window).height(); + + window.onbeforeunload = function(){ + $("iframe", opener.top.document).height(windowHeight); + $('.mejs-audio', opener.document).show(); + $('.playerDetached', opener.document).hide(); + } + } + } + + var restoreParams = function() { + if(!detached) + return; + + var paused = (param('paused') && param('paused')=='true'); + var currentTime = param('currentTime') ? parseFloat(param('currentTime')) : 0.0; + var volume = param('volume') ? parseFloat(param('volume')) : 1.0; + var trackNo = param('trackNo') ? parseInt(param('trackNo')) : 0; + + player.setVolume(volume); + + $(args.element).find('ul.mejs li').each(function(i){ + if(i==trackNo) { + player.playTrack($(this)); + player.setCurrentTime(currentTime); + } + }); + + if(paused) + player.pause(); + } + + if(param('popup')!==false) { + detached = true; + + $('body').html( + '
      ' + ); + + args.element = '#myplayer'; + } + + if(args.mode=='mp3url') { + var mp3url = (typeof args.mp3url === "undefined") + ? $(location).attr('href').replace(/\?.*/, '').replace(/\/[^\/]+\/?$/, '') + : args.mp3url; + + $.ajax({ + url: mp3url, + type: 'GET', + success: function(res) { + createAudio(); + + var doc = document.createElement('html'); + doc.innerHTML = res; + + var head = $(doc).find('a').each(function(idx,item) { + var src = $(item).attr('href'); + + if(src.match(/\.mp3$/)) { + var url = mp3url+'/'+src; + var title = item.innerHTML; + var type = "audio/mpeg"; + + $(args.audio).append(''); + } + }); + + createPlayer(); + setupDetach(); + } + }); + } + else if(args.mode=='m3u') { + var m3u = (typeof args.m3u === "undefined") + ? $(location).attr('href').replace(/\?.*/, '').replace(/\/[^\/]+\/?$/, '/play.m3u') + : args.m3u; + + createAudio(); + + $.get(m3u, function(txt){ + var lines = txt.split("\n"); + + for(var i = 0, len = lines.length; i < len; i++) + if(!lines[i].match(/^[ \t]*#/) && lines[i].match(/\.mp3$/)) { + var mp3 = lines[i]; + var title = unescape(mp3.split('/').pop()); + var type = "audio/mpeg"; + + $(args.audio).append(''); + } + + console.log("DEBUG: mode==m3u audio=",$(args.audio)); + + createPlayer(); + setupDetach(); + }); + } + else if(args.mode=='list') { + createAudio(); + + for(var i = 0, len = args.list.length; i < len; i++) { + var item = args.list[i]; + var type = typeof item; + var src = ''; + var title = ''; + + if(item !== null && type === 'object') { + if(item.url) + src = item.url; + else { + alert( + 'MyPlayer: item[' + i + ']: '+ + 'property "url" is missing.' + ); + + continue; + } + + if(item.title) + title = item.title; + else + title = url.replace(/(.*\/)?([^\/]+)/, '$2'); + } + else if(type === 'string') { + src = item; + title = src; + } + else { + alert( + 'MyPlayer: item [' + i + ']: '+ + 'unsupported type "' + type + '"' + ); + + continue; + } + + var type = mimeTypeFromSrc(src); + + $(args.audio).append(''); + } + + createPlayer(); + setupDetach(); + } + else { + $(args.element).append('

      Unsupported mode "'+args.mode+'"

      '); + failed = true; + } +} + diff --git a/js/myplayer.min.js b/js/myplayer.min.js index 10a01aa..9654511 100644 --- a/js/myplayer.min.js +++ b/js/myplayer.min.js @@ -1,231 +1,23 @@ -/* -jQuery - Copyright 2014 jQuery Foundation and other contributors - http://jquery.com/ -MediaElement.js - Copyright 2010-2013, John Dyer (http://j.hn) -MediaElement Playlist Feature (plugin) - - Andrew Berezovsky - and Junaid Qadir Baloch -JavaScript-ID3-Reader - Copyright (c) 2008 Jacob Seidelin, http://blog.nihilogic.dk/ BSD License - Copyright (c) 2009 Opera Software ASA BSD License - Copyright (c) 2010 António Afonso BSD License - Copyright (c) 2010 Joshua Kifer BSD License -MyPlayer - Copyright (c) 2014 tilt@linuxfoo.de MIT License -*/ -var mejs=mejs||{};mejs.version="2.18.2";mejs.meIndex=0; -mejs.plugins={silverlight:[{version:[3,0],types:"video/mp4 video/m4v video/mov video/wmv audio/wma audio/m4a audio/mp3 audio/wav audio/mpeg".split(" ")}],flash:[{version:[9,0,124],types:"video/mp4 video/m4v video/mov video/flv video/rtmp video/x-flv audio/flv audio/x-flv audio/mp3 audio/m4a audio/mpeg video/youtube video/x-youtube video/dailymotion video/x-dailymotion application/x-mpegURL".split(" ")}],youtube:[{version:null,types:["video/youtube","video/x-youtube","audio/youtube","audio/x-youtube"]}], -vimeo:[{version:null,types:["video/vimeo","video/x-vimeo"]}]}; -mejs.Utility={encodeUrl:function(c){return encodeURIComponent(c)},escapeHTML:function(c){return c.toString().split("&").join("&").split("<").join("<").split('"').join(""")},absolutizeUrl:function(c){var a=document.createElement("div");return a.innerHTML='x',a.firstChild.href},getScriptPath:function(c){for(var a,b,f,e,d,g=0,h="",k="",l=document.getElementsByTagName("script"),n=l.length,m=c.length;n>g;g++){f=l[g].src;a=f.lastIndexOf("/");-1a;a++)if(k=c[a],b=d.indexOf(k),-1c&&(c=0);"undefined"==typeof b&&(b=25);var f=a.timeFormat,e=f[0],d=f[1]==f[0],g=d?2:1,h=":",k=Math.floor(c/3600)%24,l=Math.floor(c/60)%60,n=Math.floor(c%60);c=[[Math.floor((c%1*b).toFixed(3)),"f"],[n,"s"],[l,"m"],[k,"h"]];f.lengthb;b++)if(-1!==f.indexOf(c[b][1]))g=!0;else if(g){l=!1;for(n=b;k>n;n++)if(0< -c[n][0]){l=!0;break}if(!l)break;d||(f=e+f);f=c[b][1]+h+f;d&&(f=c[b][1]+f);e=c[b][1]}a.currentTimeFormat=f},twoDigitsString:function(c){return 10>c?"0"+c:String(c)},secondsToTimeCode:function(c,a,b,f){if(0>c&&(c=0),"object"!=typeof a)a=a?"hh:mm:ss":"m:ss",a={currentTimeFormat:b?a+":ff":a,framesPerSecond:f||25};b=a.framesPerSecond;"undefined"==typeof b&&(b=25);a=a.currentTimeFormat;f=Math.floor(c/3600)%24;var e=Math.floor(c/60)%60,d=Math.floor(c%60);lis=[[Math.floor((c%1*b).toFixed(3)),"f"],[d,"s"], -[e,"m"],[f,"h"]];c=a;i=0;for(len=lis.length;ia[0]||b[0]==a[0]&&b[1]>a[1]||b[0]==a[0]&&b[1]==a[1]&&b[2]>=a[2]?!0:!1},nav:window.navigator,ua:window.navigator.userAgent.toLowerCase(),plugins:[],addPlugin:function(c,a,b,f,e){this.plugins[c]=this.detectPlugin(a,b,f,e)},detectPlugin:function(c,a,b,f){var e,d,g=[0,0,0];if("undefined"!=typeof this.nav.plugins&&"object"==typeof this.nav.plugins[c]){if(e=this.nav.plugins[c].description,e&& -("undefined"==typeof this.nav.mimeTypes||!this.nav.mimeTypes[a]||this.nav.mimeTypes[a].enabledPlugin))for(g=e.replace(c,"").replace(/^\s+/,"").replace(/\sr/gi,".").split("."),c=0;c',""!==b&&(d+=''), -d+=""+mejs.i18n.t("Download File")+"");e.innerHTML=d;f.parentNode.insertBefore(e,f);f.style.display="none";a.error(f)},createPlugin:function(c,a,b,f,e,d){var g,h,k;b=c.htmlMediaElement;var l=1,n=1,m="me_"+c.method+"_"+mejs.meIndex++,p=new mejs.PluginMediaElement(m,c.method,c.url),q=document.createElement("div");p.tagName=b.tagName;for(h=0;h';break;case "flash":mejs.MediaFeatures.isIE?(g=document.createElement("div"),q.appendChild(g),g.outerHTML=''):q.innerHTML=''; -break;case "youtube":var t;-1!=c.url.lastIndexOf("youtu.be")?(t=c.url.substr(c.url.lastIndexOf("/")+1),-1!=t.indexOf("?")&&(t=t.substr(0,t.indexOf("?")))):t=c.url.substr(c.url.lastIndexOf("=")+1);youtubeSettings={container:q,containerId:q.id,pluginMediaElement:p,pluginId:m,videoId:t,height:n,width:l};mejs.PluginDetector.hasPluginVersion("flash",[10,0,0])?mejs.YouTubeApi.createFlash(youtubeSettings,a):mejs.YouTubeApi.enqueueIframe(youtubeSettings);break;case "vimeo":if(a=m+"_player",p.vimeoid=c.url.substr(c.url.lastIndexOf("/")+ -1),q.innerHTML='',"function"==typeof $f){var r=$f(q.childNodes[0]);r.addEvent("ready",function(){function a(b,d,c,e){b={type:c,target:d};"timeupdate"==c&&(d.currentTime=b.currentTime=e.seconds,d.duration=b.duration=e.duration);d.dispatchEvent(b)}r.playVideo= -function(){r.api("play")};r.stopVideo=function(){r.api("unload")};r.pauseVideo=function(){r.api("pause")};r.seekTo=function(a){r.api("seekTo",a)};r.setVolume=function(a){r.api("setVolume",a)};r.setMuted=function(a){a?(r.lastVolume=r.api("getVolume"),r.api("setVolume",0)):(r.api("setVolume",r.lastVolume),delete r.lastVolume)};r.addEvent("play",function(){a(r,p,"play");a(r,p,"playing")});r.addEvent("pause",function(){a(r,p,"pause")});r.addEvent("finish",function(){a(r,p,"ended")});r.addEvent("playProgress", -function(b){a(r,p,"timeupdate",b)});p.pluginElement=q;p.pluginApi=r;mejs.MediaPluginBridge.initPlugin(m)})}else console.warn("You need to include froogaloop for vimeo to work")}return b.style.display="none",b.removeAttribute("autoplay"),p},updateNative:function(c,a,b,f){var e;c=c.htmlMediaElement;for(e in mejs.HtmlMediaElement)c[e]=mejs.HtmlMediaElement[e];return a.success(c,c),c}}; -mejs.YouTubeApi={isIframeStarted:!1,isIframeLoaded:!1,loadIframeApi:function(){if(!this.isIframeStarted){var c=document.createElement("script");c.src="//www.youtube.com/player_api";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(c,a);this.isIframeStarted=!0}},iframeQueue:[],enqueueIframe:function(c){this.isLoaded?this.createIframe(c):(this.loadIframeApi(),this.iframeQueue.push(c))},createIframe:function(c){var a=c.pluginMediaElement,b=new YT.Player(c.containerId,{height:c.height, -width:c.width,videoId:c.videoId,playerVars:{controls:0},events:{onReady:function(){c.pluginMediaElement.pluginApi=b;mejs.MediaPluginBridge.initPlugin(c.pluginId);setInterval(function(){mejs.YouTubeApi.createEvent(b,a,"timeupdate")},250)},onStateChange:function(c){mejs.YouTubeApi.handleStateChange(c.data,b,a)}}})},createEvent:function(c,a,b){b={type:b,target:a};if(c&&c.getDuration){a.currentTime=b.currentTime=c.getCurrentTime();a.duration=b.duration=c.getDuration();b.paused=a.paused;b.ended=a.ended; -b.muted=c.isMuted();b.volume=c.getVolume()/100;b.bytesTotal=c.getVideoBytesTotal();b.bufferedBytes=c.getVideoBytesLoaded();var f=b.bufferedBytes/b.bytesTotal*b.duration;b.target.buffered=b.buffered={start:function(a){return 0},end:function(a){return f},length:1}}a.dispatchEvent(b)},iFrameReady:function(){for(this.isIframeLoaded=this.isLoaded=!0;0'):c.container.innerHTML=''},flashReady:function(c){var a=this.flashPlayers[c],b=document.getElementById(c),f=a.pluginMediaElement; -f.pluginApi=f.pluginElement=b;mejs.MediaPluginBridge.initPlugin(c);b.cueVideoById(a.videoId);c=a.containerId+"_callback";window[c]=function(a){mejs.YouTubeApi.handleStateChange(a,b,f)};b.addEventListener("onStateChange",c);setInterval(function(){mejs.YouTubeApi.createEvent(b,f,"timeupdate")},250);mejs.YouTubeApi.createEvent(b,f,"canplay")},handleStateChange:function(c,a,b){switch(c){case -1:b.paused=!0;b.ended=!0;mejs.YouTubeApi.createEvent(a,b,"loadedmetadata");break;case 0:b.paused=!1;b.ended=!0; -mejs.YouTubeApi.createEvent(a,b,"ended");break;case 1:b.paused=!1;b.ended=!1;mejs.YouTubeApi.createEvent(a,b,"play");mejs.YouTubeApi.createEvent(a,b,"playing");break;case 2:b.paused=!0;b.ended=!1;mejs.YouTubeApi.createEvent(a,b,"pause");break;case 3:mejs.YouTubeApi.createEvent(a,b,"progress")}}};window.onYouTubePlayerAPIReady=function(){mejs.YouTubeApi.iFrameReady()};window.onYouTubePlayerReady=function(c){mejs.YouTubeApi.flashReady(c)};window.mejs=mejs;window.MediaElement=mejs.MediaElement; -(function(c,a,b){var f={locale:{language:a.i18n&&a.i18n.locale.language||"",strings:a.i18n&&a.i18n.locale.strings||{}},ietf_lang_regex:/^(x\-)?[a-z]{2,}(\-\w{2,})?(\-\w{2,})?$/,methods:{},getLanguage:function(){var a=f.locale.language||window.navigator.userLanguage||window.navigator.language;return f.ietf_lang_regex.exec(a)?a:null}};"undefined"!=typeof mejsL10n&&(f.locale.language=mejsL10n.language);f.methods.checkPlain=function(a){var b,c,f={"&":"&",'"':""","<":"<",">":">"};a=String(a); -for(b in f)f.hasOwnProperty(b)&&(c=new RegExp(b,"g"),a=a.replace(c,f[b]));return a};f.methods.t=function(a,b){return f.locale.strings&&f.locale.strings[b.context]&&f.locale.strings[b.context][a]&&(a=f.locale.strings[b.context][a]),f.methods.checkPlain(a)};f.t=function(a,b){if("string"==typeof a&&0'+e+"").insertBefore(a.$media),a.container=c('
      ').addClass(a.$media[0].className).insertBefore(a.$media).focus(function(b){a.controlsAreVisible||(a.showControls(!0),a.container.find(".mejs-playpause-button > button").focus())}),a.container.addClass((b.isAndroid? -"mejs-android ":"")+(b.isiOS?"mejs-ios ":"")+(b.isiPad?"mejs-ipad ":"")+(b.isiPhone?"mejs-iphone ":"")+(a.isVideo?"mejs-video ":"mejs-audio ")),b.isiOS)?(b=a.$media.clone(),a.container.find(".mejs-mediaelement").append(b),a.$media.remove(),a.$node=a.$media=b,a.node=a.media=b[0]):a.container.find(".mejs-mediaelement").append(a.$media),a.node.player=a,a.controls=a.container.find(".mejs-controls"),a.layers=a.container.find(".mejs-layers"),b=a.isVideo?"video":"audio",e=b.substring(0,1).toUpperCase()+ -b.substring(1),0=d.options.videoHeight&&null===d.domNode.getAttribute("height")&&!isNaN(a.target.videoHeight)&&(d.setPlayerSize(a.target.videoWidth,a.target.videoHeight),d.setControlsSize(),d.media.setVideoSize(a.target.videoWidth,a.target.videoHeight))},!1));a.addEventListener("play",function(){for(var a in mejs.players){var b=mejs.players[a];b.id==d.id||!d.options.pauseOtherPlayers|| -b.paused||b.ended||b.pause();b.hasFocus=!1}d.hasFocus=!0},!1);d.media.addEventListener("ended",function(a){if(d.options.autoRewind)try{d.media.setCurrentTime(0),window.setTimeout(function(){c(d.container).find(".mejs-overlay-loading").parent().hide()},20)}catch(b){}d.media.pause();d.setProgressRail&&d.setProgressRail();d.setCurrentRail&&d.setCurrentRail();d.options.loop?d.play():!d.options.alwaysShowControls&&d.controlsEnabled&&d.showControls()},!1);d.media.addEventListener("loadedmetadata",function(a){d.updateDuration&& -d.updateDuration();d.updateCurrent&&d.updateCurrent();d.isFullScreen||(d.setPlayerSize(d.width,d.height),d.setControlsSize())},!1);var k=null;d.media.addEventListener("timeupdate",function(){k!==this.duration&&(k=this.duration,mejs.Utility.calculateTimeFormat(k,d.options,d.options.framesPerSecond||25))},!1);d.container.focusout(function(a){a.relatedTarget&&(a=c(a.relatedTarget),d.keyboardAction&&0===a.parents(".mejs-container").length&&(d.keyboardAction=!1,d.hideControls(!0)))});setTimeout(function(){d.setPlayerSize(d.width, -d.height);d.setControlsSize()},50);d.globalBind("resize",function(){d.isFullScreen||mejs.MediaFeatures.hasTrueNativeFullScreen&&document.webkitIsFullScreen||d.setPlayerSize(d.width,d.height);d.setControlsSize()});"youtube"==d.media.pluginType&&(g.isiOS||g.isAndroid)&&d.container.find(".mejs-overlay-play").hide()}h&&"native"==a.pluginType&&d.play();d.options.success&&("string"==typeof d.options.success?window[d.options.success](d.media,d.domNode,d):d.options.success(d.media,d.domNode,d))}},handleError:function(a){this.controls.hide(); -this.options.error&&this.options.error(a)},setPlayerSize:function(a,b){if(!this.options.setDimensions)return!1;if("undefined"!=typeof a&&(this.width=a),"undefined"!=typeof b&&(this.height=b),0').appendTo(f);b=a.$media.attr("poster");""!==a.options.poster&&(b=a.options.poster);b?this.setPoster(b):d.hide();e.addEventListener("play",function(){d.hide()},!1);a.options.showPosterWhenEnded&&a.options.autoRewind&&e.addEventListener("ended",function(){d.show()},!1)}, -setPoster:function(a){var b=this.container.find(".mejs-poster"),f=b.find("img");0===f.length&&(f=c('').appendTo(b));f.attr("src",a);b.css({"background-image":"url("+a+")"})},buildoverlays:function(a,b,f,e){var d=this;if(a.isVideo){var g=c('
      ').hide().appendTo(f),h=c('
      ').hide().appendTo(f), -k=c('
      ').appendTo(f).bind("click",function(){d.options.clickToPlayPause&&e.paused&&e.play()});e.addEventListener("play",function(){k.hide();g.hide();b.find(".mejs-time-buffering").hide();h.hide()},!1);e.addEventListener("playing",function(){k.hide();g.hide();b.find(".mejs-time-buffering").hide();h.hide()},!1);e.addEventListener("seeking",function(){g.show();b.find(".mejs-time-buffering").show()},!1); -e.addEventListener("seeked",function(){g.hide();b.find(".mejs-time-buffering").hide()},!1);e.addEventListener("pause",function(){mejs.MediaFeatures.isiPhone||k.show()},!1);e.addEventListener("waiting",function(){g.show();b.find(".mejs-time-buffering").show()},!1);e.addEventListener("loadeddata",function(){g.show();b.find(".mejs-time-buffering").show();mejs.MediaFeatures.isAndroid&&(e.canplayTimeout=window.setTimeout(function(){if(document.createEvent){var a=document.createEvent("HTMLEvents");return a.initEvent("canplay", -!0,!0),e.dispatchEvent(a)}},300))},!1);e.addEventListener("canplay",function(){g.hide();b.find(".mejs-time-buffering").hide();clearTimeout(e.canplayTimeout)},!1);e.addEventListener("error",function(a){d.handleError(a);g.hide();k.hide();h.show();h.find(".mejs-overlay-error").html("Error loading this resource")},!1);e.addEventListener("keydown",function(b){d.onkeydown(a,e,b)},!1)}},buildkeyboard:function(a,b,f,e){var d=this;d.container.keydown(function(){d.keyboardAction=!0});d.globalBind("keydown", -function(b){return a.hasFocus=0!==c(b.target).closest(".mejs-container").length,d.onkeydown(a,e,b)});d.globalBind("click",function(b){a.hasFocus=0!==c(b.target).closest(".mejs-container").length})},onkeydown:function(a,b,c){if(a.hasFocus&&a.options.enableKeyboard)for(var e=0,d=a.options.keyActions.length;d>e;e++)for(var g=a.options.keyActions[e],h=0,k=g.keys.length;k>h;h++)if(c.keyCode==g.keys[h])return"function"==typeof c.preventDefault&&c.preventDefault(),g.action(a,b,c.keyCode),!1;return!0},findTracks:function(){var a= -this,b=a.$media.find("track");a.tracks=[];b.each(function(b,e){e=c(e);a.tracks.push({srclang:e.attr("srclang")?e.attr("srclang").toLowerCase():"",src:e.attr("src"),kind:e.attr("kind"),label:e.attr("label")||"",entries:[],isLoaded:!1})})},changeSkin:function(a){this.container[0].className="mejs-container "+a;this.setPlayerSize(this.width,this.height);this.setControlsSize()},play:function(){this.load();this.media.play()},pause:function(){try{this.media.pause()}catch(a){}},load:function(){this.isLoaded|| -this.media.load();this.isLoaded=!0},setMuted:function(a){this.media.setMuted(a)},setCurrentTime:function(a){this.media.setCurrentTime(a)},getCurrentTime:function(){return this.media.currentTime},setVolume:function(a){this.media.setVolume(a)},getVolume:function(){return this.media.volume},setSrc:function(a){this.media.setSrc(a)},remove:function(){var a,b;this.container.prev(".mejs-offscreen").remove();for(a in this.options.features)if(b=this.options.features[a],this["clean"+b])try{this["clean"+b](this)}catch(c){}this.isDynamic? -this.$node.insertBefore(this.container):(this.$media.prop("controls",!0),this.$node.clone().insertBefore(this.container).show(),this.$node.remove());"native"!==this.media.pluginType&&this.media.remove();delete mejs.players[this.id];"object"==typeof this.container&&this.container.remove();this.globalUnbind();delete this.node.player},rebuildtracks:function(){this.findTracks();this.buildtracks(this,this.controls,this.layers,this.media)},resetSize:function(){var a=this;setTimeout(function(){a.setPlayerSize(a.width, -a.height);a.setControlsSize()},50)}};(function(){function a(a,e){var d={d:[],w:[]};return c.each((a||"").split(" "),function(a,c){var f=c+"."+e;0===f.indexOf(".")?(d.d.push(f),d.w.push(f)):d[b.test(c)?"w":"d"].push(f)}),d.d=d.d.join(" "),d.w=d.w.join(" "),d}var b=/^((after|before)print|(before)?unload|hashchange|message|o(ff|n)line|page(hide|show)|popstate|resize|storage)\b/;mejs.MediaElementPlayer.prototype.globalBind=function(b,e,d){var g=this.node?this.node.ownerDocument:document;b=a(b,this.id); -b.d&&c(g).bind(b.d,e,d);b.w&&c(window).bind(b.w,e,d)};mejs.MediaElementPlayer.prototype.globalUnbind=function(b,e){var d=this.node?this.node.ownerDocument:document;b=a(b,this.id);b.d&&c(d).unbind(b.d,e);b.w&&c(window).unbind(b.w,e)}})();"undefined"!=typeof c&&(c.fn.mediaelementplayer=function(a){return!1===a?this.each(function(){var a=c(this).data("mediaelementplayer");a&&a.remove();c(this).removeData("mediaelementplayer")}):this.each(function(){c(this).data("mediaelementplayer",new mejs.MediaElementPlayer(this, -a))}),this},c(document).ready(function(){c(".mejs-player").mediaelementplayer()}));window.MediaElementPlayer=mejs.MediaElementPlayer})(mejs.$); -(function(c){c.extend(mejs.MepDefaults,{playText:mejs.i18n.t("Play"),pauseText:mejs.i18n.t("Pause")});c.extend(MediaElementPlayer.prototype,{buildplaypause:function(a,b,f,e){function d(a){"play"===a?(h.removeClass("mejs-play").addClass("mejs-pause"),k.attr({title:g.pauseText,"aria-label":g.pauseText})):(h.removeClass("mejs-pause").addClass("mejs-play"),k.attr({title:g.playText,"aria-label":g.playText}))}var g=this.options,h=c('
      ').appendTo(b).click(function(a){return a.preventDefault(),e.paused?e.play():e.pause(),!1}),k=h.find("button");d("pse");e.addEventListener("play",function(){d("play")},!1);e.addEventListener("playing",function(){d("play")},!1);e.addEventListener("pause",function(){d("pse")},!1);e.addEventListener("paused",function(){d("pse")},!1)}})})(mejs.$); -(function(c){c.extend(mejs.MepDefaults,{stopText:"Stop"});c.extend(MediaElementPlayer.prototype,{buildstop:function(a,b,f,e){c('
      ').appendTo(b).click(function(){e.paused||e.pause();000:00').appendTo(b);b.find(".mejs-time-buffering").hide(); -var d=this,g=b.find(".mejs-time-total");f=b.find(".mejs-time-loaded");var h=b.find(".mejs-time-current"),k=b.find(".mejs-time-handle"),l=b.find(".mejs-time-float"),n=b.find(".mejs-time-float-current"),m=b.find(".mejs-time-slider"),p=function(b){var d=g.offset(),c=g.width(),f=0,h=0,k=0;b=b.originalEvent&&b.originalEvent.changedTouches?b.originalEvent.changedTouches[0].pageX:b.changedTouches?b.changedTouches[0].pageX:b.pageX;e.duration&&(bc+d.left&&(b=c+d.left),k=b-d.left,f=k/c,h= -.02>=f?0:f*e.duration,q&&h!==e.currentTime&&e.setCurrentTime(h),mejs.MediaFeatures.hasTouch||(l.css("left",k),n.html(mejs.Utility.secondsToTimeCode(h,a.options)),l.show()))},q=!1,u=0,t=!1,r=a.options.autoRewind,v=function(){1E3<=new Date-u&&e.play()};m.bind("focus",function(b){a.options.autoRewind=!1});m.bind("blur",function(b){a.options.autoRewind=r});m.bind("keydown",function(a){1E3<=new Date-u&&(t=e.paused);var b=e.duration,d=e.currentTime;switch(a.keyCode){case 37:--d;break;case 39:d+=1;break; -case 38:d+=Math.floor(.1*b);break;case 40:d-=Math.floor(.1*b);break;case 36:d=0;break;case 35:d=b;break;case 10:return void(e.paused?e.play():e.pause());case 13:return void(e.paused?e.play():e.pause());default:return}return d=0>d?0:d>=b?b:Math.floor(d),u=new Date,t||e.pause(),d | "});c.extend(MediaElementPlayer.prototype,{buildcurrent:function(a,b,f,e){c('
      '+mejs.Utility.secondsToTimeCode(0,a.options)+"
      ").appendTo(b);this.currenttime=this.controls.find(".mejs-currenttime");e.addEventListener("timeupdate",function(){a.updateCurrent()},!1)},buildduration:function(a,b,f,e){0'+mejs.Utility.secondsToTimeCode(this.options.duration,this.options)+"").appendTo(b.find(".mejs-time")):(b.find(".mejs-currenttime").parent().addClass("mejs-currenttime-container"),c('
      '+mejs.Utility.secondsToTimeCode(this.options.duration,this.options)+"
      ").appendTo(b));this.durationD=this.controls.find(".mejs-duration");e.addEventListener("timeupdate", -function(){a.updateDuration()},!1)},updateCurrent:function(){this.currenttime&&this.currenttime.html(mejs.Utility.secondsToTimeCode(this.media.currentTime,this.options))},updateDuration:function(){this.container.toggleClass("mejs-long-video",3600'+d.options.allyVolumeControlText+'
      ').appendTo(b):c('').appendTo(b),k=d.container.find(".mejs-volume-slider, .mejs-horizontal-volume-slider"),l=d.container.find(".mejs-volume-total, .mejs-horizontal-volume-total"),n=d.container.find(".mejs-volume-current, .mejs-horizontal-volume-current"), -m=d.container.find(".mejs-volume-handle, .mejs-horizontal-volume-handle"),p=function(a,b){if(!k.is(":visible")&&"undefined"==typeof b)return k.show(),p(a,!0),void k.hide();a=Math.max(0,a);a=Math.min(a,1);0===a?(h.removeClass("mejs-mute").addClass("mejs-unmute"),h.children("button").attr("title",mejs.i18n.t("Unmute")).attr("aria-label",mejs.i18n.t("Unmute"))):(h.removeClass("mejs-unmute").addClass("mejs-mute"),h.children("button").attr("title",mejs.i18n.t("Mute")).attr("aria-label",mejs.i18n.t("Mute"))); -var d=l.position();if("vertical"==g){var c=l.height(),e=c-c*a;m.css("top",Math.round(d.top+e-m.height()/2));n.height(c-e);n.css("top",d.top+e)}else c=l.width()*a,m.css("left",Math.round(d.left+c-m.width()/2)),n.width(Math.round(c))},q=function(a){var b=null,d=l.offset();if("vertical"===g){if(b=l.height(),b=(b-(a.pageY-d.top))/b,0===d.top||0===d.left)return}else b=l.width(),b=(a.pageX-d.left)/b;b=Math.max(0,b);b=Math.min(b,1);p(b);0===b?e.setMuted(!0):e.setMuted(!1);e.setVolume(b)},u=!1,t=!1;h.hover(function(){k.show(); -t=!0},function(){t=!1;u||"vertical"!=g||k.hide()});k.bind("mouseover",function(){t=!0}).bind("mousedown",function(a){return q(a),d.globalBind("mousemove.vol",function(a){q(a)}),d.globalBind("mouseup.vol",function(){u=!1;d.globalUnbind(".vol");t||"vertical"!=g||k.hide()}),u=!0,!1}).bind("keydown",function(a){var b=e.volume;switch(a.keyCode){case 38:b+=.1;break;case 40:b-=.1;break;default:return!0}return u=!1,p(b),e.setVolume(b),!1});h.find("button").click(function(){e.setMuted(!e.muted)});h.find("button").bind("focus", -function(){k.show()});e.addEventListener("volumechange",function(a){u||(e.muted?(p(0),h.removeClass("mejs-mute").addClass("mejs-unmute")):(p(e.volume),h.removeClass("mejs-unmute").addClass("mejs-mute")));a=Math.floor(100*e.volume);k.attr({"aria-label":mejs.i18n.t("volumeSlider"),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":a,"aria-valuetext":a+"%",role:"slider",tabindex:0})},!1);0===a.options.startVolume&&e.setMuted(!0);"native"===e.pluginType&&e.setVolume(a.options.startVolume);d.container.on("controlsresize", -function(){p(e.volume)})}}})})(mejs.$); -(function(c){c.extend(mejs.MepDefaults,{usePluginFullScreen:!0,newWindowCallback:function(){return""},fullscreenText:mejs.i18n.t("Fullscreen")});c.extend(MediaElementPlayer.prototype,{isFullScreen:!1,isNativeFullScreen:!1,isInIframe:!1,buildfullscreen:function(a,b,f,e){if(a.isVideo){(a.isInIframe=window.location!=window.parent.location,mejs.MediaFeatures.hasTrueNativeFullScreen)&&a.globalBind(mejs.MediaFeatures.fullScreenEventName,function(b){a.isFullScreen&&(mejs.MediaFeatures.isFullScreen()?(a.isNativeFullScreen= -!0,a.setControlsSize()):(a.isNativeFullScreen=!1,a.exitFullScreen()))});var d=this,g=c('
      ').appendTo(b);if("native"===d.media.pluginType||!d.options.usePluginFullScreen&&!mejs.MediaFeatures.isFirefox)g.click(function(){mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||a.isFullScreen? -a.exitFullScreen():a.enterFullScreen()});else{var h=null;if(function(){var a,b=document.createElement("x"),d=document.documentElement,c=window.getComputedStyle;return"pointerEvents"in b.style?(b.style.pointerEvents="auto",b.style.pointerEvents="x",d.appendChild(b),a=c&&"auto"===c(b,"").pointerEvents,d.removeChild(b),!!a):!1}()&&!mejs.MediaFeatures.isOpera){var k,l=!1,n=function(){if(l){for(var a in m)m[a].hide();g.css("pointer-events","");d.controls.css("pointer-events","");d.media.removeEventListener("click", -d.clickToPlayPauseCallback);l=!1}},m={};f=["top","left","right","bottom"];var p=function(){var a=g.offset().left-d.container.offset().left,b=g.offset().top-d.container.offset().top,c=g.outerWidth(!0),e=g.outerHeight(!0),f=d.container.width(),h=d.container.height();for(k in m)m[k].css({position:"absolute",top:0,left:0});m.top.width(f).height(b);m.left.width(a).height(e).css({top:b});m.right.width(f-a-c).height(e).css({top:b,left:a+c});m.bottom.width(f).height(h-e-b).css({top:b+e})};d.globalBind("resize", -function(){p()});k=0;for(b=f.length;b>k;k++)m[f[k]]=c('
      ').appendTo(d.container).mouseover(n).hide();g.on("mouseover",function(){if(!d.isFullScreen){var b=g.offset(),c=a.container.offset();e.positionFullscreenButton(b.left-c.left,b.top-c.top,!1);g.css("pointer-events","none");d.controls.css("pointer-events","none");d.media.addEventListener("click",d.clickToPlayPauseCallback);for(k in m)m[k].show();p();l=!0}});e.addEventListener("fullscreenchange",function(a){d.isFullScreen= -!d.isFullScreen;d.isFullScreen?d.media.removeEventListener("click",d.clickToPlayPauseCallback):d.media.addEventListener("click",d.clickToPlayPauseCallback);n()});d.globalBind("mousemove",function(a){if(l){var b=g.offset();(a.pageYb.top+g.outerHeight(!0)||a.pageXb.left+g.outerWidth(!0))&&(g.css("pointer-events",""),d.controls.css("pointer-events",""),l=!1)}})}else g.on("mouseover",function(){null!==h&&(clearTimeout(h),delete h);var b=g.offset(),d=a.container.offset(); -e.positionFullscreenButton(b.left-d.left,b.top-d.top,!0)}).on("mouseout",function(){null!==h&&(clearTimeout(h),delete h);h=setTimeout(function(){e.hideFullscreenButton()},1500)})}a.fullscreenBtn=g;d.globalBind("keydown",function(b){(mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||d.isFullScreen)&&27==b.keyCode&&a.exitFullScreen()});d.normalHeight=0;d.normalWidth=0}},cleanfullscreen:function(a){a.exitFullScreen()},containerSizeTimeout:null,enterFullScreen:function(){var a= -this;if("native"===a.media.pluginType||!mejs.MediaFeatures.isFirefox&&!a.options.usePluginFullScreen){if(c(document.documentElement).addClass("mejs-fullscreen"),a.normalHeight=a.container.height(),a.normalWidth=a.container.width(),"native"===a.media.pluginType)if(mejs.MediaFeatures.hasTrueNativeFullScreen)mejs.MediaFeatures.requestFullScreen(a.container[0]),a.isInIframe&&setTimeout(function e(){if(a.isNativeFullScreen){var b=window.devicePixelRatio||1,g=b*c(window).width(),h=screen.width,b=b*g;Math.abs(h- -g)>Math.abs(h-b)&&(g=b);Math.abs(h-g)>.002*h?a.exitFullScreen():setTimeout(e,500)}},1E3);else if(mejs.MediaFeatures.hasSemiNativeFullScreen)return void a.media.webkitEnterFullscreen();if(a.isInIframe){var b=a.options.newWindowCallback(this);if(""!==b){if(!mejs.MediaFeatures.hasTrueNativeFullScreen)return a.pause(),void window.open(b,a.id,"top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no");setTimeout(function(){a.isNativeFullScreen|| -(a.pause(),window.open(b,a.id,"top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no"))},250)}}a.container.addClass("mejs-container-fullscreen").width("100%").height("100%");a.containerSizeTimeout=setTimeout(function(){a.container.css({width:"100%",height:"100%"});a.setControlsSize()},500);"native"===a.media.pluginType?a.$media.width("100%").height("100%"):(a.container.find(".mejs-shim").width("100%").height("100%"),a.media.setVideoSize(c(window).width(), -c(window).height()));a.layers.children("div").width("100%").height("100%");a.fullscreenBtn&&a.fullscreenBtn.removeClass("mejs-fullscreen").addClass("mejs-unfullscreen");a.setControlsSize();a.isFullScreen=!0;a.container.find(".mejs-captions-text").css("font-size",screen.width/a.width*100+"%");a.container.find(".mejs-captions-position").css("bottom","45px");a.container.trigger("enteredfullscreen")}},exitFullScreen:function(){return clearTimeout(this.containerSizeTimeout),"native"!==this.media.pluginType&& -mejs.MediaFeatures.isFirefox?void this.media.setFullscreen(!1):(mejs.MediaFeatures.hasTrueNativeFullScreen&&(mejs.MediaFeatures.isFullScreen()||this.isFullScreen)&&mejs.MediaFeatures.cancelFullScreen(),c(document.documentElement).removeClass("mejs-fullscreen"),this.container.removeClass("mejs-container-fullscreen").width(this.normalWidth).height(this.normalHeight),"native"===this.media.pluginType?this.$media.width(this.normalWidth).height(this.normalHeight):(this.container.find(".mejs-shim").width(this.normalWidth).height(this.normalHeight), -this.media.setVideoSize(this.normalWidth,this.normalHeight)),this.layers.children("div").width(this.normalWidth).height(this.normalHeight),this.fullscreenBtn.removeClass("mejs-unfullscreen").addClass("mejs-fullscreen"),this.setControlsSize(),this.isFullScreen=!1,this.container.find(".mejs-captions-text").css("font-size",""),this.container.find(".mejs-captions-position").css("bottom",""),void this.container.trigger("exitedfullscreen"))}})})(mejs.$); -(function(c){c.extend(mejs.MepDefaults,{speeds:["2.00","1.50","1.25","1.00","0.75"],defaultSpeed:"1.00",speedChar:"x"});c.extend(MediaElementPlayer.prototype,{buildspeed:function(a,b,f,e){if("native"==this.media.pluginType){var d=null,g=null,h=null;a=null;var k=[];a=!1;for(var l=0,n=this.options.speeds.length;n>l;l++)f=this.options.speeds[l],"string"==typeof f?(k.push({name:f+this.options.speedChar,value:f}),f===this.options.defaultSpeed&&(a=!0)):(k.push(f),f.value===this.options.defaultSpeed&&(a= -!0));a||k.push({name:this.options.defaultSpeed+this.options.speedChar,value:this.options.defaultSpeed});k.sort(function(a,b){return parseFloat(b.value)-parseFloat(a.value)});var m=function(a){l=0;for(n=k.length;n>l;l++)if(k[l].value===a)return k[l].name};f='
        ';l=0;for(il=k.length;l";d=c(f+"
      ").appendTo(b);g=d.find(".mejs-speed-selector");h=this.options.defaultSpeed;e.addEventListener("loadedmetadata",function(a){h&&(e.playbackRate=parseFloat(h))},!0);g.on("click",'input[type="radio"]',function(){var a=c(this).attr("value");h=a;e.playbackRate=parseFloat(a); -d.find("button").html(m(a));d.find(".mejs-speed-selected").removeClass("mejs-speed-selected");d.find('input[type="radio"]:checked').next().addClass("mejs-speed-selected")});d.one("mouseenter focusin",function(){g.height(d.find(".mejs-speed-selector ul").outerHeight(!0)+d.find(".mejs-speed-translations").outerHeight(!0)).css("top",-1*g.height()+"px")})}}})})(mejs.$); -(function(c){c.extend(mejs.MepDefaults,{startLanguage:"",tracksText:mejs.i18n.t("Captions/Subtitles"),tracksAriaLive:!1,hideCaptionsButtonWhenEmpty:!0,toggleCaptionsButtonWhenOnlyOne:!1,slidesSelector:""});c.extend(MediaElementPlayer.prototype,{hasChapters:!1,cleartracks:function(a,b,c,e){a&&(a.captions&&a.captions.remove(),a.chapters&&a.chapters.remove(),a.captionsText&&a.captionsText.remove(),a.captionsButton&&a.captionsButton.remove())},buildtracks:function(a,b,f,e){if(0!==a.tracks.length){var d, -g=this,h=g.options.tracksAriaLive?'role="log" aria-live="assertive" aria-atomic="false"':"";if(g.domNode.textTracks)for(d=g.domNode.textTracks.length-1;0<=d;d--)g.domNode.textTracks[d].mode="hidden";g.cleartracks(a,b,f,e);a.chapters=c('
      ').prependTo(f).hide();a.captions=c('
      ').prependTo(f).hide(); -a.captionsText=a.captions.find(".mejs-captions-text");a.captionsButton=c('
      ").appendTo(b); -for(d=b=0;d"));this.adjustLanguageBox();this.container.find(".mejs-captions-translations option[value="+a+"]").remove()},adjustLanguageBox:function(){this.captionsButton.find(".mejs-captions-selector").height(this.captionsButton.find(".mejs-captions-selector ul").outerHeight(!0)+this.captionsButton.find(".mejs-captions-translations").outerHeight(!0))},checkForTracks:function(){var a=!1;if(this.options.hideCaptionsButtonWhenEmpty){for(i=0;i=b.entries.times[a].start&&this.media.currentTime<=b.entries.times[a].stop)return this.captionsText.html(b.entries.text[a]).attr("class","mejs-captions-text "+(b.entries.times[a].identifier||"")),void this.captions.show().height(0); -this.captions.hide()}},setupSlides:function(a){this.slides=a;this.slides.entries.imgs=[this.slides.entries.text.length];this.showSlide(0)},showSlide:function(a){if("undefined"!=typeof this.tracks&&"undefined"!=typeof this.slidesContainer){var b=this,f=b.slides.entries.text[a],e=b.slides.entries.imgs[a];"undefined"==typeof e||"undefined"==typeof e.fadeIn?b.slides.entries.imgs[a]=e=c('').on("load",function(){e.appendTo(b.slidesContainer).hide().fadeIn().siblings(":visible").fadeOut()}): -e.is(":visible")||e.is(":animated")||e.fadeIn().siblings(":visible").fadeOut()}},displaySlides:function(){if("undefined"!=typeof this.slides){var a,b=this.slides;for(a=0;a=b.entries.times[a].start&&this.media.currentTime<=b.entries.times[a].stop)return void this.showSlide(a)}},displayChapters:function(){var a;for(a=0;af+d)&&(f=100-d),e.chapters.append(c('
      '+ -a.entries.text[b]+''+mejs.Utility.secondsToTimeCode(a.entries.times[b].start,e.options)+"–"+mejs.Utility.secondsToTimeCode(a.entries.times[b].stop,e.options)+"
      ")),d+=f;e.chapters.find("div.mejs-chapter").click(function(){e.media.setCurrentTime(parseFloat(c(this).attr("rel")));e.media.paused&&e.media.play()});e.chapters.show()}});mejs.language={codes:{af:"Afrikaans",sq:"Albanian",ar:"Arabic",be:"Belarusian",bg:"Bulgarian",ca:"Catalan",zh:"Chinese", -"zh-cn":"Chinese Simplified","zh-tw":"Chinese Traditional",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",et:"Estonian",fl:"Filipino",fi:"Finnish",fr:"French",gl:"Galician",de:"German",el:"Greek",ht:"Haitian Creole",iw:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",ga:"Irish",it:"Italian",ja:"Japanese",ko:"Korean",lv:"Latvian",lt:"Lithuanian",mk:"Macedonian",ms:"Malay",mt:"Maltese",no:"Norwegian",fa:"Persian",pl:"Polish",pt:"Portuguese",ro:"Romanian",ru:"Russian", -sr:"Serbian",sk:"Slovak",sl:"Slovenian",es:"Spanish",sw:"Swahili",sv:"Swedish",tl:"Tagalog",th:"Thai",tr:"Turkish",uk:"Ukrainian",vi:"Vietnamese",cy:"Welsh",yi:"Yiddish"}};mejs.TrackFormatParser={webvtt:{pattern_timecode:/^((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{1,3})?) --\> ((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/,parse:function(a){for(var b,f,e=0,d=mejs.TrackFormatParser.split2(a,/\r?\n/),g={text:[],times:[]};e$1");g.text.push(a);g.times.push({identifier:f,start:0===mejs.Utility.convertSMPTEtoSeconds(b[1])?.2:mejs.Utility.convertSMPTEtoSeconds(b[1]),stop:mejs.Utility.convertSMPTEtoSeconds(b[3]),settings:b[5]})}f=""}return g}},dfxp:{parse:function(a){a=c(a).filter("tt");var b,f,e=0,e=a.children("div").eq(0), -d=e.find("p"),e=a.find("#"+e.attr("style"));a={text:[],times:[]};if(e.length&&(f=e.removeAttr("id").get(0).attributes,f.length))for(b={},e=0;e$1");a.text.push(f);0===a.times.start&&(a.times.start=2)}return a}},split2:function(a,b){return a.split(b)}};3!="x\n\ny".split(/\n/gi).length&&(mejs.TrackFormatParser.split2= -function(a,b){var c,e=[],d="";for(c=0;c
      ').appendTo(c("body")).hide();a.container.bind("contextmenu",function(b){return a.isContextMenuEnabled?(b.preventDefault(),a.renderContextMenu(b.clientX-1,b.clientY-1),!1):void 0});a.container.bind("click",function(){a.contextMenu.hide()});a.contextMenu.bind("mouseleave",function(){a.startContextMenuTimer()})}, -cleancontextmenu:function(a){a.contextMenu.remove()},isContextMenuEnabled:!0,enableContextMenu:function(){this.isContextMenuEnabled=!0},disableContextMenu:function(){this.isContextMenuEnabled=!1},contextMenuTimeout:null,startContextMenuTimer:function(){var a=this;a.killContextMenuTimer();a.contextMenuTimer=setTimeout(function(){a.hideContextMenu();a.killContextMenuTimer()},750)},killContextMenuTimer:function(){var a=this.contextMenuTimer;null!=a&&(clearTimeout(a),delete a)},hideContextMenu:function(){this.contextMenu.hide()}, -renderContextMenu:function(a,b){for(var f=this,e="",d=f.options.contextMenuItems,g=0,h=d.length;h>g;g++)if(d[g].isSeparator)e+='
      ';else{var k=d[g].render(f);null!=k&&(e+='
      '+k+"
      ")}f.contextMenu.empty().append(c(e)).css({top:b,left:a}).show();f.contextMenu.find(".mejs-contextmenu-item").each(function(){var a=c(this),b=parseInt(a.data("itemindex"),10),d=f.options.contextMenuItems[b]; -"undefined"!=typeof d.show&&d.show(a,f);a.click(function(){"undefined"!=typeof d.click&&d.click(f);f.contextMenu.hide()})});setTimeout(function(){f.killControlsTimer("rev3")},100)}})})(mejs.$); -(function(c){c.extend(mejs.MepDefaults,{skipBackInterval:30,skipBackText:mejs.i18n.t("Skip back %1 seconds")});c.extend(MediaElementPlayer.prototype,{buildskipback:function(a,b,f,e){var d=this;a=d.options.skipBackText.replace("%1",d.options.skipBackInterval);c('
      ").appendTo(b).click(function(){e.setCurrentTime(Math.max(e.currentTime- -d.options.skipBackInterval,0));c(this).find("button").blur()})}})})(mejs.$); -(function(c){c.extend(mejs.MepDefaults,{postrollCloseText:mejs.i18n.t("Close")});c.extend(MediaElementPlayer.prototype,{buildpostroll:function(a,b,f,e){var d=this.container.find('link[rel="postroll"]').attr("href");"undefined"!=typeof d&&(a.postroll=c('').prependTo(f).hide(),this.media.addEventListener("ended", -function(b){c.ajax({dataType:"html",url:d,success:function(a,b){f.find(".mejs-postroll-layer-content").html(a)}});a.postroll.show()},!1))}})})(mejs.$);(function(c){c.extend(mejs.MepDefaults,{loopText:"Repeat On/Off",shuffleText:"Shuffle On/Off",nextText:"Next Track",prevText:"Previous Track",playlistText:"Show/Hide Playlist"});c.extend(MediaElementPlayer.prototype,{buildloop:function(a,b,f,e){var d=c('
      ').appendTo(b).click(function(b){a.options.loop=!a.options.loop; -c(e).trigger("mep-looptoggle",[a.options.loop]);a.options.loop?d.removeClass("mejs-loop-off").addClass("mejs-loop-on"):d.removeClass("mejs-loop-on").addClass("mejs-loop-off")});this.loopToggle=this.controls.find(".mejs-loop-button")},loopToggleClick:function(){this.loopToggle.trigger("click")},buildshuffle:function(a,b,f,e){var d=c('
      ').appendTo(b).click(function(b){a.options.shuffle=!a.options.shuffle;c(e).trigger("mep-shuffletoggle",[a.options.shuffle]);a.options.shuffle?d.removeClass("mejs-shuffle-off").addClass("mejs-shuffle-on"):d.removeClass("mejs-shuffle-on").addClass("mejs-shuffle-off")});this.shuffleToggle=this.controls.find(".mejs-shuffle-button")},shuffleToggleClick:function(){this.shuffleToggle.trigger("click")},buildprevtrack:function(a,b,f,e){c('
      ').appendTo(b).click(function(b){c(e).trigger("mep-playprevtrack");a.playPrevTrack()});this.prevTrack=this.controls.find(".mejs-prevtrack-button")},prevTrackClick:function(){this.prevTrack.trigger("click")},buildnexttrack:function(a,b,f,e){c('
      ').appendTo(b).click(function(b){c(e).trigger("mep-playnexttrack"); -a.playNextTrack()});this.nextTrack=this.controls.find(".mejs-nexttrack-button")},nextTrackClick:function(){this.nextTrack.trigger("click")},buildplaylist:function(a,b,f,e){var d=c('
      ').appendTo(b).click(function(b){a.options.playlist=!a.options.playlist;c(e).trigger("mep-playlisttoggle",[a.options.playlist]); -a.options.playlist?(f.children(".mejs-playlist").show(),d.removeClass("mejs-show-playlist").addClass("mejs-hide-playlist")):(f.children(".mejs-playlist").hide(),d.removeClass("mejs-hide-playlist").addClass("mejs-show-playlist"))});this.playlistToggle=this.controls.find(".mejs-playlist-button")},playlistToggleClick:function(){this.playlistToggle.trigger("click")},buildplaylistfeature:function(a,b,f,e){b=c('
        ').appendTo(f);a.options.playlist|| -b.hide();"bottom"==a.options.playlistposition?b.css("top",a.options.audioHeight+"px"):b.css("bottom",a.options.audioHeight+"px");var d=[];c("#"+a.id).find(".mejs-mediaelement source").each(function(a,b){if(""!=c.trim(this.src)){var e={};e.source=c.trim(this.src);if(""!=c.trim(this.title))e.name=c.trim(this.title);else{var f;f=e.source.split("/");f=0 ul").append('
      • '+d[g].name+"
      • ");f.find("li:first").addClass("current played");f.find(".mejs-playlist > ul li").click(function(b){c(this).hasClass("current")?a.play():(c(this).addClass("played"),a.playTrack(c(this)))});e.addEventListener("ended",function(b){a.playNextTrack()},!1)},playNextTrack:function(){var a=this.layers.find(".mejs-playlist > ul > li"),b=a.filter(".current"),c=a.not(".played");1>c.length&&(b.removeClass("played").siblings().removeClass("played"),c=a.not(".current")); -this.options.shuffle?a=c.eq(Math.floor(Math.random()*c.length)):(a=b.next(),1>a.length&&this.options.loop&&(a=b.siblings().first()));1==a.length&&(a.addClass("played"),this.playTrack(a))},playPrevTrack:function(){var a=this.layers.find(".mejs-playlist > ul > li"),b=a.filter(".current"),c=a.filter(".played").not(".current");1>c.length&&(b.removeClass("played"),c=a.not(".current"));this.options.shuffle?a=c.eq(Math.floor(Math.random()*c.length)):(a=b.prev(),1>a.length&&this.options.loop&&(a=b.siblings().last())); -1==a.length&&(b.removeClass("played"),this.playTrack(a))},playTrack:function(a){this.pause();this.setSrc(a.attr("data-url"));this.load();this.play();a.addClass("current").siblings().removeClass("current")},playTrackURL:function(a){a=this.layers.find(".mejs-playlist > ul > li").filter('[data-url="'+a+'"]');this.playTrack(a)}})})(mejs.$);function A(c,a,b){var f=a||0,e=0;"string"==typeof c?(e=b||c.length,this.a=function(a){return c.charCodeAt(a+f)&255}):"unknown"==typeof c&&(e=b||IEBinary_getLength(c),this.a=function(a){return IEBinary_getByteAt(c,a+f)});this.l=function(a,b){for(var c=Array(b),e=0;ea&&(a+=65536);return a};this.i=function(a){var b=this.a(a),c=this.a(a+1),e= -this.a(a+2);a=this.a(a+3);b=(((b<<8)+c<<8)+e<<8)+a;0>b&&(b+=4294967296);return b};this.o=function(a){var b=this.a(a),c=this.a(a+1);a=this.a(a+2);b=((b<<8)+c<<8)+a;0>b&&(b+=16777216);return b};this.c=function(a,b){for(var c=[],e=a,f=0;ep||224<=p?b[m]=String.fromCharCode(q):(p=(a[f+n]<<8)+a[f+c],f+=2,b[m]=String.fromCharCode(q,p))}a=new String(b.join(""));a.g=f;break;case "utf-8":e=0;f=Math.min(f||a.length,a.length);239==a[0]&&187==a[1]&&191==a[2]&&(e=3);n=[];for(c=0;eb?n[c]=String.fromCharCode(b):194<=b&&224>b?(m=a[e++],n[c]=String.fromCharCode(((b&31)<<6)+(m&63))):224<=b&&240> -b?(m=a[e++],q=a[e++],n[c]=String.fromCharCode(((b&255)<<12)+((m&63)<<6)+(q&63))):240<=b&&245>b&&(m=a[e++],q=a[e++],p=a[e++],b=((b&7)<<18)+((m&63)<<12)+((q&63)<<6)+(p&63)-65536,n[c]=String.fromCharCode((b>>10)+55296,(b&1023)+56320));a=new String(n.join(""));a.g=e;break;default:f=[];n=n||a.length;for(e=0;e\r\nFunction IEBinary_getByteAt(strBinary, iOffset)\r\n\tIEBinary_getByteAt = AscB(MidB(strBinary,iOffset+1,1))\r\nEnd Function\r\nFunction IEBinary_getLength(strBinary)\r\n\tIEBinary_getLength = LenB(strBinary)\r\nEnd Function\r\n\x3c/script>\r\n"); -function B(c,a,b){function f(a,b,c,d,f,g){var q=e();q?("undefined"===typeof g&&(g=!0),b&&("undefined"!=typeof q.onload?q.onload=function(){"200"==q.status||"206"==q.status?(q.fileSize=f||q.getResponseHeader("Content-Length"),b(q)):c&&c();q=null}:q.onreadystatechange=function(){4==q.readyState&&("200"==q.status||"206"==q.status?(q.fileSize=f||q.getResponseHeader("Content-Length"),b(q)):c&&c(),q=null)}),q.open("GET",a,g),q.overrideMimeType&&q.overrideMimeType("text/plain; charset=x-user-defined"),d&& -q.setRequestHeader("Range","bytes="+d[0]+"-"+d[1]),q.setRequestHeader("If-Modified-Since","Sat, 1 Jan 1970 00:00:00 GMT"),q.send(null)):c&&c()}function e(){var a=null;window.XMLHttpRequest?a=new XMLHttpRequest:window.ActiveXObject&&(a=new ActiveXObject("Microsoft.XMLHTTP"));return a}function d(a,b){var c=e();c&&(b&&("undefined"!=typeof c.onload?c.onload=function(){"200"==c.status&&b(this);c=null}:c.onreadystatechange=function(){4==c.readyState&&("200"==c.status&&b(this),c=null)}),c.open("HEAD",a, -!0),c.send(null))}function g(a,c){function d(a){var b=~~(a[0]/g)-p;a=~~(a[1]/g)+1+p;0>b&&(b=0);a>=blockTotal&&(a=blockTotal-1);return[b,a]}function e(d,l){for(;t[d[0]];)if(d[0]++,d[0]>d[1]){l&&l();return}for(;t[d[1]];)if(d[1]--,d[0]>d[1]){l&&l();return}var n=[d[0]*g,(d[1]+1)*g-1];f(a,function(a){parseInt(a.getResponseHeader("Content-Length"),10)==c&&(d[0]=0,d[1]=blockTotal-1,n[0]=0,n[1]=c-1);a={data:a.N||a.responseText,offset:n[0]};for(var b=d[0];b<=d[1];b++)t[b]=a;l&&l()},b,n,q,!!l)}var g,p,q,u= -new A("",0,c),t=[];g=g||2048;p="undefined"===typeof p?0:p;blockTotal=~~((c-1)/g)+1;for(var r in u)u.hasOwnProperty(r)&&"function"===typeof u[r]&&(this[r]=u[r]);this.a=function(a){var b;e(d([a,a]));b=t[~~(a/g)];if("string"==typeof b.data)return b.data.charCodeAt(a-b.offset)&255;if("unknown"==typeof b.data)return IEBinary_getByteAt(b.data,a-b.offset)};this.f=function(a,b){e(d(a),b)}}(function(){d(c,function(b){b=parseInt(b.getResponseHeader("Content-Length"),10)||-1;a(new g(c,b))})})()} -(function(c){c.FileAPIReader=function(a,b){return function(c,e){var d=b||new FileReader;d.onload=function(a){e(new A(a.target.result))};d.readAsBinaryString(a)}}})(this); -(function(c){var a=c.p={},b={},f=[0,7];a.t=function(a){delete b[a]};a.s=function(){b={}};a.B=function(a,c,g){g=g||{};(g.dataReader||B)(a,function(h){h.f(f,function(){var f="ftypM4A"==h.c(4,7)?ID4:"ID3"==h.c(0,3)?ID3v2:ID3v1;f.m(h,function(){var l=g.tags,n=f.n(h,l),l=b[a]||{},m;for(m in n)n.hasOwnProperty(m)&&(l[m]=n[m]);b[a]=l;c&&c()})})})};a.v=function(a){if(!b[a])return null;var c={},f;for(f in b[a])b[a].hasOwnProperty(f)&&(c[f]=b[a][f]);return c};a.A=function(a,c){return b[a]?b[a][c]:null};c.ID3= -c.p;a.loadTags=a.B;a.getAllTags=a.v;a.getTag=a.A;a.clearTags=a.t;a.clearAll=a.s})(this); -(function(c){var a=c.q={},b="Blues;Classic Rock;Country;Dance;Disco;Funk;Grunge;Hip-Hop;Jazz;Metal;New Age;Oldies;Other;Pop;R&B;Rap;Reggae;Rock;Techno;Industrial;Alternative;Ska;Death Metal;Pranks;Soundtrack;Euro-Techno;Ambient;Trip-Hop;Vocal;Jazz+Funk;Fusion;Trance;Classical;Instrumental;Acid;House;Game;Sound Clip;Gospel;Noise;AlternRock;Bass;Soul;Punk;Space;Meditative;Instrumental Pop;Instrumental Rock;Ethnic;Gothic;Darkwave;Techno-Industrial;Electronic;Pop-Folk;Eurodance;Dream;Southern Rock;Comedy;Cult;Gangsta;Top 40;Christian Rap;Pop/Funk;Jungle;Native American;Cabaret;New Wave;Psychadelic;Rave;Showtunes;Trailer;Lo-Fi;Tribal;Acid Punk;Acid Jazz;Polka;Retro;Musical;Rock & Roll;Hard Rock;Folk;Folk-Rock;National Folk;Swing;Fast Fusion;Bebob;Latin;Revival;Celtic;Bluegrass;Avantgarde;Gothic Rock;Progressive Rock;Psychedelic Rock;Symphonic Rock;Slow Rock;Big Band;Chorus;Easy Listening;Acoustic;Humour;Speech;Chanson;Opera;Chamber Music;Sonata;Symphony;Booty Bass;Primus;Porn Groove;Satire;Slow Jam;Club;Tango;Samba;Folklore;Ballad;Power Ballad;Rhythmic Soul;Freestyle;Duet;Punk Rock;Drum Solo;Acapella;Euro-House;Dance Hall".split(";");a.m= -function(a,b){var c=a.h();a.f([c-128-1,c],b)};a.n=function(a){var c=a.h()-128;if("TAG"==a.c(c,3)){var d=a.c(c+3,30).replace(/\0/g,""),g=a.c(c+33,30).replace(/\0/g,""),h=a.c(c+63,30).replace(/\0/g,""),k=a.c(c+93,4).replace(/\0/g,"");if(0==a.a(c+97+28))var l=a.c(c+97,28).replace(/\0/g,""),n=a.a(c+97+29);else l="",n=0;a=a.a(c+97+30);return{version:"1.1",title:d,artist:g,album:h,year:k,comment:l,track:n,genre:255>a?b[a]:""}}return{}};c.ID3v1=c.q})(this); -(function(c){function a(a,b){var c=b.a(a),e=b.a(a+1),f=b.a(a+2);return b.a(a+3)&127|(f&127)<<7|(e&127)<<14|(c&127)<<21}var b=c.D={};b.b={};b.frames={BUF:"Recommended buffer size",CNT:"Play counter",COM:"Comments",CRA:"Audio encryption",CRM:"Encrypted meta frame",ETC:"Event timing codes",EQU:"Equalization",GEO:"General encapsulated object",IPL:"Involved people list",LNK:"Linked information",MCI:"Music CD Identifier",MLL:"MPEG location lookup table",PIC:"Attached picture",POP:"Popularimeter",REV:"Reverb", -RVA:"Relative volume adjustment",SLT:"Synchronized lyric/text",STC:"Synced tempo codes",TAL:"Album/Movie/Show title",TBP:"BPM (Beats Per Minute)",TCM:"Composer",TCO:"Content type",TCR:"Copyright message",TDA:"Date",TDY:"Playlist delay",TEN:"Encoded by",TFT:"File type",TIM:"Time",TKE:"Initial key",TLA:"Language(s)",TLE:"Length",TMT:"Media type",TOA:"Original artist(s)/performer(s)",TOF:"Original filename",TOL:"Original Lyricist(s)/text writer(s)",TOR:"Original release year",TOT:"Original album/Movie/Show title", -TP1:"Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group",TP2:"Band/Orchestra/Accompaniment",TP3:"Conductor/Performer refinement",TP4:"Interpreted, remixed, or otherwise modified by",TPA:"Part of a set",TPB:"Publisher",TRC:"ISRC (International Standard Recording Code)",TRD:"Recording dates",TRK:"Track number/Position in set",TSI:"Size",TSS:"Software/hardware and settings used for encoding",TT1:"Content group description",TT2:"Title/Songname/Content description",TT3:"Subtitle/Description refinement", -TXT:"Lyricist/text writer",TXX:"User defined text information frame",TYE:"Year",UFI:"Unique file identifier",ULT:"Unsychronized lyric/text transcription",WAF:"Official audio file webpage",WAR:"Official artist/performer webpage",WAS:"Official audio source webpage",WCM:"Commercial information",WCP:"Copyright/Legal information",WPB:"Publishers official webpage",WXX:"User defined URL link frame",AENC:"Audio encryption",APIC:"Attached picture",COMM:"Comments",COMR:"Commercial frame",ENCR:"Encryption method registration", -EQUA:"Equalization",ETCO:"Event timing codes",GEOB:"General encapsulated object",GRID:"Group identification registration",IPLS:"Involved people list",LINK:"Linked information",MCDI:"Music CD identifier",MLLT:"MPEG location lookup table",OWNE:"Ownership frame",PRIV:"Private frame",PCNT:"Play counter",POPM:"Popularimeter",POSS:"Position synchronisation frame",RBUF:"Recommended buffer size",RVAD:"Relative volume adjustment",RVRB:"Reverb",SYLT:"Synchronized lyric/text",SYTC:"Synchronized tempo codes", -TALB:"Album/Movie/Show title",TBPM:"BPM (beats per minute)",TCOM:"Composer",TCON:"Content type",TCOP:"Copyright message",TDAT:"Date",TDLY:"Playlist delay",TENC:"Encoded by",TEXT:"Lyricist/Text writer",TFLT:"File type",TIME:"Time",TIT1:"Content group description",TIT2:"Title/songname/content description",TIT3:"Subtitle/Description refinement",TKEY:"Initial key",TLAN:"Language(s)",TLEN:"Length",TMED:"Media type",TOAL:"Original album/movie/show title",TOFN:"Original filename",TOLY:"Original lyricist(s)/text writer(s)", -TOPE:"Original artist(s)/performer(s)",TORY:"Original release year",TOWN:"File owner/licensee",TPE1:"Lead performer(s)/Soloist(s)",TPE2:"Band/orchestra/accompaniment",TPE3:"Conductor/performer refinement",TPE4:"Interpreted, remixed, or otherwise modified by",TPOS:"Part of a set",TPUB:"Publisher",TRCK:"Track number/Position in set",TRDA:"Recording dates",TRSN:"Internet radio station name",TRSO:"Internet radio station owner",TSIZ:"Size",TSRC:"ISRC (international standard recording code)",TSSE:"Software/Hardware and settings used for encoding", -TYER:"Year",TXXX:"User defined text information frame",UFID:"Unique file identifier",USER:"Terms of use",USLT:"Unsychronized lyric/text transcription",WCOM:"Commercial information",WCOP:"Copyright/Legal information",WOAF:"Official audio file webpage",WOAR:"Official artist/performer webpage",WOAS:"Official audio source webpage",WORS:"Official internet radio station homepage",WPAY:"Payment",WPUB:"Publishers official webpage",WXXX:"User defined URL link frame"};var f={title:["TIT2","TT2"],artist:["TPE1", -"TP1"],album:["TALB","TAL"],year:["TYER","TYE"],comment:["COMM","COM"],track:["TRCK","TRK"],genre:["TCON","TCO"],picture:["APIC","PIC"],lyrics:["USLT","ULT"]},e=["title","artist","album","track"];b.m=function(b,c){b.f([0,a(6,b)],c)};b.n=function(c,g){var h=0,k=c.a(h+3);if(42.4"};var l=c.a(h+4),n=c.d(h+5,7),m=c.d(h+5,6),p=c.d(h+5,5),q=a(h+6,c),h=h+10;if(m)var u=c.i(h),h=h+(u+4);var k={version:"2."+k+"."+l,major:k,revision:l,flags:{unsynchronisation:n,extended_header:m,experimental_indicator:p}, -size:q},t;if(n)t={};else{for(var q=q-10,n=c,l=g,m={},p=k.major,u=[],r=0,v;v=(l||e)[r];r++)u=u.concat(f[v]||[v]);for(l=u;hl.indexOf(t)||(2

        Your browser does not understand the <audio> tag.

        ");e.audio=e.element+" audio"},g=function(){$(e.element).find("ul.mejs li").each(function(a,b){var c=$(b).attr("data-url");$(b).prepend('  '); -ID3.loadTags(c,function(){var b=ID3.getAllTags(c);if("undefined"!=typeof b.title){var d=b.title;"undefined"!=typeof b.artist&&(d=b.artist+" - "+d);$(e.element).find("ul.mejs li").each(function(b,c){a==b&&$(c).html(d)})}})})},h=function(){m();e.id3&&g()},k=function(){b=new MediaElementPlayer($(e.audio),{success:h,loop:e.loop,shuffle:e.shuffle,playlist:!0,audioHeight:32,playlistposition:"bottom",features:"playlistfeature prevtrack playpause nexttrack loop shuffle current progress duration volume".split(" "), -pluginPath:mejs.Utility.getScriptPath(["myplayer.min.js"])+"../plugins/"});$(e.element).append('')},l=function(a){for(var b=window.location.search.substring(1).split("&"),c=0;c'),$(".popupButton button").click(function(){var c=b.getCurrentTime(),d=b.getVolume(),f=b.media.paused,g=0;$(e.element).find("ul.mejs li").each(function(a){$(this).hasClass("current")&&(g=a)});a($(location).attr("href")+"?popup&paused="+f+"¤tTime="+ -c+"&volume="+d+"&trackNo="+g)});else{var c=$(window).height();window.onbeforeunload=function(){$("iframe",opener.top.document).height(c);$(".mejs-audio",opener.document).show();$(".playerDetached",opener.document).hide()}}}},m=function(){if(a){var c=l("paused")&&"true"==l("paused"),d=l("currentTime")?parseFloat(l("currentTime")):0,f=l("volume")?parseFloat(l("volume")):1,g=l("trackNo")?parseInt(l("trackNo")):0;b.setVolume(f);$(e.element).find("ul.mejs li").each(function(a){a==g&&(b.playTrack($(this)), -b.setCurrentTime(d))});c&&b.pause()}};!1!==l("popup")&&(a=!0,$("body").html('
        '),e.element="#myplayer");if("mp3url"==e.mode){var p="undefined"===typeof e.mp3url?$(location).attr("href").replace(/\?.*/,"").replace(/\/[^\/]+\/?$/,""):e.mp3url;$.ajax({url:p,type:"GET",success:function(a){d();var b=document.createElement("html");b.innerHTML=a;$(b).find("a").each(function(a,b){var c=$(b).attr("href"); -if(c.match(/\.mp3$/)){var c=p+"/"+c,d=b.innerHTML;$(e.audio).append('')}});k();n()}})}else if("m3u"==e.mode)c="undefined"===typeof e.m3u?$(location).attr("href").replace(/\?.*/,"").replace(/\/[^\/]+\/?$/,"/play.m3u"):e.m3u,d(),$.get(c,function(a){a=a.split("\n");for(var b=0,c=a.length;b')}k();n()});else if("list"== -e.mode){d();c=0;for(f=e.list.length;c')}k();n()}else $(e.element).append('

        Unsupported mode "'+e.mode+'"

        ')}; +/*! + * MediaElement.js + * http://www.mediaelementjs.com/ + * + * Wrapper that mimics native HTML5 MediaElement (audio and video) + * using a variety of technologies (pure JavaScript, iframe) + * + * Copyright 2010-2017, John Dyer (http://j.hn/) + * License: MIT + * + */ +!function r(a,s,l){function d(n,e){if(!s[n]){if(!a[n]){var t="function"==typeof require&&require;if(!e&&t)return t(n,!0);if(u)return u(n,!0);var o=new Error("Cannot find module '"+n+"'");throw o.code="MODULE_NOT_FOUND",o}var i=s[n]={exports:{}};a[n][0].call(i.exports,function(e){var t=a[n][1][e];return d(t||e)},i,i.exports,r,a,s,l)}return s[n].exports}for(var u="function"==typeof require&&require,e=0;e00:00':"",o=m.default.createElement("div");o.className=g.options.classPrefix+"time-rail",o.innerHTML=''+n+"",g.addControlElement(o,"progress"),g.options.keyActions.push({keys:[37,227],action:function(e){if(!isNaN(e.duration)&&0o+n.left&&(d=o+n.left),a=(l=d-n.left)/o,g.newTime=a*g.getDuration(),v&&null!==g.getCurrentTime()&&g.newTime.toFixed(4)!==g.getCurrentTime().toFixed(4)&&(g.setCurrentRailHandle(g.newTime),g.updateCurrent(g.newTime)),!y.IS_IOS&&!y.IS_ANDROID){if(l<0&&(l=0),g.options.useSmoothHover&&null!==r&&void 0!==window[r]){var u=new window[r](getComputedStyle(g.handle)[i]).m41,c=l/parseFloat(getComputedStyle(g.total).width)-u/parseFloat(getComputedStyle(g.total).width);g.hovered.style.left=u+"px",g.setTransformStyle(g.hovered,"scaleX("+c+")"),g.hovered.setAttribute("pos",l),0<=c?(0,b.removeClass)(g.hovered,"negative"):(0,b.addClass)(g.hovered,"negative")}if(g.timefloat){var f=g.timefloat.offsetWidth/2,m=mejs.Utils.offset(g.getElement(g.container)),p=getComputedStyle(g.timefloat);s=d-m.left=g.getElement(g.container).offsetWidth-f?g.total.offsetWidth-f:l,(0,b.hasClass)(g.getElement(g.container),g.options.classPrefix+"long-video")&&(s+=parseFloat(p.marginLeft)/2+g.timefloat.offsetWidth/2),g.timefloat.style.left=s+"px",g.timefloatcurrent.innerHTML=(0,E.secondsToTimeCode)(g.newTime,h.options.alwaysShowHours,h.options.showTimecodeFrameCount,h.options.framesPerSecond,h.options.secondsDecimalLength,h.options.timeFormat),g.timefloat.style.display="block"}}}else y.IS_IOS||y.IS_ANDROID||!g.timefloat||(s=g.timefloat.offsetWidth+o>=g.getElement(g.container).offsetWidth?g.timefloat.offsetWidth/2:0,g.timefloat.style.left=s+"px",g.timefloat.style.left=s+"px",g.timefloat.style.display="block")},f=function(){1e3<=new Date-u&&g.play()};g.slider.addEventListener("focus",function(){h.options.autoRewind=!1}),g.slider.addEventListener("blur",function(){h.options.autoRewind=t}),g.slider.addEventListener("keydown",function(e){if(1e3<=new Date-u&&(c=g.paused),g.options.enableKeyboard&&g.options.keyActions.length){var t=e.which||e.keyCode||0,n=g.getDuration(),o=h.options.defaultSeekForwardInterval(d),i=h.options.defaultSeekBackwardInterval(d),r=g.getCurrentTime(),a=g.getElement(g.container).querySelector("."+g.options.classPrefix+"volume-slider");if(38===t||40===t){a&&(a.style.display="block"),g.isVideo&&(g.showControls(),g.startControlsTimer());var s=38===t?Math.min(g.volume+.1,1):Math.max(g.volume-.1,0),l=s<=0;return g.setVolume(s),void g.setMuted(l)}switch(a&&(a.style.display="none"),t){case 37:g.getDuration()!==1/0&&(r-=i);break;case 39:g.getDuration()!==1/0&&(r+=o);break;case 36:r=0;break;case 35:r=n;break;case 13:case 32:return void(y.IS_FIREFOX&&(g.paused?g.play():g.pause()));default:return}r=r<0||isNaN(r)?0:n<=r?n:Math.floor(r),u=new Date,c||h.pause(),setTimeout(function(){g.setCurrentTime(r,!0)},0),r | "}),Object.assign(i.default.prototype,{buildcurrent:function(e,t,n,o){var i=this,r=a.default.createElement("div");r.className=i.options.classPrefix+"time",r.setAttribute("role","timer"),r.setAttribute("aria-live","off"),r.innerHTML=''+(0,s.secondsToTimeCode)(0,e.options.alwaysShowHours,e.options.showTimecodeFrameCount,e.options.framesPerSecond,e.options.secondsDecimalLength,e.options.timeFormat)+"",i.addControlElement(r,"current"),e.updateCurrent(),i.updateTimeCallback=function(){i.controlsAreVisible&&e.updateCurrent()},o.addEventListener("timeupdate",i.updateTimeCallback)},cleancurrent:function(e,t,n,o){o.removeEventListener("timeupdate",e.updateTimeCallback)},buildduration:function(e,t,n,o){var i=this;if(t.lastChild.querySelector("."+i.options.classPrefix+"currenttime"))t.querySelector("."+i.options.classPrefix+"time").innerHTML+=i.options.timeAndDurationSeparator+''+(0,s.secondsToTimeCode)(i.options.duration,i.options.alwaysShowHours,i.options.showTimecodeFrameCount,i.options.framesPerSecond,i.options.secondsDecimalLength,i.options.timeFormat)+"";else{t.querySelector("."+i.options.classPrefix+"currenttime")&&(0,l.addClass)(t.querySelector("."+i.options.classPrefix+"currenttime").parentNode,i.options.classPrefix+"currenttime-container");var r=a.default.createElement("div");r.className=i.options.classPrefix+"time "+i.options.classPrefix+"duration-container",r.innerHTML=''+(0,s.secondsToTimeCode)(i.options.duration,i.options.alwaysShowHours,i.options.showTimecodeFrameCount,i.options.framesPerSecond,i.options.secondsDecimalLength,i.options.timeFormat)+"",i.addControlElement(r,"duration")}i.updateDurationCallback=function(){i.controlsAreVisible&&e.updateDuration()},o.addEventListener("timeupdate",i.updateDurationCallback)},cleanduration:function(e,t,n,o){o.removeEventListener("timeupdate",e.updateDurationCallback)},updateCurrent:function(){var e=this,t=e.getCurrentTime();isNaN(t)&&(t=0);var n=(0,s.secondsToTimeCode)(t,e.options.alwaysShowHours,e.options.showTimecodeFrameCount,e.options.framesPerSecond,e.options.secondsDecimalLength,e.options.timeFormat);5
        ",n.addControlElement(t.captionsButton,"tracks"),t.captionsButton.querySelector("."+n.options.classPrefix+"captions-selector-input").disabled=!1,t.chaptersButton=g.default.createElement("div"),t.chaptersButton.className=n.options.classPrefix+"button "+n.options.classPrefix+"chapters-button",t.chaptersButton.innerHTML=(0,S.generateControlButton)(n.id,i,i,""+n.media.options.iconSprite,["icon-chapters"],""+n.options.classPrefix)+'
          ';var r=n.getSubtitles();0"},removeCaptionsIfEmpty:function(){if(this.captionsButton&&this.options.hideCaptionsButtonWhenEmpty){var e=this.getSubtitles().filter(function(e){return!e.isError}).length;this.captionsButton.style.display=0";for(var r=i.chaptersButton.querySelectorAll('input[type="radio"]'),a=i.chaptersButton.querySelectorAll("."+i.options.classPrefix+"chapters-selector-label"),s=0;s>1].start,a=e[i].stop,r<=t&&t'+i+'
          ',a.addControlElement(d,"volume"),a.options.keyActions.push({keys:[38],action:function(e){var t=e.getElement(e.container).querySelector("."+a.options.classPrefix+"volume-slider");t&&t.matches(":focus")&&(t.style.display="block"),e.isVideo&&(e.showControls(),e.startControlsTimer());var n=Math.min(e.volume+.1,1);e.setVolume(n),0'+i+'
          ',d.parentNode.insertBefore(u,d.nextSibling)}var c=!1,f=!1,m=!1,p="vertical"===s?a.getElement(a.container).querySelector("."+a.options.classPrefix+"volume-slider"):a.getElement(a.container).querySelector("."+a.options.classPrefix+"horizontal-volume-slider"),h="vertical"===s?a.getElement(a.container).querySelector("."+a.options.classPrefix+"volume-total"):a.getElement(a.container).querySelector("."+a.options.classPrefix+"horizontal-volume-total"),v="vertical"===s?a.getElement(a.container).querySelector("."+a.options.classPrefix+"volume-current"):a.getElement(a.container).querySelector("."+a.options.classPrefix+"horizontal-volume-current"),g="vertical"===s?a.getElement(a.container).querySelector("."+a.options.classPrefix+"volume-handle"):a.getElement(a.container).querySelector("."+a.options.classPrefix+"horizontal-volume-handle"),y=function(e){if(null!==e&&!isNaN(e)&&void 0!==e){if(e=Math.max(0,e),0===(e=Math.min(e,1))){(0,T.removeClass)(d,a.options.classPrefix+"mute"),(0,T.addClass)(d,a.options.classPrefix+"unmute");var t=d.firstElementChild;t.setAttribute("title",l),t.setAttribute("aria-label",l)}else{(0,T.removeClass)(d,a.options.classPrefix+"unmute"),(0,T.addClass)(d,a.options.classPrefix+"mute");var n=d.firstElementChild;n.setAttribute("title",r),n.setAttribute("aria-label",r)}var o=100*e+"%",i=getComputedStyle(g);"vertical"===s?(v.style.bottom=0,v.style.height=o,g.style.bottom=o,g.style.marginBottom=-parseFloat(i.height)/2+"px"):(v.style.left=0,v.style.width=o,g.style.left=o,g.style.marginLeft=-parseFloat(i.width)/2+"px")}},E=function(e){var t=(0,T.offset)(h),n=getComputedStyle(h);m=!0;var o=null;if("vertical"===s){var i=parseFloat(n.height);if(o=(i-(e.pageY-t.top))/i,0===t.top||0===t.left)return}else{var r=parseFloat(n.width);o=(e.pageX-t.left)/r}o=Math.max(0,o),o=Math.min(o,1),y(o),a.setMuted(0===o),a.setVolume(o),e.preventDefault(),e.stopPropagation()},b=function(){a.muted?(y(0),(0,T.removeClass)(d,a.options.classPrefix+"mute"),(0,T.addClass)(d,a.options.classPrefix+"unmute")):(y(o.volume),(0,T.removeClass)(d,a.options.classPrefix+"unmute"),(0,T.addClass)(d,a.options.classPrefix+"mute"))};e.getElement(e.container).addEventListener("keydown",function(e){!!e.target.closest("."+a.options.classPrefix+"container")||"vertical"!==s||(p.style.display="none")}),d.addEventListener("mouseenter",function(e){e.target===d&&(p.style.display="block",f=!0,e.preventDefault(),e.stopPropagation())}),d.addEventListener("focusin",function(){p.style.display="block",f=!0}),d.addEventListener("focusout",function(e){e.relatedTarget&&(!e.relatedTarget||e.relatedTarget.matches("."+a.options.classPrefix+"volume-slider"))||"vertical"!==s||(p.style.display="none")}),d.addEventListener("mouseleave",function(){f=!1,c||"vertical"!==s||(p.style.display="none")}),d.addEventListener("focusout",function(){f=!1}),d.addEventListener("keydown",function(e){if(a.options.enableKeyboard&&a.options.keyActions.length){var t=e.which||e.keyCode||0,n=o.volume;switch(t){case 38:n=Math.min(n+.1,1);break;case 40:n=Math.max(0,n-.1);break;default:return!0}c=!1,y(n),o.setVolume(n),e.preventDefault(),e.stopPropagation()}}),d.querySelector("button").addEventListener("click",function(){o.setMuted(!o.muted);var e=(0,C.createEvent)("volumechange",o);o.dispatchEvent(e)}),p.addEventListener("dragstart",function(){return!1}),p.addEventListener("mouseover",function(){f=!0}),p.addEventListener("focusin",function(){p.style.display="block",f=!0}),p.addEventListener("focusout",function(){f=!1,c||"vertical"!==s||(p.style.display="none")}),p.addEventListener("mousedown",function(e){E(e),a.globalBind("mousemove.vol",function(e){var t=e.target,n="function"==typeof t.closest,o=t.closest("vertical"===s?"."+a.options.classPrefix+"volume-slider":"."+a.options.classPrefix+"horizontal-volume-slider");c&&(t===p||n&&o)&&E(e)}),a.globalBind("mouseup.vol",function(){c=!1,f||"vertical"!==s||(p.style.display="none")}),c=!0,e.preventDefault(),e.stopPropagation()}),o.addEventListener("volumechange",function(e){var t;c||b(),t=Math.floor(100*o.volume),p.setAttribute("aria-valuenow",t),p.setAttribute("aria-valuetext",t+"%")});var S=!1;o.addEventListener("rendererready",function(){m||setTimeout(function(){S=!0,(0===e.options.startVolume||o.originalNode.muted)&&o.setMuted(!0),o.setVolume(e.options.startVolume),a.setControlsSize()},250)}),o.addEventListener("loadedmetadata",function(){setTimeout(function(){m||S||((0===e.options.startVolume||o.originalNode.muted)&&o.setMuted(!0),0===e.options.startVolume&&(e.options.startVolume=0),o.setVolume(e.options.startVolume),a.setControlsSize()),S=!1},250)}),(0===e.options.startVolume||o.originalNode.muted)&&(o.setMuted(!0),0===e.options.startVolume&&(e.options.startVolume=0),b()),a.getElement(a.container).addEventListener("controlsresize",function(){b()})}}})},{17:17,2:2,24:24,25:25,26:26,27:27,6:6}],16:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.EN={"mejs.plural-form":1,"mejs.download-file":"Download File","mejs.fullscreen":"Fullscreen","mejs.play":"Play","mejs.pause":"Pause","mejs.time-slider":"Time Slider","mejs.time-help-text":"Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.","mejs.live-broadcast":"Live Broadcast","mejs.volume-help-text":"Use Up/Down Arrow keys to increase or decrease volume.","mejs.unmute":"Unmute","mejs.mute":"Mute","mejs.volume-slider":"Volume Slider","mejs.video-player":"Video Player","mejs.audio-player":"Audio Player","mejs.captions-subtitles":"Captions/Subtitles","mejs.captions-chapters":"Chapters","mejs.none":"None","mejs.afrikaans":"Afrikaans","mejs.albanian":"Albanian","mejs.arabic":"Arabic","mejs.belarusian":"Belarusian","mejs.bulgarian":"Bulgarian","mejs.catalan":"Catalan","mejs.chinese":"Chinese","mejs.chinese-simplified":"Chinese (Simplified)","mejs.chinese-traditional":"Chinese (Traditional)","mejs.croatian":"Croatian","mejs.czech":"Czech","mejs.danish":"Danish","mejs.dutch":"Dutch","mejs.english":"English","mejs.estonian":"Estonian","mejs.filipino":"Filipino","mejs.finnish":"Finnish","mejs.french":"French","mejs.galician":"Galician","mejs.german":"German","mejs.greek":"Greek","mejs.haitian-creole":"Haitian Creole","mejs.hebrew":"Hebrew","mejs.hindi":"Hindi","mejs.hungarian":"Hungarian","mejs.icelandic":"Icelandic","mejs.indonesian":"Indonesian","mejs.irish":"Irish","mejs.italian":"Italian","mejs.japanese":"Japanese","mejs.korean":"Korean","mejs.latvian":"Latvian","mejs.lithuanian":"Lithuanian","mejs.macedonian":"Macedonian","mejs.malay":"Malay","mejs.maltese":"Maltese","mejs.norwegian":"Norwegian","mejs.persian":"Persian","mejs.polish":"Polish","mejs.portuguese":"Portuguese","mejs.romanian":"Romanian","mejs.russian":"Russian","mejs.serbian":"Serbian","mejs.slovak":"Slovak","mejs.slovenian":"Slovenian","mejs.spanish":"Spanish","mejs.swahili":"Swahili","mejs.swedish":"Swedish","mejs.tagalog":"Tagalog","mejs.thai":"Thai","mejs.turkish":"Turkish","mejs.ukrainian":"Ukrainian","mejs.vietnamese":"Vietnamese","mejs.welsh":"Welsh","mejs.yiddish":"Yiddish"}},{}],17:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.config=void 0;var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){function o(e,t){for(var n=0;n
          ',n.getElement(n.container).addEventListener("focus",function(e){if(!n.controlsAreVisible&&!n.hasFocus&&n.controlsEnabled){n.showControls(!0);var t=(0,c.isNodeAfter)(e.relatedTarget,n.getElement(n.container))?"."+n.options.classPrefix+"controls ."+n.options.classPrefix+"button:last-child > button":"."+n.options.classPrefix+"playpause-button > button";n.getElement(n.container).querySelector(t).focus()}}),n.node.parentNode.insertBefore(n.getElement(n.container),n.node),n.options.features.length||n.options.useDefaultControls||(n.getElement(n.container).style.background="transparent",n.getElement(n.container).querySelector("."+n.options.classPrefix+"controls").style.display="none"),n.isVideo&&"fill"===n.options.stretching&&!P.hasClass(n.getElement(n.container).parentNode,n.options.classPrefix+"fill-container")){n.outerContainer=n.media.parentNode;var r=w.default.createElement("div");r.className=n.options.classPrefix+"fill-container",n.getElement(n.container).parentNode.insertBefore(r,n.getElement(n.container)),r.appendChild(n.getElement(n.container))}x.IS_ANDROID&&P.addClass(n.getElement(n.container),n.options.classPrefix+"android"),x.IS_IOS&&P.addClass(n.getElement(n.container),n.options.classPrefix+"ios"),x.IS_IPAD&&P.addClass(n.getElement(n.container),n.options.classPrefix+"ipad"),x.IS_IPHONE&&P.addClass(n.getElement(n.container),n.options.classPrefix+"iphone"),P.addClass(n.getElement(n.container),n.isVideo?n.options.classPrefix+"video":n.options.classPrefix+"audio"),n.getElement(n.container).querySelector("."+n.options.classPrefix+"mediaelement").appendChild(n.node),(n.media.player=n).controls=n.getElement(n.container).querySelector("."+n.options.classPrefix+"controls"),n.layers=n.getElement(n.container).querySelector("."+n.options.classPrefix+"layers");var a=n.isVideo?"video":"audio",s=a.substring(0,1).toUpperCase()+a.substring(1);0=n.width?n.width/n.height:n.height/n.width,n.setPlayerSize(n.width,n.height)}if(e.pluginWidth=n.width,e.pluginHeight=n.height,f.default.MepDefaults=e,new d.default(n.media,e,n.mediaFiles),void 0!==n.getElement(n.container)&&n.options.features.length&&n.controlsAreVisible&&!n.options.hideVideoControlsOnLoad){var l=(0,c.createEvent)("controlsshown",n.getElement(n.container));n.getElement(n.container).dispatchEvent(l)}}},{key:"updateNode",value:function(e){var t=void 0,n=void 0,o=e.detail.target.hasOwnProperty("mediaElement")?e.detail.target.mediaElement:e.detail.target,i=o.originalNode;e.detail.isIframe?(n=o.renderer.id,(t=o.querySelector("#"+n)).style.position="absolute",i.style.maxWidth&&(t.style.maxWidth=i.style.maxWidth)):t=e.detail.target,this.domNode=t,this.node=t}},{key:"showControls",value:function(e){var i=this;if(e=void 0===e||e,!i.controlsAreVisible&&i.isVideo){if(e)!function(){P.fadeIn(i.getElement(i.controls),200,function(){P.removeClass(i.getElement(i.controls),i.options.classPrefix+"offscreen");var e=(0,c.createEvent)("controlsshown",i.getElement(i.container));i.getElement(i.container).dispatchEvent(e)});for(var n=i.getElement(i.container).querySelectorAll("."+i.options.classPrefix+"control"),e=function(e,t){P.fadeIn(n[e],200,function(){P.removeClass(n[e],i.options.classPrefix+"offscreen")})},t=0,o=n.length;t'),e.message&&(a="

          "+e.message+"

          "),e.urls)for(var d=0,u=e.urls.length;d'+f.default.i18n.t("mejs.download-file")+": "+c.src+""}}a&&o.getElement(o.layers).querySelector("."+o.options.classPrefix+"overlay-error")&&(r.innerHTML=a,o.getElement(o.layers).querySelector("."+o.options.classPrefix+"overlay-error").innerHTML=""+s+r.outerHTML,o.getElement(o.layers).querySelector("."+o.options.classPrefix+"overlay-error").parentNode.style.display="block"),o.controlsEnabled&&o.disableControls()}},{key:"setPlayerSize",value:function(e,t){var n=this;if(!n.options.setDimensions)return!1;switch(void 0!==e&&(n.width=e),void 0!==t&&(n.height=t),n.options.stretching){case"fill":n.isVideo?n.setFillMode():n.setDimensions(n.width,n.height);break;case"responsive":n.setResponsiveMode();break;case"none":n.setDimensions(n.width,n.height);break;default:!0===n.hasFluidMode()?n.setResponsiveMode():n.setDimensions(n.width,n.height)}}},{key:"hasFluidMode",value:function(){var e=this;return-1!==e.height.toString().indexOf("%")||e.node&&e.node.style.maxWidth&&"none"!==e.node.style.maxWidth&&e.node.style.maxWidth!==e.width||e.node&&e.node.currentStyle&&"100%"===e.node.currentStyle.maxWidth}},{key:"setResponsiveMode",value:function(){var o=this,e=function(){for(var t=void 0,n=o.getElement(o.container);n;){try{if(x.IS_FIREFOX&&"html"===n.tagName.toLowerCase()&&S.default.self!==S.default.top&&null!==S.default.frameElement)return S.default.frameElement;t=n.parentElement}catch(e){t=n.parentElement}if(t&&P.visible(t))return t;n=t}return null}(),t=e?getComputedStyle(e,null):getComputedStyle(w.default.body,null),n=o.isVideo?o.node.videoWidth&&0=o.width?o.node.videoWidth/o.node.videoHeight:o.node.videoHeight/o.node.videoWidth:o.initialAspectRatio,(isNaN(e)||e<.01||100=o.width?parseFloat(l/r,10):parseFloat(l*r,10):i)<=o.container.querySelector("."+o.options.classPrefix+"inner").offsetHeight&&(s=o.container.querySelector("."+o.options.classPrefix+"inner").offsetHeight),isNaN(s)&&(s=a),0img");a&&(a.style.display="");for(var s=e.getElement(e.container).querySelectorAll("object, embed, iframe, video"),l=parseFloat(e.height,10),d=parseFloat(e.width,10),u=i,c=l*i/d,f=d*r/l,m=r,p=i
          \n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
          ',n.appendChild(r),a.style.display="none",a.className=i.options.classPrefix+"overlay "+i.options.classPrefix+"layer",a.innerHTML='
          ',n.appendChild(a),s.className=i.options.classPrefix+"overlay "+i.options.classPrefix+"layer "+i.options.classPrefix+"overlay-play",s.innerHTML=(0,h.generateControlButton)(i.id,u.default.t("mejs.play"),u.default.t("mejs.play"),""+i.media.options.iconSprite,["icon-overlay-play"],""+i.options.classPrefix,i.options.classPrefix+"overlay-button","",!1),s.addEventListener("click",function(){if(i.options.clickToPlayPause){var e=i.getElement(i.container).querySelector("."+i.options.classPrefix+"overlay-button"),t=e.getAttribute("aria-pressed");i.paused?i.play():i.pause(),e.setAttribute("aria-pressed",!!t),i.getElement(i.container).focus()}}),s.addEventListener("keydown",function(e){var t=e.keyCode||e.which||0;if(13===t||x.IS_FIREFOX&&32===t){var n=(0,c.createEvent)("click",s);return s.dispatchEvent(n),!1}}),n.appendChild(s),null!==i.media.rendererName&&(/(youtube|facebook)/i.test(i.media.rendererName)&&!(i.media.originalNode.getAttribute("poster")||t.options.poster||"function"==typeof i.media.renderer.getPosterUrl&&i.media.renderer.getPosterUrl())||x.IS_STOCK_ANDROID||i.media.originalNode.getAttribute("autoplay"))&&(s.style.display="none");var l=!1;o.addEventListener("play",function(){s.style.display="none",r.style.display="none",a.style.display="none",l=!1}),o.addEventListener("playing",function(){s.style.display="none",r.style.display="none",a.style.display="none",l=!1}),o.addEventListener("seeking",function(){s.style.display="none",r.style.display="",l=!1}),o.addEventListener("seeked",function(){s.style.display=i.paused&&!x.IS_STOCK_ANDROID?"":"none",r.style.display="none",l=!1}),o.addEventListener("pause",function(){r.style.display="none",x.IS_STOCK_ANDROID||l||(s.style.display=""),l=!1}),o.addEventListener("waiting",function(){r.style.display="",l=!1}),o.addEventListener("loadeddata",function(){r.style.display="",x.IS_ANDROID&&(o.canplayTimeout=setTimeout(function(){if(w.default.createEvent){var e=w.default.createEvent("HTMLEvents");return e.initEvent("canplay",!0,!0),o.dispatchEvent(e)}},300)),l=!1}),o.addEventListener("canplay",function(){r.style.display="none",clearTimeout(o.canplayTimeout),l=!1}),o.addEventListener("error",function(e){i._handleError(e,i.media,i.node),r.style.display="none",s.style.display="none",l=!0}),o.addEventListener("loadedmetadata",function(){i.controlsEnabled||i.enableControls()}),o.addEventListener("keydown",function(e){i.onkeydown(t,o,e),l=!1})}}},{key:"buildkeyboard",value:function(o,e,t,i){var r=this;r.getElement(r.container).addEventListener("keydown",function(){r.keyboardAction=!0}),r.globalKeydownCallback=function(e){if(!w.default.activeElement)return!0;var t=w.default.activeElement.closest("."+r.options.classPrefix+"container"),n=r.media.closest("."+r.options.classPrefix+"container");return r.hasFocus=!(!t||!n||t.id!==n.id),r.onkeydown(o,i,e)},r.globalClickCallback=function(e){r.hasFocus=!!e.target.closest("."+r.options.classPrefix+"container")},r.globalBind("keydown",r.globalKeydownCallback),r.globalBind("click",r.globalClickCallback)}},{key:"onkeydown",value:function(e,t,n){if(e.hasFocus&&e.options.enableKeyboard)for(var o=0,i=e.options.keyActions.length;oimg");(e&&l.node.setAttribute("poster",e.src),delete l.node.autoplay,l.node.setAttribute("src",""),""!==l.media.canPlayType((0,p.getTypeFromFile)(u))&&l.node.setAttribute("src",u),d&&-1":">",'"':"""};return e.replace(/[&<>"]/g,function(e){return t[e]})}function s(o,i){var r=this,a=arguments,s=2