[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /*! 2 * MediaElement.js 3 * http://www.mediaelementjs.com/ 4 * 5 * Wrapper that mimics native HTML5 MediaElement (audio and video) 6 * using a variety of technologies (pure JavaScript, Flash, iframe) 7 * 8 * Copyright 2010-2017, John Dyer (http://j.hn/) 9 * License: MIT 10 * 11 */(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<r.length;o++)s(r[o]);return s}return e})()({1:[function(_dereq_,module,exports){ 12 13 },{}],2:[function(_dereq_,module,exports){ 14 (function (global){ 15 var topLevel = typeof global !== 'undefined' ? global : 16 typeof window !== 'undefined' ? window : {} 17 var minDoc = _dereq_(1); 18 19 var doccy; 20 21 if (typeof document !== 'undefined') { 22 doccy = document; 23 } else { 24 doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4']; 25 26 if (!doccy) { 27 doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc; 28 } 29 } 30 31 module.exports = doccy; 32 33 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 34 },{"1":1}],3:[function(_dereq_,module,exports){ 35 (function (global){ 36 var win; 37 38 if (typeof window !== "undefined") { 39 win = window; 40 } else if (typeof global !== "undefined") { 41 win = global; 42 } else if (typeof self !== "undefined"){ 43 win = self; 44 } else { 45 win = {}; 46 } 47 48 module.exports = win; 49 50 }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 51 },{}],4:[function(_dereq_,module,exports){ 52 (function (root) { 53 54 // Store setTimeout reference so promise-polyfill will be unaffected by 55 // other code modifying setTimeout (like sinon.useFakeTimers()) 56 var setTimeoutFunc = setTimeout; 57 58 function noop() {} 59 60 // Polyfill for Function.prototype.bind 61 function bind(fn, thisArg) { 62 return function () { 63 fn.apply(thisArg, arguments); 64 }; 65 } 66 67 function Promise(fn) { 68 if (typeof this !== 'object') throw new TypeError('Promises must be constructed via new'); 69 if (typeof fn !== 'function') throw new TypeError('not a function'); 70 this._state = 0; 71 this._handled = false; 72 this._value = undefined; 73 this._deferreds = []; 74 75 doResolve(fn, this); 76 } 77 78 function handle(self, deferred) { 79 while (self._state === 3) { 80 self = self._value; 81 } 82 if (self._state === 0) { 83 self._deferreds.push(deferred); 84 return; 85 } 86 self._handled = true; 87 Promise._immediateFn(function () { 88 var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected; 89 if (cb === null) { 90 (self._state === 1 ? resolve : reject)(deferred.promise, self._value); 91 return; 92 } 93 var ret; 94 try { 95 ret = cb(self._value); 96 } catch (e) { 97 reject(deferred.promise, e); 98 return; 99 } 100 resolve(deferred.promise, ret); 101 }); 102 } 103 104 function resolve(self, newValue) { 105 try { 106 // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure 107 if (newValue === self) throw new TypeError('A promise cannot be resolved with itself.'); 108 if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) { 109 var then = newValue.then; 110 if (newValue instanceof Promise) { 111 self._state = 3; 112 self._value = newValue; 113 finale(self); 114 return; 115 } else if (typeof then === 'function') { 116 doResolve(bind(then, newValue), self); 117 return; 118 } 119 } 120 self._state = 1; 121 self._value = newValue; 122 finale(self); 123 } catch (e) { 124 reject(self, e); 125 } 126 } 127 128 function reject(self, newValue) { 129 self._state = 2; 130 self._value = newValue; 131 finale(self); 132 } 133 134 function finale(self) { 135 if (self._state === 2 && self._deferreds.length === 0) { 136 Promise._immediateFn(function() { 137 if (!self._handled) { 138 Promise._unhandledRejectionFn(self._value); 139 } 140 }); 141 } 142 143 for (var i = 0, len = self._deferreds.length; i < len; i++) { 144 handle(self, self._deferreds[i]); 145 } 146 self._deferreds = null; 147 } 148 149 function Handler(onFulfilled, onRejected, promise) { 150 this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null; 151 this.onRejected = typeof onRejected === 'function' ? onRejected : null; 152 this.promise = promise; 153 } 154 155 /** 156 * Take a potentially misbehaving resolver function and make sure 157 * onFulfilled and onRejected are only called once. 158 * 159 * Makes no guarantees about asynchrony. 160 */ 161 function doResolve(fn, self) { 162 var done = false; 163 try { 164 fn(function (value) { 165 if (done) return; 166 done = true; 167 resolve(self, value); 168 }, function (reason) { 169 if (done) return; 170 done = true; 171 reject(self, reason); 172 }); 173 } catch (ex) { 174 if (done) return; 175 done = true; 176 reject(self, ex); 177 } 178 } 179 180 Promise.prototype['catch'] = function (onRejected) { 181 return this.then(null, onRejected); 182 }; 183 184 Promise.prototype.then = function (onFulfilled, onRejected) { 185 var prom = new (this.constructor)(noop); 186 187 handle(this, new Handler(onFulfilled, onRejected, prom)); 188 return prom; 189 }; 190 191 Promise.all = function (arr) { 192 var args = Array.prototype.slice.call(arr); 193 194 return new Promise(function (resolve, reject) { 195 if (args.length === 0) return resolve([]); 196 var remaining = args.length; 197 198 function res(i, val) { 199 try { 200 if (val && (typeof val === 'object' || typeof val === 'function')) { 201 var then = val.then; 202 if (typeof then === 'function') { 203 then.call(val, function (val) { 204 res(i, val); 205 }, reject); 206 return; 207 } 208 } 209 args[i] = val; 210 if (--remaining === 0) { 211 resolve(args); 212 } 213 } catch (ex) { 214 reject(ex); 215 } 216 } 217 218 for (var i = 0; i < args.length; i++) { 219 res(i, args[i]); 220 } 221 }); 222 }; 223 224 Promise.resolve = function (value) { 225 if (value && typeof value === 'object' && value.constructor === Promise) { 226 return value; 227 } 228 229 return new Promise(function (resolve) { 230 resolve(value); 231 }); 232 }; 233 234 Promise.reject = function (value) { 235 return new Promise(function (resolve, reject) { 236 reject(value); 237 }); 238 }; 239 240 Promise.race = function (values) { 241 return new Promise(function (resolve, reject) { 242 for (var i = 0, len = values.length; i < len; i++) { 243 values[i].then(resolve, reject); 244 } 245 }); 246 }; 247 248 // Use polyfill for setImmediate for performance gains 249 Promise._immediateFn = (typeof setImmediate === 'function' && function (fn) { setImmediate(fn); }) || 250 function (fn) { 251 setTimeoutFunc(fn, 0); 252 }; 253 254 Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) { 255 if (typeof console !== 'undefined' && console) { 256 console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console 257 } 258 }; 259 260 /** 261 * Set the immediate function to execute callbacks 262 * @param fn {function} Function to execute 263 * @deprecated 264 */ 265 Promise._setImmediateFn = function _setImmediateFn(fn) { 266 Promise._immediateFn = fn; 267 }; 268 269 /** 270 * Change the function to execute on unhandled rejection 271 * @param {function} fn Function to execute on unhandled rejection 272 * @deprecated 273 */ 274 Promise._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) { 275 Promise._unhandledRejectionFn = fn; 276 }; 277 278 if (typeof module !== 'undefined' && module.exports) { 279 module.exports = Promise; 280 } else if (!root.Promise) { 281 root.Promise = Promise; 282 } 283 284 })(this); 285 286 },{}],5:[function(_dereq_,module,exports){ 287 'use strict'; 288 289 Object.defineProperty(exports, "__esModule", { 290 value: true 291 }); 292 293 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; }; 294 295 var _mejs = _dereq_(7); 296 297 var _mejs2 = _interopRequireDefault(_mejs); 298 299 var _en = _dereq_(9); 300 301 var _general = _dereq_(18); 302 303 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 304 305 var i18n = { lang: 'en', en: _en.EN }; 306 307 i18n.language = function () { 308 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { 309 args[_key] = arguments[_key]; 310 } 311 312 if (args !== null && args !== undefined && args.length) { 313 314 if (typeof args[0] !== 'string') { 315 throw new TypeError('Language code must be a string value'); 316 } 317 318 if (!/^[a-z]{2,3}((\-|_)[a-z]{2})?$/i.test(args[0])) { 319 throw new TypeError('Language code must have format 2-3 letters and. optionally, hyphen, underscore followed by 2 more letters'); 320 } 321 322 i18n.lang = args[0]; 323 324 if (i18n[args[0]] === undefined) { 325 args[1] = args[1] !== null && args[1] !== undefined && _typeof(args[1]) === 'object' ? args[1] : {}; 326 i18n[args[0]] = !(0, _general.isObjectEmpty)(args[1]) ? args[1] : _en.EN; 327 } else if (args[1] !== null && args[1] !== undefined && _typeof(args[1]) === 'object') { 328 i18n[args[0]] = args[1]; 329 } 330 } 331 332 return i18n.lang; 333 }; 334 335 i18n.t = function (message) { 336 var pluralParam = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 337 338 339 if (typeof message === 'string' && message.length) { 340 341 var str = void 0, 342 pluralForm = void 0; 343 344 var language = i18n.language(); 345 346 var _plural = function _plural(input, number, form) { 347 348 if ((typeof input === 'undefined' ? 'undefined' : _typeof(input)) !== 'object' || typeof number !== 'number' || typeof form !== 'number') { 349 return input; 350 } 351 352 var _pluralForms = function () { 353 return [function () { 354 return arguments.length <= 1 ? undefined : arguments[1]; 355 }, function () { 356 return (arguments.length <= 0 ? undefined : arguments[0]) === 1 ? arguments.length <= 1 ? undefined : arguments[1] : arguments.length <= 2 ? undefined : arguments[2]; 357 }, function () { 358 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]; 359 }, function () { 360 if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 === 1 && (arguments.length <= 0 ? undefined : arguments[0]) % 100 !== 11) { 361 return arguments.length <= 1 ? undefined : arguments[1]; 362 } else if ((arguments.length <= 0 ? undefined : arguments[0]) !== 0) { 363 return arguments.length <= 2 ? undefined : arguments[2]; 364 } else { 365 return arguments.length <= 3 ? undefined : arguments[3]; 366 } 367 }, function () { 368 if ((arguments.length <= 0 ? undefined : arguments[0]) === 1 || (arguments.length <= 0 ? undefined : arguments[0]) === 11) { 369 return arguments.length <= 1 ? undefined : arguments[1]; 370 } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 2 || (arguments.length <= 0 ? undefined : arguments[0]) === 12) { 371 return arguments.length <= 2 ? undefined : arguments[2]; 372 } else if ((arguments.length <= 0 ? undefined : arguments[0]) > 2 && (arguments.length <= 0 ? undefined : arguments[0]) < 20) { 373 return arguments.length <= 3 ? undefined : arguments[3]; 374 } else { 375 return arguments.length <= 4 ? undefined : arguments[4]; 376 } 377 }, function () { 378 if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { 379 return arguments.length <= 1 ? undefined : arguments[1]; 380 } 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) { 381 return arguments.length <= 2 ? undefined : arguments[2]; 382 } else { 383 return arguments.length <= 3 ? undefined : arguments[3]; 384 } 385 }, function () { 386 if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 === 1 && (arguments.length <= 0 ? undefined : arguments[0]) % 100 !== 11) { 387 return arguments.length <= 1 ? undefined : arguments[1]; 388 } 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)) { 389 return arguments.length <= 2 ? undefined : arguments[2]; 390 } else { 391 return [3]; 392 } 393 }, function () { 394 if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 === 1 && (arguments.length <= 0 ? undefined : arguments[0]) % 100 !== 11) { 395 return arguments.length <= 1 ? undefined : arguments[1]; 396 } 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)) { 397 return arguments.length <= 2 ? undefined : arguments[2]; 398 } else { 399 return arguments.length <= 3 ? undefined : arguments[3]; 400 } 401 }, function () { 402 if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { 403 return arguments.length <= 1 ? undefined : arguments[1]; 404 } else if ((arguments.length <= 0 ? undefined : arguments[0]) >= 2 && (arguments.length <= 0 ? undefined : arguments[0]) <= 4) { 405 return arguments.length <= 2 ? undefined : arguments[2]; 406 } else { 407 return arguments.length <= 3 ? undefined : arguments[3]; 408 } 409 }, function () { 410 if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { 411 return arguments.length <= 1 ? undefined : arguments[1]; 412 } 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)) { 413 return arguments.length <= 2 ? undefined : arguments[2]; 414 } else { 415 return arguments.length <= 3 ? undefined : arguments[3]; 416 } 417 }, function () { 418 if ((arguments.length <= 0 ? undefined : arguments[0]) % 100 === 1) { 419 return arguments.length <= 2 ? undefined : arguments[2]; 420 } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 100 === 2) { 421 return arguments.length <= 3 ? undefined : arguments[3]; 422 } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 100 === 3 || (arguments.length <= 0 ? undefined : arguments[0]) % 100 === 4) { 423 return arguments.length <= 4 ? undefined : arguments[4]; 424 } else { 425 return arguments.length <= 1 ? undefined : arguments[1]; 426 } 427 }, function () { 428 if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { 429 return arguments.length <= 1 ? undefined : arguments[1]; 430 } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 2) { 431 return arguments.length <= 2 ? undefined : arguments[2]; 432 } else if ((arguments.length <= 0 ? undefined : arguments[0]) > 2 && (arguments.length <= 0 ? undefined : arguments[0]) < 7) { 433 return arguments.length <= 3 ? undefined : arguments[3]; 434 } else if ((arguments.length <= 0 ? undefined : arguments[0]) > 6 && (arguments.length <= 0 ? undefined : arguments[0]) < 11) { 435 return arguments.length <= 4 ? undefined : arguments[4]; 436 } else { 437 return arguments.length <= 5 ? undefined : arguments[5]; 438 } 439 }, function () { 440 if ((arguments.length <= 0 ? undefined : arguments[0]) === 0) { 441 return arguments.length <= 1 ? undefined : arguments[1]; 442 } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { 443 return arguments.length <= 2 ? undefined : arguments[2]; 444 } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 2) { 445 return arguments.length <= 3 ? undefined : arguments[3]; 446 } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 100 >= 3 && (arguments.length <= 0 ? undefined : arguments[0]) % 100 <= 10) { 447 return arguments.length <= 4 ? undefined : arguments[4]; 448 } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 100 >= 11) { 449 return arguments.length <= 5 ? undefined : arguments[5]; 450 } else { 451 return arguments.length <= 6 ? undefined : arguments[6]; 452 } 453 }, function () { 454 if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { 455 return arguments.length <= 1 ? undefined : arguments[1]; 456 } 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) { 457 return arguments.length <= 2 ? undefined : arguments[2]; 458 } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 100 > 10 && (arguments.length <= 0 ? undefined : arguments[0]) % 100 < 20) { 459 return arguments.length <= 3 ? undefined : arguments[3]; 460 } else { 461 return arguments.length <= 4 ? undefined : arguments[4]; 462 } 463 }, function () { 464 if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 === 1) { 465 return arguments.length <= 1 ? undefined : arguments[1]; 466 } else if ((arguments.length <= 0 ? undefined : arguments[0]) % 10 === 2) { 467 return arguments.length <= 2 ? undefined : arguments[2]; 468 } else { 469 return arguments.length <= 3 ? undefined : arguments[3]; 470 } 471 }, function () { 472 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]; 473 }, function () { 474 if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { 475 return arguments.length <= 1 ? undefined : arguments[1]; 476 } 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)) { 477 return arguments.length <= 2 ? undefined : arguments[2]; 478 } else { 479 return arguments.length <= 3 ? undefined : arguments[3]; 480 } 481 }, function () { 482 if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { 483 return arguments.length <= 1 ? undefined : arguments[1]; 484 } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 2) { 485 return arguments.length <= 2 ? undefined : arguments[2]; 486 } else if ((arguments.length <= 0 ? undefined : arguments[0]) !== 8 && (arguments.length <= 0 ? undefined : arguments[0]) !== 11) { 487 return arguments.length <= 3 ? undefined : arguments[3]; 488 } else { 489 return arguments.length <= 4 ? undefined : arguments[4]; 490 } 491 }, function () { 492 return (arguments.length <= 0 ? undefined : arguments[0]) === 0 ? arguments.length <= 1 ? undefined : arguments[1] : arguments.length <= 2 ? undefined : arguments[2]; 493 }, function () { 494 if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { 495 return arguments.length <= 1 ? undefined : arguments[1]; 496 } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 2) { 497 return arguments.length <= 2 ? undefined : arguments[2]; 498 } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 3) { 499 return arguments.length <= 3 ? undefined : arguments[3]; 500 } else { 501 return arguments.length <= 4 ? undefined : arguments[4]; 502 } 503 }, function () { 504 if ((arguments.length <= 0 ? undefined : arguments[0]) === 0) { 505 return arguments.length <= 1 ? undefined : arguments[1]; 506 } else if ((arguments.length <= 0 ? undefined : arguments[0]) === 1) { 507 return arguments.length <= 2 ? undefined : arguments[2]; 508 } else { 509 return arguments.length <= 3 ? undefined : arguments[3]; 510 } 511 }]; 512 }(); 513 514 return _pluralForms[form].apply(null, [number].concat(input)); 515 }; 516 517 if (i18n[language] !== undefined) { 518 str = i18n[language][message]; 519 if (pluralParam !== null && typeof pluralParam === 'number') { 520 pluralForm = i18n[language]['mejs.plural-form']; 521 str = _plural.apply(null, [str, pluralParam, pluralForm]); 522 } 523 } 524 525 if (!str && i18n.en) { 526 str = i18n.en[message]; 527 if (pluralParam !== null && typeof pluralParam === 'number') { 528 pluralForm = i18n.en['mejs.plural-form']; 529 str = _plural.apply(null, [str, pluralParam, pluralForm]); 530 } 531 } 532 533 str = str || message; 534 535 if (pluralParam !== null && typeof pluralParam === 'number') { 536 str = str.replace('%1', pluralParam); 537 } 538 539 return (0, _general.escapeHTML)(str); 540 } 541 542 return message; 543 }; 544 545 _mejs2.default.i18n = i18n; 546 547 if (typeof mejsL10n !== 'undefined') { 548 _mejs2.default.i18n.language(mejsL10n.language, mejsL10n.strings); 549 } 550 551 exports.default = i18n; 552 553 },{"18":18,"7":7,"9":9}],6:[function(_dereq_,module,exports){ 554 'use strict'; 555 556 Object.defineProperty(exports, "__esModule", { 557 value: true 558 }); 559 560 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; }; 561 562 var _window = _dereq_(3); 563 564 var _window2 = _interopRequireDefault(_window); 565 566 var _document = _dereq_(2); 567 568 var _document2 = _interopRequireDefault(_document); 569 570 var _mejs = _dereq_(7); 571 572 var _mejs2 = _interopRequireDefault(_mejs); 573 574 var _general = _dereq_(18); 575 576 var _media2 = _dereq_(19); 577 578 var _renderer = _dereq_(8); 579 580 var _constants = _dereq_(16); 581 582 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 583 584 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 585 586 var MediaElement = function MediaElement(idOrNode, options, sources) { 587 var _this = this; 588 589 _classCallCheck(this, MediaElement); 590 591 var t = this; 592 593 sources = Array.isArray(sources) ? sources : null; 594 595 t.defaults = { 596 renderers: [], 597 598 fakeNodeName: 'mediaelementwrapper', 599 600 pluginPath: 'build/', 601 602 shimScriptAccess: 'sameDomain' 603 }; 604 605 options = Object.assign(t.defaults, options); 606 607 t.mediaElement = _document2.default.createElement(options.fakeNodeName); 608 609 var id = idOrNode, 610 error = false; 611 612 if (typeof idOrNode === 'string') { 613 t.mediaElement.originalNode = _document2.default.getElementById(idOrNode); 614 } else { 615 t.mediaElement.originalNode = idOrNode; 616 id = idOrNode.id; 617 } 618 619 if (t.mediaElement.originalNode === undefined || t.mediaElement.originalNode === null) { 620 return null; 621 } 622 623 t.mediaElement.options = options; 624 id = id || 'mejs_' + Math.random().toString().slice(2); 625 626 t.mediaElement.originalNode.setAttribute('id', id + '_from_mejs'); 627 628 var tagName = t.mediaElement.originalNode.tagName.toLowerCase(); 629 if (['video', 'audio'].indexOf(tagName) > -1 && !t.mediaElement.originalNode.getAttribute('preload')) { 630 t.mediaElement.originalNode.setAttribute('preload', 'none'); 631 } 632 633 t.mediaElement.originalNode.parentNode.insertBefore(t.mediaElement, t.mediaElement.originalNode); 634 635 t.mediaElement.appendChild(t.mediaElement.originalNode); 636 637 var processURL = function processURL(url, type) { 638 if (_window2.default.location.protocol === 'https:' && url.indexOf('http:') === 0 && _constants.IS_IOS && _mejs2.default.html5media.mediaTypes.indexOf(type) > -1) { 639 var xhr = new XMLHttpRequest(); 640 xhr.onreadystatechange = function () { 641 if (this.readyState === 4 && this.status === 200) { 642 var _url = _window2.default.URL || _window2.default.webkitURL, 643 blobUrl = _url.createObjectURL(this.response); 644 t.mediaElement.originalNode.setAttribute('src', blobUrl); 645 return blobUrl; 646 } 647 return url; 648 }; 649 xhr.open('GET', url); 650 xhr.responseType = 'blob'; 651 xhr.send(); 652 } 653 654 return url; 655 }; 656 657 var mediaFiles = void 0; 658 659 if (sources !== null) { 660 mediaFiles = sources; 661 } else if (t.mediaElement.originalNode !== null) { 662 663 mediaFiles = []; 664 665 switch (t.mediaElement.originalNode.nodeName.toLowerCase()) { 666 case 'iframe': 667 mediaFiles.push({ 668 type: '', 669 src: t.mediaElement.originalNode.getAttribute('src') 670 }); 671 break; 672 case 'audio': 673 case 'video': 674 var _sources = t.mediaElement.originalNode.children.length, 675 nodeSource = t.mediaElement.originalNode.getAttribute('src'); 676 677 if (nodeSource) { 678 var node = t.mediaElement.originalNode, 679 type = (0, _media2.formatType)(nodeSource, node.getAttribute('type')); 680 mediaFiles.push({ 681 type: type, 682 src: processURL(nodeSource, type) 683 }); 684 } 685 686 for (var i = 0; i < _sources; i++) { 687 var n = t.mediaElement.originalNode.children[i]; 688 if (n.tagName.toLowerCase() === 'source') { 689 var src = n.getAttribute('src'), 690 _type = (0, _media2.formatType)(src, n.getAttribute('type')); 691 mediaFiles.push({ type: _type, src: processURL(src, _type) }); 692 } 693 } 694 break; 695 } 696 } 697 698 t.mediaElement.id = id; 699 t.mediaElement.renderers = {}; 700 t.mediaElement.events = {}; 701 t.mediaElement.promises = []; 702 t.mediaElement.renderer = null; 703 t.mediaElement.rendererName = null; 704 705 t.mediaElement.changeRenderer = function (rendererName, mediaFiles) { 706 707 var t = _this, 708 media = Object.keys(mediaFiles[0]).length > 2 ? mediaFiles[0] : mediaFiles[0].src; 709 710 if (t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null && t.mediaElement.renderer.name === rendererName) { 711 t.mediaElement.renderer.pause(); 712 if (t.mediaElement.renderer.stop) { 713 t.mediaElement.renderer.stop(); 714 } 715 t.mediaElement.renderer.show(); 716 t.mediaElement.renderer.setSrc(media); 717 return true; 718 } 719 720 if (t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null) { 721 t.mediaElement.renderer.pause(); 722 if (t.mediaElement.renderer.stop) { 723 t.mediaElement.renderer.stop(); 724 } 725 t.mediaElement.renderer.hide(); 726 } 727 728 var newRenderer = t.mediaElement.renderers[rendererName], 729 newRendererType = null; 730 731 if (newRenderer !== undefined && newRenderer !== null) { 732 newRenderer.show(); 733 newRenderer.setSrc(media); 734 t.mediaElement.renderer = newRenderer; 735 t.mediaElement.rendererName = rendererName; 736 return true; 737 } 738 739 var rendererArray = t.mediaElement.options.renderers.length ? t.mediaElement.options.renderers : _renderer.renderer.order; 740 741 for (var _i = 0, total = rendererArray.length; _i < total; _i++) { 742 var index = rendererArray[_i]; 743 744 if (index === rendererName) { 745 var rendererList = _renderer.renderer.renderers; 746 newRendererType = rendererList[index]; 747 748 var renderOptions = Object.assign(newRendererType.options, t.mediaElement.options); 749 newRenderer = newRendererType.create(t.mediaElement, renderOptions, mediaFiles); 750 newRenderer.name = rendererName; 751 752 t.mediaElement.renderers[newRendererType.name] = newRenderer; 753 t.mediaElement.renderer = newRenderer; 754 t.mediaElement.rendererName = rendererName; 755 newRenderer.show(); 756 return true; 757 } 758 } 759 760 return false; 761 }; 762 763 t.mediaElement.setSize = function (width, height) { 764 if (t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null) { 765 t.mediaElement.renderer.setSize(width, height); 766 } 767 }; 768 769 t.mediaElement.generateError = function (message, urlList) { 770 message = message || ''; 771 urlList = Array.isArray(urlList) ? urlList : []; 772 var event = (0, _general.createEvent)('error', t.mediaElement); 773 event.message = message; 774 event.urls = urlList; 775 t.mediaElement.dispatchEvent(event); 776 error = true; 777 }; 778 779 var props = _mejs2.default.html5media.properties, 780 methods = _mejs2.default.html5media.methods, 781 addProperty = function addProperty(obj, name, onGet, onSet) { 782 var oldValue = obj[name]; 783 var getFn = function getFn() { 784 return onGet.apply(obj, [oldValue]); 785 }, 786 setFn = function setFn(newValue) { 787 oldValue = onSet.apply(obj, [newValue]); 788 return oldValue; 789 }; 790 791 Object.defineProperty(obj, name, { 792 get: getFn, 793 set: setFn 794 }); 795 }, 796 assignGettersSetters = function assignGettersSetters(propName) { 797 if (propName !== 'src') { 798 799 var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1), 800 getFn = function getFn() { 801 return t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null && typeof t.mediaElement.renderer['get' + capName] === 'function' ? t.mediaElement.renderer['get' + capName]() : null; 802 }, 803 setFn = function setFn(value) { 804 if (t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null && typeof t.mediaElement.renderer['set' + capName] === 'function') { 805 t.mediaElement.renderer['set' + capName](value); 806 } 807 }; 808 809 addProperty(t.mediaElement, propName, getFn, setFn); 810 t.mediaElement['get' + capName] = getFn; 811 t.mediaElement['set' + capName] = setFn; 812 } 813 }, 814 getSrc = function getSrc() { 815 return t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null ? t.mediaElement.renderer.getSrc() : null; 816 }, 817 setSrc = function setSrc(value) { 818 var mediaFiles = []; 819 820 if (typeof value === 'string') { 821 mediaFiles.push({ 822 src: value, 823 type: value ? (0, _media2.getTypeFromFile)(value) : '' 824 }); 825 } else if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value.src !== undefined) { 826 var _src = (0, _media2.absolutizeUrl)(value.src), 827 _type2 = value.type, 828 media = Object.assign(value, { 829 src: _src, 830 type: (_type2 === '' || _type2 === null || _type2 === undefined) && _src ? (0, _media2.getTypeFromFile)(_src) : _type2 831 }); 832 mediaFiles.push(media); 833 } else if (Array.isArray(value)) { 834 for (var _i2 = 0, total = value.length; _i2 < total; _i2++) { 835 836 var _src2 = (0, _media2.absolutizeUrl)(value[_i2].src), 837 _type3 = value[_i2].type, 838 _media = Object.assign(value[_i2], { 839 src: _src2, 840 type: (_type3 === '' || _type3 === null || _type3 === undefined) && _src2 ? (0, _media2.getTypeFromFile)(_src2) : _type3 841 }); 842 843 mediaFiles.push(_media); 844 } 845 } 846 847 var renderInfo = _renderer.renderer.select(mediaFiles, t.mediaElement.options.renderers.length ? t.mediaElement.options.renderers : []), 848 event = void 0; 849 850 if (!t.mediaElement.paused && !(t.mediaElement.src == null || t.mediaElement.src === '')) { 851 t.mediaElement.pause(); 852 event = (0, _general.createEvent)('pause', t.mediaElement); 853 t.mediaElement.dispatchEvent(event); 854 } 855 t.mediaElement.originalNode.src = mediaFiles[0].src || ''; 856 857 if (renderInfo === null && mediaFiles[0].src) { 858 t.mediaElement.generateError('No renderer found', mediaFiles); 859 return; 860 } 861 862 var shouldChangeRenderer = !(mediaFiles[0].src == null || mediaFiles[0].src === ''); 863 return shouldChangeRenderer ? t.mediaElement.changeRenderer(renderInfo.rendererName, mediaFiles) : null; 864 }, 865 triggerAction = function triggerAction(methodName, args) { 866 try { 867 if (methodName === 'play' && (t.mediaElement.rendererName === 'native_dash' || t.mediaElement.rendererName === 'native_hls' || t.mediaElement.rendererName === 'vimeo_iframe')) { 868 var response = t.mediaElement.renderer[methodName](args); 869 if (response && typeof response.then === 'function') { 870 response.catch(function () { 871 if (t.mediaElement.paused) { 872 setTimeout(function () { 873 var tmpResponse = t.mediaElement.renderer.play(); 874 if (tmpResponse !== undefined) { 875 tmpResponse.catch(function () { 876 if (!t.mediaElement.renderer.paused) { 877 t.mediaElement.renderer.pause(); 878 } 879 }); 880 } 881 }, 150); 882 } 883 }); 884 } 885 } else { 886 t.mediaElement.renderer[methodName](args); 887 } 888 } catch (e) { 889 t.mediaElement.generateError(e, mediaFiles); 890 } 891 }, 892 assignMethods = function assignMethods(methodName) { 893 t.mediaElement[methodName] = function () { 894 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { 895 args[_key] = arguments[_key]; 896 } 897 898 if (t.mediaElement.renderer !== undefined && t.mediaElement.renderer !== null && typeof t.mediaElement.renderer[methodName] === 'function') { 899 if (t.mediaElement.promises.length) { 900 Promise.all(t.mediaElement.promises).then(function () { 901 triggerAction(methodName, args); 902 }).catch(function (e) { 903 t.mediaElement.generateError(e, mediaFiles); 904 }); 905 } else { 906 triggerAction(methodName, args); 907 } 908 } 909 return null; 910 }; 911 }; 912 913 addProperty(t.mediaElement, 'src', getSrc, setSrc); 914 t.mediaElement.getSrc = getSrc; 915 t.mediaElement.setSrc = setSrc; 916 917 for (var _i3 = 0, total = props.length; _i3 < total; _i3++) { 918 assignGettersSetters(props[_i3]); 919 } 920 921 for (var _i4 = 0, _total = methods.length; _i4 < _total; _i4++) { 922 assignMethods(methods[_i4]); 923 } 924 925 t.mediaElement.addEventListener = function (eventName, callback) { 926 t.mediaElement.events[eventName] = t.mediaElement.events[eventName] || []; 927 928 t.mediaElement.events[eventName].push(callback); 929 }; 930 t.mediaElement.removeEventListener = function (eventName, callback) { 931 if (!eventName) { 932 t.mediaElement.events = {}; 933 return true; 934 } 935 936 var callbacks = t.mediaElement.events[eventName]; 937 938 if (!callbacks) { 939 return true; 940 } 941 942 if (!callback) { 943 t.mediaElement.events[eventName] = []; 944 return true; 945 } 946 947 for (var _i5 = 0; _i5 < callbacks.length; _i5++) { 948 if (callbacks[_i5] === callback) { 949 t.mediaElement.events[eventName].splice(_i5, 1); 950 return true; 951 } 952 } 953 return false; 954 }; 955 956 t.mediaElement.dispatchEvent = function (event) { 957 var callbacks = t.mediaElement.events[event.type]; 958 if (callbacks) { 959 for (var _i6 = 0; _i6 < callbacks.length; _i6++) { 960 callbacks[_i6].apply(null, [event]); 961 } 962 } 963 }; 964 965 t.mediaElement.destroy = function () { 966 var mediaElement = t.mediaElement.originalNode.cloneNode(true); 967 var wrapper = t.mediaElement.parentElement; 968 mediaElement.removeAttribute('id'); 969 mediaElement.remove(); 970 t.mediaElement.remove(); 971 wrapper.appendChild(mediaElement); 972 }; 973 974 if (mediaFiles.length) { 975 t.mediaElement.src = mediaFiles; 976 } 977 978 if (t.mediaElement.promises.length) { 979 Promise.all(t.mediaElement.promises).then(function () { 980 if (t.mediaElement.options.success) { 981 t.mediaElement.options.success(t.mediaElement, t.mediaElement.originalNode); 982 } 983 }).catch(function () { 984 if (error && t.mediaElement.options.error) { 985 t.mediaElement.options.error(t.mediaElement, t.mediaElement.originalNode); 986 } 987 }); 988 } else { 989 if (t.mediaElement.options.success) { 990 t.mediaElement.options.success(t.mediaElement, t.mediaElement.originalNode); 991 } 992 993 if (error && t.mediaElement.options.error) { 994 t.mediaElement.options.error(t.mediaElement, t.mediaElement.originalNode); 995 } 996 } 997 998 return t.mediaElement; 999 }; 1000 1001 _window2.default.MediaElement = MediaElement; 1002 _mejs2.default.MediaElement = MediaElement; 1003 1004 exports.default = MediaElement; 1005 1006 },{"16":16,"18":18,"19":19,"2":2,"3":3,"7":7,"8":8}],7:[function(_dereq_,module,exports){ 1007 'use strict'; 1008 1009 Object.defineProperty(exports, "__esModule", { 1010 value: true 1011 }); 1012 1013 var _window = _dereq_(3); 1014 1015 var _window2 = _interopRequireDefault(_window); 1016 1017 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 1018 1019 var mejs = {}; 1020 1021 mejs.version = '4.2.17'; 1022 1023 mejs.html5media = { 1024 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'], 1025 readOnlyProperties: ['duration', 'paused', 'ended', 'buffered', 'error', 'networkState', 'readyState', 'seeking', 'seekable'], 1026 1027 methods: ['load', 'play', 'pause', 'canPlayType'], 1028 1029 events: ['loadstart', 'durationchange', 'loadedmetadata', 'loadeddata', 'progress', 'canplay', 'canplaythrough', 'suspend', 'abort', 'error', 'emptied', 'stalled', 'play', 'playing', 'pause', 'waiting', 'seeking', 'seeked', 'timeupdate', 'ended', 'ratechange', 'volumechange'], 1030 1031 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'] 1032 }; 1033 1034 _window2.default.mejs = mejs; 1035 1036 exports.default = mejs; 1037 1038 },{"3":3}],8:[function(_dereq_,module,exports){ 1039 'use strict'; 1040 1041 Object.defineProperty(exports, "__esModule", { 1042 value: true 1043 }); 1044 exports.renderer = undefined; 1045 1046 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; }; 1047 1048 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; }; }(); 1049 1050 var _mejs = _dereq_(7); 1051 1052 var _mejs2 = _interopRequireDefault(_mejs); 1053 1054 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 1055 1056 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 1057 1058 var Renderer = function () { 1059 function Renderer() { 1060 _classCallCheck(this, Renderer); 1061 1062 this.renderers = {}; 1063 this.order = []; 1064 } 1065 1066 _createClass(Renderer, [{ 1067 key: 'add', 1068 value: function add(renderer) { 1069 if (renderer.name === undefined) { 1070 throw new TypeError('renderer must contain at least `name` property'); 1071 } 1072 1073 this.renderers[renderer.name] = renderer; 1074 this.order.push(renderer.name); 1075 } 1076 }, { 1077 key: 'select', 1078 value: function select(mediaFiles) { 1079 var renderers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; 1080 1081 var renderersLength = renderers.length; 1082 1083 renderers = renderers.length ? renderers : this.order; 1084 1085 if (!renderersLength) { 1086 var rendererIndicator = [/^(html5|native)/i, /^flash/i, /iframe$/i], 1087 rendererRanking = function rendererRanking(renderer) { 1088 for (var i = 0, total = rendererIndicator.length; i < total; i++) { 1089 if (rendererIndicator[i].test(renderer)) { 1090 return i; 1091 } 1092 } 1093 return rendererIndicator.length; 1094 }; 1095 1096 renderers.sort(function (a, b) { 1097 return rendererRanking(a) - rendererRanking(b); 1098 }); 1099 } 1100 1101 for (var i = 0, total = renderers.length; i < total; i++) { 1102 var key = renderers[i], 1103 _renderer = this.renderers[key]; 1104 1105 if (_renderer !== null && _renderer !== undefined) { 1106 for (var j = 0, jl = mediaFiles.length; j < jl; j++) { 1107 if (typeof _renderer.canPlayType === 'function' && typeof mediaFiles[j].type === 'string' && _renderer.canPlayType(mediaFiles[j].type)) { 1108 return { 1109 rendererName: _renderer.name, 1110 src: mediaFiles[j].src 1111 }; 1112 } 1113 } 1114 } 1115 } 1116 1117 return null; 1118 } 1119 }, { 1120 key: 'order', 1121 set: function set(order) { 1122 if (!Array.isArray(order)) { 1123 throw new TypeError('order must be an array of strings.'); 1124 } 1125 1126 this._order = order; 1127 }, 1128 get: function get() { 1129 return this._order; 1130 } 1131 }, { 1132 key: 'renderers', 1133 set: function set(renderers) { 1134 if (renderers !== null && (typeof renderers === 'undefined' ? 'undefined' : _typeof(renderers)) !== 'object') { 1135 throw new TypeError('renderers must be an array of objects.'); 1136 } 1137 1138 this._renderers = renderers; 1139 }, 1140 get: function get() { 1141 return this._renderers; 1142 } 1143 }]); 1144 1145 return Renderer; 1146 }(); 1147 1148 var renderer = exports.renderer = new Renderer(); 1149 1150 _mejs2.default.Renderers = renderer; 1151 1152 },{"7":7}],9:[function(_dereq_,module,exports){ 1153 'use strict'; 1154 1155 Object.defineProperty(exports, "__esModule", { 1156 value: true 1157 }); 1158 var EN = exports.EN = { 1159 'mejs.plural-form': 1, 1160 1161 'mejs.download-file': 'Download File', 1162 1163 'mejs.install-flash': 'You are using a browser that does not have Flash player enabled or installed. Please turn on your Flash player plugin or download the latest version from https://get.adobe.com/flashplayer/', 1164 1165 'mejs.fullscreen': 'Fullscreen', 1166 1167 'mejs.play': 'Play', 1168 'mejs.pause': 'Pause', 1169 1170 'mejs.time-slider': 'Time Slider', 1171 'mejs.time-help-text': 'Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.', 1172 'mejs.live-broadcast': 'Live Broadcast', 1173 1174 'mejs.volume-help-text': 'Use Up/Down Arrow keys to increase or decrease volume.', 1175 'mejs.unmute': 'Unmute', 1176 'mejs.mute': 'Mute', 1177 'mejs.volume-slider': 'Volume Slider', 1178 1179 'mejs.video-player': 'Video Player', 1180 'mejs.audio-player': 'Audio Player', 1181 1182 'mejs.captions-subtitles': 'Captions/Subtitles', 1183 'mejs.captions-chapters': 'Chapters', 1184 'mejs.none': 'None', 1185 'mejs.afrikaans': 'Afrikaans', 1186 'mejs.albanian': 'Albanian', 1187 'mejs.arabic': 'Arabic', 1188 'mejs.belarusian': 'Belarusian', 1189 'mejs.bulgarian': 'Bulgarian', 1190 'mejs.catalan': 'Catalan', 1191 'mejs.chinese': 'Chinese', 1192 'mejs.chinese-simplified': 'Chinese (Simplified)', 1193 'mejs.chinese-traditional': 'Chinese (Traditional)', 1194 'mejs.croatian': 'Croatian', 1195 'mejs.czech': 'Czech', 1196 'mejs.danish': 'Danish', 1197 'mejs.dutch': 'Dutch', 1198 'mejs.english': 'English', 1199 'mejs.estonian': 'Estonian', 1200 'mejs.filipino': 'Filipino', 1201 'mejs.finnish': 'Finnish', 1202 'mejs.french': 'French', 1203 'mejs.galician': 'Galician', 1204 'mejs.german': 'German', 1205 'mejs.greek': 'Greek', 1206 'mejs.haitian-creole': 'Haitian Creole', 1207 'mejs.hebrew': 'Hebrew', 1208 'mejs.hindi': 'Hindi', 1209 'mejs.hungarian': 'Hungarian', 1210 'mejs.icelandic': 'Icelandic', 1211 'mejs.indonesian': 'Indonesian', 1212 'mejs.irish': 'Irish', 1213 'mejs.italian': 'Italian', 1214 'mejs.japanese': 'Japanese', 1215 'mejs.korean': 'Korean', 1216 'mejs.latvian': 'Latvian', 1217 'mejs.lithuanian': 'Lithuanian', 1218 'mejs.macedonian': 'Macedonian', 1219 'mejs.malay': 'Malay', 1220 'mejs.maltese': 'Maltese', 1221 'mejs.norwegian': 'Norwegian', 1222 'mejs.persian': 'Persian', 1223 'mejs.polish': 'Polish', 1224 'mejs.portuguese': 'Portuguese', 1225 'mejs.romanian': 'Romanian', 1226 'mejs.russian': 'Russian', 1227 'mejs.serbian': 'Serbian', 1228 'mejs.slovak': 'Slovak', 1229 'mejs.slovenian': 'Slovenian', 1230 'mejs.spanish': 'Spanish', 1231 'mejs.swahili': 'Swahili', 1232 'mejs.swedish': 'Swedish', 1233 'mejs.tagalog': 'Tagalog', 1234 'mejs.thai': 'Thai', 1235 'mejs.turkish': 'Turkish', 1236 'mejs.ukrainian': 'Ukrainian', 1237 'mejs.vietnamese': 'Vietnamese', 1238 'mejs.welsh': 'Welsh', 1239 'mejs.yiddish': 'Yiddish' 1240 }; 1241 1242 },{}],10:[function(_dereq_,module,exports){ 1243 'use strict'; 1244 1245 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; }; 1246 1247 var _window = _dereq_(3); 1248 1249 var _window2 = _interopRequireDefault(_window); 1250 1251 var _mejs = _dereq_(7); 1252 1253 var _mejs2 = _interopRequireDefault(_mejs); 1254 1255 var _renderer = _dereq_(8); 1256 1257 var _general = _dereq_(18); 1258 1259 var _media = _dereq_(19); 1260 1261 var _constants = _dereq_(16); 1262 1263 var _dom = _dereq_(17); 1264 1265 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 1266 1267 var NativeDash = { 1268 1269 promise: null, 1270 1271 load: function load(settings) { 1272 if (typeof dashjs !== 'undefined') { 1273 NativeDash.promise = new Promise(function (resolve) { 1274 resolve(); 1275 }).then(function () { 1276 NativeDash._createPlayer(settings); 1277 }); 1278 } else { 1279 settings.options.path = typeof settings.options.path === 'string' ? settings.options.path : 'https://cdn.dashjs.org/latest/dash.all.min.js'; 1280 1281 NativeDash.promise = NativeDash.promise || (0, _dom.loadScript)(settings.options.path); 1282 NativeDash.promise.then(function () { 1283 NativeDash._createPlayer(settings); 1284 }); 1285 } 1286 1287 return NativeDash.promise; 1288 }, 1289 1290 _createPlayer: function _createPlayer(settings) { 1291 var player = dashjs.MediaPlayer().create(); 1292 _window2.default['__ready__' + settings.id](player); 1293 return player; 1294 } 1295 }; 1296 1297 var DashNativeRenderer = { 1298 name: 'native_dash', 1299 options: { 1300 prefix: 'native_dash', 1301 dash: { 1302 path: 'https://cdn.dashjs.org/latest/dash.all.min.js', 1303 debug: false, 1304 drm: {}, 1305 1306 robustnessLevel: '' 1307 } 1308 }, 1309 1310 canPlayType: function canPlayType(type) { 1311 return _constants.HAS_MSE && ['application/dash+xml'].indexOf(type.toLowerCase()) > -1; 1312 }, 1313 1314 create: function create(mediaElement, options, mediaFiles) { 1315 1316 var originalNode = mediaElement.originalNode, 1317 id = mediaElement.id + '_' + options.prefix, 1318 autoplay = originalNode.autoplay, 1319 children = originalNode.children; 1320 1321 var node = null, 1322 dashPlayer = null; 1323 1324 originalNode.removeAttribute('type'); 1325 for (var i = 0, total = children.length; i < total; i++) { 1326 children[i].removeAttribute('type'); 1327 } 1328 1329 node = originalNode.cloneNode(true); 1330 options = Object.assign(options, mediaElement.options); 1331 1332 var props = _mejs2.default.html5media.properties, 1333 events = _mejs2.default.html5media.events.concat(['click', 'mouseover', 'mouseout']).filter(function (e) { 1334 return e !== 'error'; 1335 }), 1336 attachNativeEvents = function attachNativeEvents(e) { 1337 var event = (0, _general.createEvent)(e.type, mediaElement); 1338 mediaElement.dispatchEvent(event); 1339 }, 1340 assignGettersSetters = function assignGettersSetters(propName) { 1341 var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1); 1342 1343 node['get' + capName] = function () { 1344 return dashPlayer !== null ? node[propName] : null; 1345 }; 1346 1347 node['set' + capName] = function (value) { 1348 if (_mejs2.default.html5media.readOnlyProperties.indexOf(propName) === -1) { 1349 if (propName === 'src') { 1350 var source = (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value.src ? value.src : value; 1351 node[propName] = source; 1352 if (dashPlayer !== null) { 1353 dashPlayer.reset(); 1354 for (var _i = 0, _total = events.length; _i < _total; _i++) { 1355 node.removeEventListener(events[_i], attachNativeEvents); 1356 } 1357 dashPlayer = NativeDash._createPlayer({ 1358 options: options.dash, 1359 id: id 1360 }); 1361 1362 if (value && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && _typeof(value.drm) === 'object') { 1363 dashPlayer.setProtectionData(value.drm); 1364 if ((0, _general.isString)(options.dash.robustnessLevel) && options.dash.robustnessLevel) { 1365 dashPlayer.getProtectionController().setRobustnessLevel(options.dash.robustnessLevel); 1366 } 1367 } 1368 dashPlayer.attachSource(source); 1369 if (autoplay) { 1370 dashPlayer.play(); 1371 } 1372 } 1373 } else { 1374 node[propName] = value; 1375 } 1376 } 1377 }; 1378 }; 1379 1380 for (var _i2 = 0, _total2 = props.length; _i2 < _total2; _i2++) { 1381 assignGettersSetters(props[_i2]); 1382 } 1383 1384 _window2.default['__ready__' + id] = function (_dashPlayer) { 1385 mediaElement.dashPlayer = dashPlayer = _dashPlayer; 1386 1387 var dashEvents = dashjs.MediaPlayer.events, 1388 assignEvents = function assignEvents(eventName) { 1389 if (eventName === 'loadedmetadata') { 1390 dashPlayer.initialize(); 1391 dashPlayer.attachView(node); 1392 dashPlayer.setAutoPlay(false); 1393 1394 if (_typeof(options.dash.drm) === 'object' && !_mejs2.default.Utils.isObjectEmpty(options.dash.drm)) { 1395 dashPlayer.setProtectionData(options.dash.drm); 1396 if ((0, _general.isString)(options.dash.robustnessLevel) && options.dash.robustnessLevel) { 1397 dashPlayer.getProtectionController().setRobustnessLevel(options.dash.robustnessLevel); 1398 } 1399 } 1400 dashPlayer.attachSource(node.getSrc()); 1401 } 1402 1403 node.addEventListener(eventName, attachNativeEvents); 1404 }; 1405 1406 for (var _i3 = 0, _total3 = events.length; _i3 < _total3; _i3++) { 1407 assignEvents(events[_i3]); 1408 } 1409 1410 var assignMdashEvents = function assignMdashEvents(e) { 1411 if (e.type.toLowerCase() === 'error') { 1412 mediaElement.generateError(e.message, node.src); 1413 console.error(e); 1414 } else { 1415 var _event = (0, _general.createEvent)(e.type, mediaElement); 1416 _event.data = e; 1417 mediaElement.dispatchEvent(_event); 1418 } 1419 }; 1420 1421 for (var eventType in dashEvents) { 1422 if (dashEvents.hasOwnProperty(eventType)) { 1423 dashPlayer.on(dashEvents[eventType], function (e) { 1424 return assignMdashEvents(e); 1425 }); 1426 } 1427 } 1428 }; 1429 1430 if (mediaFiles && mediaFiles.length > 0) { 1431 for (var _i4 = 0, _total4 = mediaFiles.length; _i4 < _total4; _i4++) { 1432 if (_renderer.renderer.renderers[options.prefix].canPlayType(mediaFiles[_i4].type)) { 1433 node.setAttribute('src', mediaFiles[_i4].src); 1434 if (typeof mediaFiles[_i4].drm !== 'undefined') { 1435 options.dash.drm = mediaFiles[_i4].drm; 1436 } 1437 break; 1438 } 1439 } 1440 } 1441 1442 node.setAttribute('id', id); 1443 1444 originalNode.parentNode.insertBefore(node, originalNode); 1445 originalNode.autoplay = false; 1446 originalNode.style.display = 'none'; 1447 1448 node.setSize = function (width, height) { 1449 node.style.width = width + 'px'; 1450 node.style.height = height + 'px'; 1451 return node; 1452 }; 1453 1454 node.hide = function () { 1455 node.pause(); 1456 node.style.display = 'none'; 1457 return node; 1458 }; 1459 1460 node.show = function () { 1461 node.style.display = ''; 1462 return node; 1463 }; 1464 1465 node.destroy = function () { 1466 if (dashPlayer !== null) { 1467 dashPlayer.reset(); 1468 } 1469 }; 1470 1471 var event = (0, _general.createEvent)('rendererready', node); 1472 mediaElement.dispatchEvent(event); 1473 1474 mediaElement.promises.push(NativeDash.load({ 1475 options: options.dash, 1476 id: id 1477 })); 1478 1479 return node; 1480 } 1481 }; 1482 1483 _media.typeChecks.push(function (url) { 1484 return ~url.toLowerCase().indexOf('.mpd') ? 'application/dash+xml' : null; 1485 }); 1486 1487 _renderer.renderer.add(DashNativeRenderer); 1488 1489 },{"16":16,"17":17,"18":18,"19":19,"3":3,"7":7,"8":8}],11:[function(_dereq_,module,exports){ 1490 'use strict'; 1491 1492 Object.defineProperty(exports, "__esModule", { 1493 value: true 1494 }); 1495 exports.PluginDetector = undefined; 1496 1497 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; }; 1498 1499 var _window = _dereq_(3); 1500 1501 var _window2 = _interopRequireDefault(_window); 1502 1503 var _document = _dereq_(2); 1504 1505 var _document2 = _interopRequireDefault(_document); 1506 1507 var _mejs = _dereq_(7); 1508 1509 var _mejs2 = _interopRequireDefault(_mejs); 1510 1511 var _i18n = _dereq_(5); 1512 1513 var _i18n2 = _interopRequireDefault(_i18n); 1514 1515 var _renderer = _dereq_(8); 1516 1517 var _general = _dereq_(18); 1518 1519 var _constants = _dereq_(16); 1520 1521 var _media = _dereq_(19); 1522 1523 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 1524 1525 var PluginDetector = exports.PluginDetector = { 1526 plugins: [], 1527 1528 hasPluginVersion: function hasPluginVersion(plugin, v) { 1529 var pv = PluginDetector.plugins[plugin]; 1530 v[1] = v[1] || 0; 1531 v[2] = v[2] || 0; 1532 return pv[0] > v[0] || pv[0] === v[0] && pv[1] > v[1] || pv[0] === v[0] && pv[1] === v[1] && pv[2] >= v[2]; 1533 }, 1534 1535 addPlugin: function addPlugin(p, pluginName, mimeType, activeX, axDetect) { 1536 PluginDetector.plugins[p] = PluginDetector.detectPlugin(pluginName, mimeType, activeX, axDetect); 1537 }, 1538 1539 detectPlugin: function detectPlugin(pluginName, mimeType, activeX, axDetect) { 1540 1541 var version = [0, 0, 0], 1542 description = void 0, 1543 ax = void 0; 1544 1545 if (_constants.NAV.plugins !== null && _constants.NAV.plugins !== undefined && _typeof(_constants.NAV.plugins[pluginName]) === 'object') { 1546 description = _constants.NAV.plugins[pluginName].description; 1547 if (description && !(typeof _constants.NAV.mimeTypes !== 'undefined' && _constants.NAV.mimeTypes[mimeType] && !_constants.NAV.mimeTypes[mimeType].enabledPlugin)) { 1548 version = description.replace(pluginName, '').replace(/^\s+/, '').replace(/\sr/gi, '.').split('.'); 1549 for (var i = 0, total = version.length; i < total; i++) { 1550 version[i] = parseInt(version[i].match(/\d+/), 10); 1551 } 1552 } 1553 } else if (_window2.default.ActiveXObject !== undefined) { 1554 try { 1555 ax = new ActiveXObject(activeX); 1556 if (ax) { 1557 version = axDetect(ax); 1558 } 1559 } catch (e) { 1560 1561 } 1562 } 1563 return version; 1564 } 1565 }; 1566 1567 PluginDetector.addPlugin('flash', 'Shockwave Flash', 'application/x-shockwave-flash', 'ShockwaveFlash.ShockwaveFlash', function (ax) { 1568 var version = [], 1569 d = ax.GetVariable("$version"); 1570 1571 if (d) { 1572 d = d.split(" ")[1].split(","); 1573 version = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; 1574 } 1575 return version; 1576 }); 1577 1578 var FlashMediaElementRenderer = { 1579 create: function create(mediaElement, options, mediaFiles) { 1580 1581 var flash = {}; 1582 var isActive = false; 1583 1584 flash.options = options; 1585 flash.id = mediaElement.id + '_' + flash.options.prefix; 1586 flash.mediaElement = mediaElement; 1587 flash.flashState = {}; 1588 flash.flashApi = null; 1589 flash.flashApiStack = []; 1590 1591 var props = _mejs2.default.html5media.properties, 1592 assignGettersSetters = function assignGettersSetters(propName) { 1593 flash.flashState[propName] = null; 1594 1595 var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1); 1596 1597 flash['get' + capName] = function () { 1598 if (flash.flashApi !== null) { 1599 if (typeof flash.flashApi['get_' + propName] === 'function') { 1600 var value = flash.flashApi['get_' + propName](); 1601 1602 if (propName === 'buffered') { 1603 return { 1604 start: function start() { 1605 return 0; 1606 }, 1607 end: function end() { 1608 return value; 1609 }, 1610 length: 1 1611 }; 1612 } 1613 return value; 1614 } else { 1615 return null; 1616 } 1617 } else { 1618 return null; 1619 } 1620 }; 1621 1622 flash['set' + capName] = function (value) { 1623 if (propName === 'src') { 1624 value = (0, _media.absolutizeUrl)(value); 1625 } 1626 1627 if (flash.flashApi !== null && flash.flashApi['set_' + propName] !== undefined) { 1628 try { 1629 flash.flashApi['set_' + propName](value); 1630 } catch (e) { 1631 1632 } 1633 } else { 1634 flash.flashApiStack.push({ 1635 type: 'set', 1636 propName: propName, 1637 value: value 1638 }); 1639 } 1640 }; 1641 }; 1642 1643 for (var i = 0, total = props.length; i < total; i++) { 1644 assignGettersSetters(props[i]); 1645 } 1646 1647 var methods = _mejs2.default.html5media.methods, 1648 assignMethods = function assignMethods(methodName) { 1649 flash[methodName] = function () { 1650 if (isActive) { 1651 if (flash.flashApi !== null) { 1652 if (flash.flashApi['fire_' + methodName]) { 1653 try { 1654 flash.flashApi['fire_' + methodName](); 1655 } catch (e) { 1656 1657 } 1658 } else { 1659 1660 } 1661 } else { 1662 flash.flashApiStack.push({ 1663 type: 'call', 1664 methodName: methodName 1665 }); 1666 } 1667 } 1668 }; 1669 }; 1670 methods.push('stop'); 1671 for (var _i = 0, _total = methods.length; _i < _total; _i++) { 1672 assignMethods(methods[_i]); 1673 } 1674 1675 var initEvents = ['rendererready']; 1676 1677 for (var _i2 = 0, _total2 = initEvents.length; _i2 < _total2; _i2++) { 1678 var event = (0, _general.createEvent)(initEvents[_i2], flash); 1679 mediaElement.dispatchEvent(event); 1680 } 1681 1682 _window2.default['__ready__' + flash.id] = function () { 1683 1684 flash.flashReady = true; 1685 flash.flashApi = _document2.default.getElementById('__' + flash.id); 1686 1687 if (flash.flashApiStack.length) { 1688 for (var _i3 = 0, _total3 = flash.flashApiStack.length; _i3 < _total3; _i3++) { 1689 var stackItem = flash.flashApiStack[_i3]; 1690 1691 if (stackItem.type === 'set') { 1692 var propName = stackItem.propName, 1693 capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1); 1694 1695 flash['set' + capName](stackItem.value); 1696 } else if (stackItem.type === 'call') { 1697 flash[stackItem.methodName](); 1698 } 1699 } 1700 } 1701 }; 1702 1703 _window2.default['__event__' + flash.id] = function (eventName, message) { 1704 var event = (0, _general.createEvent)(eventName, flash); 1705 if (message) { 1706 try { 1707 event.data = JSON.parse(message); 1708 event.details.data = JSON.parse(message); 1709 } catch (e) { 1710 event.message = message; 1711 } 1712 } 1713 1714 flash.mediaElement.dispatchEvent(event); 1715 }; 1716 1717 flash.flashWrapper = _document2.default.createElement('div'); 1718 1719 if (['always', 'sameDomain'].indexOf(flash.options.shimScriptAccess) === -1) { 1720 flash.options.shimScriptAccess = 'sameDomain'; 1721 } 1722 1723 var autoplay = mediaElement.originalNode.autoplay, 1724 flashVars = ['uid=' + flash.id, 'autoplay=' + autoplay, 'allowScriptAccess=' + flash.options.shimScriptAccess, 'preload=' + (mediaElement.originalNode.getAttribute('preload') || '')], 1725 isVideo = mediaElement.originalNode !== null && mediaElement.originalNode.tagName.toLowerCase() === 'video', 1726 flashHeight = isVideo ? mediaElement.originalNode.height : 1, 1727 flashWidth = isVideo ? mediaElement.originalNode.width : 1; 1728 1729 if (mediaElement.originalNode.getAttribute('src')) { 1730 flashVars.push('src=' + mediaElement.originalNode.getAttribute('src')); 1731 } 1732 1733 if (flash.options.enablePseudoStreaming === true) { 1734 flashVars.push('pseudostreamstart=' + flash.options.pseudoStreamingStartQueryParam); 1735 flashVars.push('pseudostreamtype=' + flash.options.pseudoStreamingType); 1736 } 1737 1738 if (flash.options.streamDelimiter) { 1739 flashVars.push('streamdelimiter=' + encodeURIComponent(flash.options.streamDelimiter)); 1740 } 1741 1742 if (flash.options.proxyType) { 1743 flashVars.push('proxytype=' + flash.options.proxyType); 1744 } 1745 1746 mediaElement.appendChild(flash.flashWrapper); 1747 mediaElement.originalNode.style.display = 'none'; 1748 1749 var settings = []; 1750 1751 if (_constants.IS_IE || _constants.IS_EDGE) { 1752 var specialIEContainer = _document2.default.createElement('div'); 1753 flash.flashWrapper.appendChild(specialIEContainer); 1754 1755 if (_constants.IS_EDGE) { 1756 settings = ['type="application/x-shockwave-flash"', 'data="' + flash.options.pluginPath + flash.options.filename + '"', 'id="__' + flash.id + '"', 'width="' + flashWidth + '"', 'height="' + flashHeight + '\'"']; 1757 } else { 1758 settings = ['classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"', 'codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"', 'id="__' + flash.id + '"', 'width="' + flashWidth + '"', 'height="' + flashHeight + '"']; 1759 } 1760 1761 if (!isVideo) { 1762 settings.push('style="clip: rect(0 0 0 0); position: absolute;"'); 1763 } 1764 1765 specialIEContainer.outerHTML = '<object ' + settings.join(' ') + '>' + ('<param name="movie" value="' + flash.options.pluginPath + flash.options.filename + '?x=' + new Date() + '" />') + ('<param name="flashvars" value="' + flashVars.join('&') + '" />') + '<param name="quality" value="high" />' + '<param name="bgcolor" value="#000000" />' + '<param name="wmode" value="transparent" />' + ('<param name="allowScriptAccess" value="' + flash.options.shimScriptAccess + '" />') + '<param name="allowFullScreen" value="true" />' + ('<div>' + _i18n2.default.t('mejs.install-flash') + '</div>') + '</object>'; 1766 } else { 1767 1768 settings = ['id="__' + flash.id + '"', 'name="__' + flash.id + '"', 'play="true"', 'loop="false"', 'quality="high"', 'bgcolor="#000000"', 'wmode="transparent"', 'allowScriptAccess="' + flash.options.shimScriptAccess + '"', 'allowFullScreen="true"', 'type="application/x-shockwave-flash"', 'pluginspage="//www.macromedia.com/go/getflashplayer"', 'src="' + flash.options.pluginPath + flash.options.filename + '"', 'flashvars="' + flashVars.join('&') + '"']; 1769 1770 if (isVideo) { 1771 settings.push('width="' + flashWidth + '"'); 1772 settings.push('height="' + flashHeight + '"'); 1773 } else { 1774 settings.push('style="position: fixed; left: -9999em; top: -9999em;"'); 1775 } 1776 1777 flash.flashWrapper.innerHTML = '<embed ' + settings.join(' ') + '>'; 1778 } 1779 1780 flash.flashNode = flash.flashWrapper.lastChild; 1781 1782 flash.hide = function () { 1783 isActive = false; 1784 if (isVideo) { 1785 flash.flashNode.style.display = 'none'; 1786 } 1787 }; 1788 flash.show = function () { 1789 isActive = true; 1790 if (isVideo) { 1791 flash.flashNode.style.display = ''; 1792 } 1793 }; 1794 flash.setSize = function (width, height) { 1795 flash.flashNode.style.width = width + 'px'; 1796 flash.flashNode.style.height = height + 'px'; 1797 1798 if (flash.flashApi !== null && typeof flash.flashApi.fire_setSize === 'function') { 1799 flash.flashApi.fire_setSize(width, height); 1800 } 1801 }; 1802 1803 flash.destroy = function () { 1804 flash.flashNode.remove(); 1805 }; 1806 1807 if (mediaFiles && mediaFiles.length > 0) { 1808 for (var _i4 = 0, _total4 = mediaFiles.length; _i4 < _total4; _i4++) { 1809 if (_renderer.renderer.renderers[options.prefix].canPlayType(mediaFiles[_i4].type)) { 1810 flash.setSrc(mediaFiles[_i4].src); 1811 break; 1812 } 1813 } 1814 } 1815 1816 return flash; 1817 } 1818 }; 1819 1820 var hasFlash = PluginDetector.hasPluginVersion('flash', [10, 0, 0]); 1821 1822 if (hasFlash) { 1823 _media.typeChecks.push(function (url) { 1824 url = url.toLowerCase(); 1825 1826 if (url.startsWith('rtmp')) { 1827 if (~url.indexOf('.mp3')) { 1828 return 'audio/rtmp'; 1829 } else { 1830 return 'video/rtmp'; 1831 } 1832 } else if (/\.og(a|g)/i.test(url)) { 1833 return 'audio/ogg'; 1834 } else if (~url.indexOf('.m3u8')) { 1835 return 'application/x-mpegURL'; 1836 } else if (~url.indexOf('.mpd')) { 1837 return 'application/dash+xml'; 1838 } else if (~url.indexOf('.flv')) { 1839 return 'video/flv'; 1840 } else { 1841 return null; 1842 } 1843 }); 1844 1845 var FlashMediaElementVideoRenderer = { 1846 name: 'flash_video', 1847 options: { 1848 prefix: 'flash_video', 1849 filename: 'mediaelement-flash-video.swf', 1850 enablePseudoStreaming: false, 1851 1852 pseudoStreamingStartQueryParam: 'start', 1853 1854 pseudoStreamingType: 'byte', 1855 1856 proxyType: '', 1857 1858 streamDelimiter: '' 1859 }, 1860 1861 canPlayType: function canPlayType(type) { 1862 return ~['video/mp4', 'video/rtmp', 'audio/rtmp', 'rtmp/mp4', 'audio/mp4', 'video/flv', 'video/x-flv'].indexOf(type.toLowerCase()); 1863 }, 1864 1865 create: FlashMediaElementRenderer.create 1866 1867 }; 1868 _renderer.renderer.add(FlashMediaElementVideoRenderer); 1869 1870 var FlashMediaElementHlsVideoRenderer = { 1871 name: 'flash_hls', 1872 options: { 1873 prefix: 'flash_hls', 1874 filename: 'mediaelement-flash-video-hls.swf' 1875 }, 1876 1877 canPlayType: function canPlayType(type) { 1878 return ~['application/x-mpegurl', 'application/vnd.apple.mpegurl', 'audio/mpegurl', 'audio/hls', 'video/hls'].indexOf(type.toLowerCase()); 1879 }, 1880 1881 create: FlashMediaElementRenderer.create 1882 }; 1883 _renderer.renderer.add(FlashMediaElementHlsVideoRenderer); 1884 1885 var FlashMediaElementMdashVideoRenderer = { 1886 name: 'flash_dash', 1887 options: { 1888 prefix: 'flash_dash', 1889 filename: 'mediaelement-flash-video-mdash.swf' 1890 }, 1891 1892 canPlayType: function canPlayType(type) { 1893 return ~['application/dash+xml'].indexOf(type.toLowerCase()); 1894 }, 1895 1896 create: FlashMediaElementRenderer.create 1897 }; 1898 _renderer.renderer.add(FlashMediaElementMdashVideoRenderer); 1899 1900 var FlashMediaElementAudioRenderer = { 1901 name: 'flash_audio', 1902 options: { 1903 prefix: 'flash_audio', 1904 filename: 'mediaelement-flash-audio.swf' 1905 }, 1906 1907 canPlayType: function canPlayType(type) { 1908 return ~['audio/mp3'].indexOf(type.toLowerCase()); 1909 }, 1910 1911 create: FlashMediaElementRenderer.create 1912 }; 1913 _renderer.renderer.add(FlashMediaElementAudioRenderer); 1914 1915 var FlashMediaElementAudioOggRenderer = { 1916 name: 'flash_audio_ogg', 1917 options: { 1918 prefix: 'flash_audio_ogg', 1919 filename: 'mediaelement-flash-audio-ogg.swf' 1920 }, 1921 1922 canPlayType: function canPlayType(type) { 1923 return ~['audio/ogg', 'audio/oga', 'audio/ogv'].indexOf(type.toLowerCase()); 1924 }, 1925 1926 create: FlashMediaElementRenderer.create 1927 }; 1928 _renderer.renderer.add(FlashMediaElementAudioOggRenderer); 1929 } 1930 1931 },{"16":16,"18":18,"19":19,"2":2,"3":3,"5":5,"7":7,"8":8}],12:[function(_dereq_,module,exports){ 1932 'use strict'; 1933 1934 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; }; 1935 1936 var _window = _dereq_(3); 1937 1938 var _window2 = _interopRequireDefault(_window); 1939 1940 var _mejs = _dereq_(7); 1941 1942 var _mejs2 = _interopRequireDefault(_mejs); 1943 1944 var _renderer = _dereq_(8); 1945 1946 var _general = _dereq_(18); 1947 1948 var _constants = _dereq_(16); 1949 1950 var _media = _dereq_(19); 1951 1952 var _dom = _dereq_(17); 1953 1954 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 1955 1956 var NativeFlv = { 1957 1958 promise: null, 1959 1960 load: function load(settings) { 1961 if (typeof flvjs !== 'undefined') { 1962 NativeFlv.promise = new Promise(function (resolve) { 1963 resolve(); 1964 }).then(function () { 1965 NativeFlv._createPlayer(settings); 1966 }); 1967 } else { 1968 settings.options.path = typeof settings.options.path === 'string' ? settings.options.path : 'https://cdn.jsdelivr.net/npm/flv.js@latest'; 1969 1970 NativeFlv.promise = NativeFlv.promise || (0, _dom.loadScript)(settings.options.path); 1971 NativeFlv.promise.then(function () { 1972 NativeFlv._createPlayer(settings); 1973 }); 1974 } 1975 1976 return NativeFlv.promise; 1977 }, 1978 1979 _createPlayer: function _createPlayer(settings) { 1980 flvjs.LoggingControl.enableDebug = settings.options.debug; 1981 flvjs.LoggingControl.enableVerbose = settings.options.debug; 1982 var player = flvjs.createPlayer(settings.options, settings.configs); 1983 _window2.default['__ready__' + settings.id](player); 1984 return player; 1985 } 1986 }; 1987 1988 var FlvNativeRenderer = { 1989 name: 'native_flv', 1990 options: { 1991 prefix: 'native_flv', 1992 flv: { 1993 path: 'https://cdn.jsdelivr.net/npm/flv.js@latest', 1994 1995 cors: true, 1996 debug: false 1997 } 1998 }, 1999 2000 canPlayType: function canPlayType(type) { 2001 return _constants.HAS_MSE && ['video/x-flv', 'video/flv'].indexOf(type.toLowerCase()) > -1; 2002 }, 2003 2004 create: function create(mediaElement, options, mediaFiles) { 2005 2006 var originalNode = mediaElement.originalNode, 2007 id = mediaElement.id + '_' + options.prefix; 2008 2009 var node = null, 2010 flvPlayer = null; 2011 2012 node = originalNode.cloneNode(true); 2013 options = Object.assign(options, mediaElement.options); 2014 2015 var props = _mejs2.default.html5media.properties, 2016 events = _mejs2.default.html5media.events.concat(['click', 'mouseover', 'mouseout']).filter(function (e) { 2017 return e !== 'error'; 2018 }), 2019 attachNativeEvents = function attachNativeEvents(e) { 2020 var event = (0, _general.createEvent)(e.type, mediaElement); 2021 mediaElement.dispatchEvent(event); 2022 }, 2023 assignGettersSetters = function assignGettersSetters(propName) { 2024 var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1); 2025 2026 node['get' + capName] = function () { 2027 return flvPlayer !== null ? node[propName] : null; 2028 }; 2029 2030 node['set' + capName] = function (value) { 2031 if (_mejs2.default.html5media.readOnlyProperties.indexOf(propName) === -1) { 2032 if (propName === 'src') { 2033 node[propName] = (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value.src ? value.src : value; 2034 if (flvPlayer !== null) { 2035 var _flvOptions = {}; 2036 _flvOptions.type = 'flv'; 2037 _flvOptions.url = value; 2038 _flvOptions.cors = options.flv.cors; 2039 _flvOptions.debug = options.flv.debug; 2040 _flvOptions.path = options.flv.path; 2041 var _flvConfigs = options.flv.configs; 2042 2043 flvPlayer.destroy(); 2044 for (var i = 0, total = events.length; i < total; i++) { 2045 node.removeEventListener(events[i], attachNativeEvents); 2046 } 2047 flvPlayer = NativeFlv._createPlayer({ 2048 options: _flvOptions, 2049 configs: _flvConfigs, 2050 id: id 2051 }); 2052 flvPlayer.attachMediaElement(node); 2053 flvPlayer.load(); 2054 } 2055 } else { 2056 node[propName] = value; 2057 } 2058 } 2059 }; 2060 }; 2061 2062 for (var i = 0, total = props.length; i < total; i++) { 2063 assignGettersSetters(props[i]); 2064 } 2065 2066 _window2.default['__ready__' + id] = function (_flvPlayer) { 2067 mediaElement.flvPlayer = flvPlayer = _flvPlayer; 2068 2069 var flvEvents = flvjs.Events, 2070 assignEvents = function assignEvents(eventName) { 2071 if (eventName === 'loadedmetadata') { 2072 flvPlayer.unload(); 2073 flvPlayer.detachMediaElement(); 2074 flvPlayer.attachMediaElement(node); 2075 flvPlayer.load(); 2076 } 2077 2078 node.addEventListener(eventName, attachNativeEvents); 2079 }; 2080 2081 for (var _i = 0, _total = events.length; _i < _total; _i++) { 2082 assignEvents(events[_i]); 2083 } 2084 2085 var assignFlvEvents = function assignFlvEvents(name, data) { 2086 if (name === 'error') { 2087 var message = data[0] + ': ' + data[1] + ' ' + data[2].msg; 2088 mediaElement.generateError(message, node.src); 2089 } else { 2090 var _event = (0, _general.createEvent)(name, mediaElement); 2091 _event.data = data; 2092 mediaElement.dispatchEvent(_event); 2093 } 2094 }; 2095 2096 var _loop = function _loop(eventType) { 2097 if (flvEvents.hasOwnProperty(eventType)) { 2098 flvPlayer.on(flvEvents[eventType], function () { 2099 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { 2100 args[_key] = arguments[_key]; 2101 } 2102 2103 return assignFlvEvents(flvEvents[eventType], args); 2104 }); 2105 } 2106 }; 2107 2108 for (var eventType in flvEvents) { 2109 _loop(eventType); 2110 } 2111 }; 2112 2113 if (mediaFiles && mediaFiles.length > 0) { 2114 for (var _i2 = 0, _total2 = mediaFiles.length; _i2 < _total2; _i2++) { 2115 if (_renderer.renderer.renderers[options.prefix].canPlayType(mediaFiles[_i2].type)) { 2116 node.setAttribute('src', mediaFiles[_i2].src); 2117 break; 2118 } 2119 } 2120 } 2121 2122 node.setAttribute('id', id); 2123 2124 originalNode.parentNode.insertBefore(node, originalNode); 2125 originalNode.autoplay = false; 2126 originalNode.style.display = 'none'; 2127 2128 var flvOptions = {}; 2129 flvOptions.type = 'flv'; 2130 flvOptions.url = node.src; 2131 flvOptions.cors = options.flv.cors; 2132 flvOptions.debug = options.flv.debug; 2133 flvOptions.path = options.flv.path; 2134 var flvConfigs = options.flv.configs; 2135 2136 node.setSize = function (width, height) { 2137 node.style.width = width + 'px'; 2138 node.style.height = height + 'px'; 2139 return node; 2140 }; 2141 2142 node.hide = function () { 2143 if (flvPlayer !== null) { 2144 flvPlayer.pause(); 2145 } 2146 node.style.display = 'none'; 2147 return node; 2148 }; 2149 2150 node.show = function () { 2151 node.style.display = ''; 2152 return node; 2153 }; 2154 2155 node.destroy = function () { 2156 if (flvPlayer !== null) { 2157 flvPlayer.destroy(); 2158 } 2159 }; 2160 2161 var event = (0, _general.createEvent)('rendererready', node); 2162 mediaElement.dispatchEvent(event); 2163 2164 mediaElement.promises.push(NativeFlv.load({ 2165 options: flvOptions, 2166 configs: flvConfigs, 2167 id: id 2168 })); 2169 2170 return node; 2171 } 2172 }; 2173 2174 _media.typeChecks.push(function (url) { 2175 return ~url.toLowerCase().indexOf('.flv') ? 'video/flv' : null; 2176 }); 2177 2178 _renderer.renderer.add(FlvNativeRenderer); 2179 2180 },{"16":16,"17":17,"18":18,"19":19,"3":3,"7":7,"8":8}],13:[function(_dereq_,module,exports){ 2181 'use strict'; 2182 2183 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; }; 2184 2185 var _window = _dereq_(3); 2186 2187 var _window2 = _interopRequireDefault(_window); 2188 2189 var _mejs = _dereq_(7); 2190 2191 var _mejs2 = _interopRequireDefault(_mejs); 2192 2193 var _renderer = _dereq_(8); 2194 2195 var _general = _dereq_(18); 2196 2197 var _constants = _dereq_(16); 2198 2199 var _media = _dereq_(19); 2200 2201 var _dom = _dereq_(17); 2202 2203 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 2204 2205 var NativeHls = { 2206 2207 promise: null, 2208 2209 load: function load(settings) { 2210 if (typeof Hls !== 'undefined') { 2211 NativeHls.promise = new Promise(function (resolve) { 2212 resolve(); 2213 }).then(function () { 2214 NativeHls._createPlayer(settings); 2215 }); 2216 } else { 2217 settings.options.path = typeof settings.options.path === 'string' ? settings.options.path : 'https://cdn.jsdelivr.net/npm/hls.js@latest'; 2218 2219 NativeHls.promise = NativeHls.promise || (0, _dom.loadScript)(settings.options.path); 2220 NativeHls.promise.then(function () { 2221 NativeHls._createPlayer(settings); 2222 }); 2223 } 2224 2225 return NativeHls.promise; 2226 }, 2227 2228 _createPlayer: function _createPlayer(settings) { 2229 var player = new Hls(settings.options); 2230 _window2.default['__ready__' + settings.id](player); 2231 return player; 2232 } 2233 }; 2234 2235 var HlsNativeRenderer = { 2236 name: 'native_hls', 2237 options: { 2238 prefix: 'native_hls', 2239 hls: { 2240 path: 'https://cdn.jsdelivr.net/npm/hls.js@latest', 2241 2242 autoStartLoad: false, 2243 debug: false 2244 } 2245 }, 2246 2247 canPlayType: function canPlayType(type) { 2248 return _constants.HAS_MSE && ['application/x-mpegurl', 'application/vnd.apple.mpegurl', 'audio/mpegurl', 'audio/hls', 'video/hls'].indexOf(type.toLowerCase()) > -1; 2249 }, 2250 2251 create: function create(mediaElement, options, mediaFiles) { 2252 2253 var originalNode = mediaElement.originalNode, 2254 id = mediaElement.id + '_' + options.prefix, 2255 preload = originalNode.getAttribute('preload'), 2256 autoplay = originalNode.autoplay; 2257 2258 var hlsPlayer = null, 2259 node = null, 2260 index = 0, 2261 total = mediaFiles.length; 2262 2263 node = originalNode.cloneNode(true); 2264 options = Object.assign(options, mediaElement.options); 2265 options.hls.autoStartLoad = preload && preload !== 'none' || autoplay; 2266 2267 var props = _mejs2.default.html5media.properties, 2268 events = _mejs2.default.html5media.events.concat(['click', 'mouseover', 'mouseout']).filter(function (e) { 2269 return e !== 'error'; 2270 }), 2271 attachNativeEvents = function attachNativeEvents(e) { 2272 var event = (0, _general.createEvent)(e.type, mediaElement); 2273 mediaElement.dispatchEvent(event); 2274 }, 2275 assignGettersSetters = function assignGettersSetters(propName) { 2276 var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1); 2277 2278 node['get' + capName] = function () { 2279 return hlsPlayer !== null ? node[propName] : null; 2280 }; 2281 2282 node['set' + capName] = function (value) { 2283 if (_mejs2.default.html5media.readOnlyProperties.indexOf(propName) === -1) { 2284 if (propName === 'src') { 2285 node[propName] = (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value.src ? value.src : value; 2286 if (hlsPlayer !== null) { 2287 hlsPlayer.destroy(); 2288 for (var i = 0, _total = events.length; i < _total; i++) { 2289 node.removeEventListener(events[i], attachNativeEvents); 2290 } 2291 hlsPlayer = NativeHls._createPlayer({ 2292 options: options.hls, 2293 id: id 2294 }); 2295 hlsPlayer.loadSource(value); 2296 hlsPlayer.attachMedia(node); 2297 } 2298 } else { 2299 node[propName] = value; 2300 } 2301 } 2302 }; 2303 }; 2304 2305 for (var i = 0, _total2 = props.length; i < _total2; i++) { 2306 assignGettersSetters(props[i]); 2307 } 2308 2309 _window2.default['__ready__' + id] = function (_hlsPlayer) { 2310 mediaElement.hlsPlayer = hlsPlayer = _hlsPlayer; 2311 var hlsEvents = Hls.Events, 2312 assignEvents = function assignEvents(eventName) { 2313 if (eventName === 'loadedmetadata') { 2314 var url = mediaElement.originalNode.src; 2315 hlsPlayer.detachMedia(); 2316 hlsPlayer.loadSource(url); 2317 hlsPlayer.attachMedia(node); 2318 } 2319 2320 node.addEventListener(eventName, attachNativeEvents); 2321 }; 2322 2323 for (var _i = 0, _total3 = events.length; _i < _total3; _i++) { 2324 assignEvents(events[_i]); 2325 } 2326 2327 var recoverDecodingErrorDate = void 0, 2328 recoverSwapAudioCodecDate = void 0; 2329 var assignHlsEvents = function assignHlsEvents(name, data) { 2330 if (name === 'hlsError') { 2331 console.warn(data); 2332 data = data[1]; 2333 2334 if (data.fatal) { 2335 switch (data.type) { 2336 case 'mediaError': 2337 var now = new Date().getTime(); 2338 if (!recoverDecodingErrorDate || now - recoverDecodingErrorDate > 3000) { 2339 recoverDecodingErrorDate = new Date().getTime(); 2340 hlsPlayer.recoverMediaError(); 2341 } else if (!recoverSwapAudioCodecDate || now - recoverSwapAudioCodecDate > 3000) { 2342 recoverSwapAudioCodecDate = new Date().getTime(); 2343 console.warn('Attempting to swap Audio Codec and recover from media error'); 2344 hlsPlayer.swapAudioCodec(); 2345 hlsPlayer.recoverMediaError(); 2346 } else { 2347 var message = 'Cannot recover, last media error recovery failed'; 2348 mediaElement.generateError(message, node.src); 2349 console.error(message); 2350 } 2351 break; 2352 case 'networkError': 2353 if (data.details === 'manifestLoadError') { 2354 if (index < total && mediaFiles[index + 1] !== undefined) { 2355 node.setSrc(mediaFiles[index++].src); 2356 node.load(); 2357 node.play(); 2358 } else { 2359 var _message = 'Network error'; 2360 mediaElement.generateError(_message, mediaFiles); 2361 console.error(_message); 2362 } 2363 } else { 2364 var _message2 = 'Network error'; 2365 mediaElement.generateError(_message2, mediaFiles); 2366 console.error(_message2); 2367 } 2368 break; 2369 default: 2370 hlsPlayer.destroy(); 2371 break; 2372 } 2373 return; 2374 } 2375 } 2376 var event = (0, _general.createEvent)(name, mediaElement); 2377 event.data = data; 2378 mediaElement.dispatchEvent(event); 2379 }; 2380 2381 var _loop = function _loop(eventType) { 2382 if (hlsEvents.hasOwnProperty(eventType)) { 2383 hlsPlayer.on(hlsEvents[eventType], function () { 2384 for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { 2385 args[_key] = arguments[_key]; 2386 } 2387 2388 return assignHlsEvents(hlsEvents[eventType], args); 2389 }); 2390 } 2391 }; 2392 2393 for (var eventType in hlsEvents) { 2394 _loop(eventType); 2395 } 2396 }; 2397 2398 if (total > 0) { 2399 for (; index < total; index++) { 2400 if (_renderer.renderer.renderers[options.prefix].canPlayType(mediaFiles[index].type)) { 2401 node.setAttribute('src', mediaFiles[index].src); 2402 break; 2403 } 2404 } 2405 } 2406 2407 if (preload !== 'auto' && !autoplay) { 2408 node.addEventListener('play', function () { 2409 if (hlsPlayer !== null) { 2410 hlsPlayer.startLoad(); 2411 } 2412 }); 2413 2414 node.addEventListener('pause', function () { 2415 if (hlsPlayer !== null) { 2416 hlsPlayer.stopLoad(); 2417 } 2418 }); 2419 } 2420 2421 node.setAttribute('id', id); 2422 2423 originalNode.parentNode.insertBefore(node, originalNode); 2424 originalNode.autoplay = false; 2425 originalNode.style.display = 'none'; 2426 2427 node.setSize = function (width, height) { 2428 node.style.width = width + 'px'; 2429 node.style.height = height + 'px'; 2430 return node; 2431 }; 2432 2433 node.hide = function () { 2434 node.pause(); 2435 node.style.display = 'none'; 2436 return node; 2437 }; 2438 2439 node.show = function () { 2440 node.style.display = ''; 2441 return node; 2442 }; 2443 2444 node.destroy = function () { 2445 if (hlsPlayer !== null) { 2446 hlsPlayer.stopLoad(); 2447 hlsPlayer.destroy(); 2448 } 2449 }; 2450 2451 var event = (0, _general.createEvent)('rendererready', node); 2452 mediaElement.dispatchEvent(event); 2453 2454 mediaElement.promises.push(NativeHls.load({ 2455 options: options.hls, 2456 id: id 2457 })); 2458 2459 return node; 2460 } 2461 }; 2462 2463 _media.typeChecks.push(function (url) { 2464 return ~url.toLowerCase().indexOf('.m3u8') ? 'application/x-mpegURL' : null; 2465 }); 2466 2467 _renderer.renderer.add(HlsNativeRenderer); 2468 2469 },{"16":16,"17":17,"18":18,"19":19,"3":3,"7":7,"8":8}],14:[function(_dereq_,module,exports){ 2470 'use strict'; 2471 2472 var _window = _dereq_(3); 2473 2474 var _window2 = _interopRequireDefault(_window); 2475 2476 var _document = _dereq_(2); 2477 2478 var _document2 = _interopRequireDefault(_document); 2479 2480 var _mejs = _dereq_(7); 2481 2482 var _mejs2 = _interopRequireDefault(_mejs); 2483 2484 var _renderer = _dereq_(8); 2485 2486 var _general = _dereq_(18); 2487 2488 var _constants = _dereq_(16); 2489 2490 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 2491 2492 var HtmlMediaElement = { 2493 name: 'html5', 2494 options: { 2495 prefix: 'html5' 2496 }, 2497 2498 canPlayType: function canPlayType(type) { 2499 2500 var mediaElement = _document2.default.createElement('video'); 2501 2502 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) { 2503 return 'yes'; 2504 } else if (mediaElement.canPlayType) { 2505 return mediaElement.canPlayType(type.toLowerCase()).replace(/no/, ''); 2506 } else { 2507 return ''; 2508 } 2509 }, 2510 2511 create: function create(mediaElement, options, mediaFiles) { 2512 2513 var id = mediaElement.id + '_' + options.prefix; 2514 var isActive = false; 2515 2516 var node = null; 2517 2518 if (mediaElement.originalNode === undefined || mediaElement.originalNode === null) { 2519 node = _document2.default.createElement('audio'); 2520 mediaElement.appendChild(node); 2521 } else { 2522 node = mediaElement.originalNode; 2523 } 2524 2525 node.setAttribute('id', id); 2526 2527 var props = _mejs2.default.html5media.properties, 2528 assignGettersSetters = function assignGettersSetters(propName) { 2529 var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1); 2530 2531 node['get' + capName] = function () { 2532 return node[propName]; 2533 }; 2534 2535 node['set' + capName] = function (value) { 2536 if (_mejs2.default.html5media.readOnlyProperties.indexOf(propName) === -1) { 2537 node[propName] = value; 2538 } 2539 }; 2540 }; 2541 2542 for (var i = 0, _total = props.length; i < _total; i++) { 2543 assignGettersSetters(props[i]); 2544 } 2545 2546 var events = _mejs2.default.html5media.events.concat(['click', 'mouseover', 'mouseout']).filter(function (e) { 2547 return e !== 'error'; 2548 }), 2549 assignEvents = function assignEvents(eventName) { 2550 node.addEventListener(eventName, function (e) { 2551 if (isActive) { 2552 var _event = (0, _general.createEvent)(e.type, e.target); 2553 mediaElement.dispatchEvent(_event); 2554 } 2555 }); 2556 }; 2557 2558 for (var _i = 0, _total2 = events.length; _i < _total2; _i++) { 2559 assignEvents(events[_i]); 2560 } 2561 2562 node.setSize = function (width, height) { 2563 node.style.width = width + 'px'; 2564 node.style.height = height + 'px'; 2565 return node; 2566 }; 2567 2568 node.hide = function () { 2569 isActive = false; 2570 node.style.display = 'none'; 2571 2572 return node; 2573 }; 2574 2575 node.show = function () { 2576 isActive = true; 2577 node.style.display = ''; 2578 2579 return node; 2580 }; 2581 2582 var index = 0, 2583 total = mediaFiles.length; 2584 if (total > 0) { 2585 for (; index < total; index++) { 2586 if (_renderer.renderer.renderers[options.prefix].canPlayType(mediaFiles[index].type)) { 2587 node.setAttribute('src', mediaFiles[index].src); 2588 break; 2589 } 2590 } 2591 } 2592 2593 node.addEventListener('error', function (e) { 2594 if (e && e.target && e.target.error && e.target.error.code === 4 && isActive) { 2595 if (index < total && mediaFiles[index + 1] !== undefined) { 2596 node.src = mediaFiles[index++].src; 2597 node.load(); 2598 node.play(); 2599 } else { 2600 mediaElement.generateError('Media error: Format(s) not supported or source(s) not found', mediaFiles); 2601 } 2602 } 2603 }); 2604 2605 var event = (0, _general.createEvent)('rendererready', node); 2606 mediaElement.dispatchEvent(event); 2607 2608 return node; 2609 } 2610 }; 2611 2612 _window2.default.HtmlMediaElement = _mejs2.default.HtmlMediaElement = HtmlMediaElement; 2613 2614 _renderer.renderer.add(HtmlMediaElement); 2615 2616 },{"16":16,"18":18,"2":2,"3":3,"7":7,"8":8}],15:[function(_dereq_,module,exports){ 2617 'use strict'; 2618 2619 var _window = _dereq_(3); 2620 2621 var _window2 = _interopRequireDefault(_window); 2622 2623 var _document = _dereq_(2); 2624 2625 var _document2 = _interopRequireDefault(_document); 2626 2627 var _mejs = _dereq_(7); 2628 2629 var _mejs2 = _interopRequireDefault(_mejs); 2630 2631 var _renderer = _dereq_(8); 2632 2633 var _general = _dereq_(18); 2634 2635 var _media = _dereq_(19); 2636 2637 var _dom = _dereq_(17); 2638 2639 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 2640 2641 var YouTubeApi = { 2642 isIframeStarted: false, 2643 2644 isIframeLoaded: false, 2645 2646 iframeQueue: [], 2647 2648 enqueueIframe: function enqueueIframe(settings) { 2649 YouTubeApi.isLoaded = typeof YT !== 'undefined' && YT.loaded; 2650 2651 if (YouTubeApi.isLoaded) { 2652 YouTubeApi.createIframe(settings); 2653 } else { 2654 YouTubeApi.loadIframeApi(); 2655 YouTubeApi.iframeQueue.push(settings); 2656 } 2657 }, 2658 2659 loadIframeApi: function loadIframeApi() { 2660 if (!YouTubeApi.isIframeStarted) { 2661 (0, _dom.loadScript)('https://www.youtube.com/player_api'); 2662 YouTubeApi.isIframeStarted = true; 2663 } 2664 }, 2665 2666 iFrameReady: function iFrameReady() { 2667 2668 YouTubeApi.isLoaded = true; 2669 YouTubeApi.isIframeLoaded = true; 2670 2671 while (YouTubeApi.iframeQueue.length > 0) { 2672 var settings = YouTubeApi.iframeQueue.pop(); 2673 YouTubeApi.createIframe(settings); 2674 } 2675 }, 2676 2677 createIframe: function createIframe(settings) { 2678 return new YT.Player(settings.containerId, settings); 2679 }, 2680 2681 getYouTubeId: function getYouTubeId(url) { 2682 2683 var youTubeId = ''; 2684 2685 if (url.indexOf('?') > 0) { 2686 youTubeId = YouTubeApi.getYouTubeIdFromParam(url); 2687 2688 if (youTubeId === '') { 2689 youTubeId = YouTubeApi.getYouTubeIdFromUrl(url); 2690 } 2691 } else { 2692 youTubeId = YouTubeApi.getYouTubeIdFromUrl(url); 2693 } 2694 2695 var id = youTubeId.substring(youTubeId.lastIndexOf('/') + 1); 2696 youTubeId = id.split('?'); 2697 return youTubeId[0]; 2698 }, 2699 2700 getYouTubeIdFromParam: function getYouTubeIdFromParam(url) { 2701 2702 if (url === undefined || url === null || !url.trim().length) { 2703 return null; 2704 } 2705 2706 var parts = url.split('?'), 2707 parameters = parts[1].split('&'); 2708 2709 var youTubeId = ''; 2710 2711 for (var i = 0, total = parameters.length; i < total; i++) { 2712 var paramParts = parameters[i].split('='); 2713 if (paramParts[0] === 'v') { 2714 youTubeId = paramParts[1]; 2715 break; 2716 } 2717 } 2718 2719 return youTubeId; 2720 }, 2721 2722 getYouTubeIdFromUrl: function getYouTubeIdFromUrl(url) { 2723 2724 if (url === undefined || url === null || !url.trim().length) { 2725 return null; 2726 } 2727 2728 var parts = url.split('?'); 2729 url = parts[0]; 2730 return url.substring(url.lastIndexOf('/') + 1); 2731 }, 2732 2733 getYouTubeNoCookieUrl: function getYouTubeNoCookieUrl(url) { 2734 if (url === undefined || url === null || !url.trim().length || url.indexOf('//www.youtube') === -1) { 2735 return url; 2736 } 2737 2738 var parts = url.split('/'); 2739 parts[2] = parts[2].replace('.com', '-nocookie.com'); 2740 return parts.join('/'); 2741 } 2742 }; 2743 2744 var YouTubeIframeRenderer = { 2745 name: 'youtube_iframe', 2746 2747 options: { 2748 prefix: 'youtube_iframe', 2749 2750 youtube: { 2751 autoplay: 0, 2752 controls: 0, 2753 disablekb: 1, 2754 end: 0, 2755 loop: 0, 2756 modestbranding: 0, 2757 playsinline: 0, 2758 rel: 0, 2759 showinfo: 0, 2760 start: 0, 2761 iv_load_policy: 3, 2762 2763 nocookie: false, 2764 2765 imageQuality: null 2766 } 2767 }, 2768 2769 canPlayType: function canPlayType(type) { 2770 return ~['video/youtube', 'video/x-youtube'].indexOf(type.toLowerCase()); 2771 }, 2772 2773 create: function create(mediaElement, options, mediaFiles) { 2774 2775 var youtube = {}, 2776 apiStack = [], 2777 readyState = 4; 2778 2779 var youTubeApi = null, 2780 paused = true, 2781 ended = false, 2782 youTubeIframe = null, 2783 volume = 1; 2784 2785 youtube.options = options; 2786 youtube.id = mediaElement.id + '_' + options.prefix; 2787 youtube.mediaElement = mediaElement; 2788 2789 var props = _mejs2.default.html5media.properties, 2790 assignGettersSetters = function assignGettersSetters(propName) { 2791 2792 var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1); 2793 2794 youtube['get' + capName] = function () { 2795 if (youTubeApi !== null) { 2796 var value = null; 2797 2798 switch (propName) { 2799 case 'currentTime': 2800 return youTubeApi.getCurrentTime(); 2801 case 'duration': 2802 return youTubeApi.getDuration(); 2803 case 'volume': 2804 volume = youTubeApi.getVolume() / 100; 2805 return volume; 2806 case 'playbackRate': 2807 return youTubeApi.getPlaybackRate(); 2808 case 'paused': 2809 return paused; 2810 case 'ended': 2811 return ended; 2812 case 'muted': 2813 return youTubeApi.isMuted(); 2814 case 'buffered': 2815 var percentLoaded = youTubeApi.getVideoLoadedFraction(), 2816 duration = youTubeApi.getDuration(); 2817 return { 2818 start: function start() { 2819 return 0; 2820 }, 2821 end: function end() { 2822 return percentLoaded * duration; 2823 }, 2824 length: 1 2825 }; 2826 case 'src': 2827 return youTubeApi.getVideoUrl(); 2828 case 'readyState': 2829 return readyState; 2830 } 2831 2832 return value; 2833 } else { 2834 return null; 2835 } 2836 }; 2837 2838 youtube['set' + capName] = function (value) { 2839 if (youTubeApi !== null) { 2840 switch (propName) { 2841 case 'src': 2842 var url = typeof value === 'string' ? value : value[0].src, 2843 _videoId = YouTubeApi.getYouTubeId(url); 2844 2845 if (mediaElement.originalNode.autoplay) { 2846 youTubeApi.loadVideoById(_videoId); 2847 } else { 2848 youTubeApi.cueVideoById(_videoId); 2849 } 2850 break; 2851 case 'currentTime': 2852 youTubeApi.seekTo(value); 2853 break; 2854 case 'muted': 2855 if (value) { 2856 youTubeApi.mute(); 2857 } else { 2858 youTubeApi.unMute(); 2859 } 2860 setTimeout(function () { 2861 var event = (0, _general.createEvent)('volumechange', youtube); 2862 mediaElement.dispatchEvent(event); 2863 }, 50); 2864 break; 2865 case 'volume': 2866 volume = value; 2867 youTubeApi.setVolume(value * 100); 2868 setTimeout(function () { 2869 var event = (0, _general.createEvent)('volumechange', youtube); 2870 mediaElement.dispatchEvent(event); 2871 }, 50); 2872 break; 2873 case 'playbackRate': 2874 youTubeApi.setPlaybackRate(value); 2875 setTimeout(function () { 2876 var event = (0, _general.createEvent)('ratechange', youtube); 2877 mediaElement.dispatchEvent(event); 2878 }, 50); 2879 break; 2880 case 'readyState': 2881 var event = (0, _general.createEvent)('canplay', youtube); 2882 mediaElement.dispatchEvent(event); 2883 break; 2884 default: 2885 2886 break; 2887 } 2888 } else { 2889 apiStack.push({ type: 'set', propName: propName, value: value }); 2890 } 2891 }; 2892 }; 2893 2894 for (var i = 0, total = props.length; i < total; i++) { 2895 assignGettersSetters(props[i]); 2896 } 2897 2898 var methods = _mejs2.default.html5media.methods, 2899 assignMethods = function assignMethods(methodName) { 2900 youtube[methodName] = function () { 2901 if (youTubeApi !== null) { 2902 switch (methodName) { 2903 case 'play': 2904 paused = false; 2905 return youTubeApi.playVideo(); 2906 case 'pause': 2907 paused = true; 2908 return youTubeApi.pauseVideo(); 2909 case 'load': 2910 return null; 2911 } 2912 } else { 2913 apiStack.push({ type: 'call', methodName: methodName }); 2914 } 2915 }; 2916 }; 2917 2918 for (var _i = 0, _total = methods.length; _i < _total; _i++) { 2919 assignMethods(methods[_i]); 2920 } 2921 2922 var errorHandler = function errorHandler(error) { 2923 var message = ''; 2924 switch (error.data) { 2925 case 2: 2926 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.'; 2927 break; 2928 case 5: 2929 message = 'The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.'; 2930 break; 2931 case 100: 2932 message = 'The video requested was not found. Either video has been removed or has been marked as private.'; 2933 break; 2934 case 101: 2935 case 105: 2936 message = 'The owner of the requested video does not allow it to be played in embedded players.'; 2937 break; 2938 default: 2939 message = 'Unknown error.'; 2940 break; 2941 } 2942 mediaElement.generateError('Code ' + error.data + ': ' + message, mediaFiles); 2943 }; 2944 2945 var youtubeContainer = _document2.default.createElement('div'); 2946 youtubeContainer.id = youtube.id; 2947 2948 if (youtube.options.youtube.nocookie) { 2949 mediaElement.originalNode.src = YouTubeApi.getYouTubeNoCookieUrl(mediaFiles[0].src); 2950 } 2951 2952 mediaElement.originalNode.parentNode.insertBefore(youtubeContainer, mediaElement.originalNode); 2953 mediaElement.originalNode.style.display = 'none'; 2954 2955 var isAudio = mediaElement.originalNode.tagName.toLowerCase() === 'audio', 2956 height = isAudio ? '1' : mediaElement.originalNode.height, 2957 width = isAudio ? '1' : mediaElement.originalNode.width, 2958 videoId = YouTubeApi.getYouTubeId(mediaFiles[0].src), 2959 youtubeSettings = { 2960 id: youtube.id, 2961 containerId: youtubeContainer.id, 2962 videoId: videoId, 2963 height: height, 2964 width: width, 2965 host: youtube.options.youtube && youtube.options.youtube.nocookie ? 'https://www.youtube-nocookie.com' : undefined, 2966 playerVars: Object.assign({ 2967 controls: 0, 2968 rel: 0, 2969 disablekb: 1, 2970 showinfo: 0, 2971 modestbranding: 0, 2972 html5: 1, 2973 iv_load_policy: 3 2974 }, youtube.options.youtube), 2975 origin: _window2.default.location.host, 2976 events: { 2977 onReady: function onReady(e) { 2978 mediaElement.youTubeApi = youTubeApi = e.target; 2979 mediaElement.youTubeState = { 2980 paused: true, 2981 ended: false 2982 }; 2983 2984 if (apiStack.length) { 2985 for (var _i2 = 0, _total2 = apiStack.length; _i2 < _total2; _i2++) { 2986 2987 var stackItem = apiStack[_i2]; 2988 2989 if (stackItem.type === 'set') { 2990 var propName = stackItem.propName, 2991 capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1); 2992 2993 youtube['set' + capName](stackItem.value); 2994 } else if (stackItem.type === 'call') { 2995 youtube[stackItem.methodName](); 2996 } 2997 } 2998 } 2999 3000 youTubeIframe = youTubeApi.getIframe(); 3001 3002 if (mediaElement.originalNode.muted) { 3003 youTubeApi.mute(); 3004 } 3005 3006 var events = ['mouseover', 'mouseout'], 3007 assignEvents = function assignEvents(e) { 3008 var newEvent = (0, _general.createEvent)(e.type, youtube); 3009 mediaElement.dispatchEvent(newEvent); 3010 }; 3011 3012 for (var _i3 = 0, _total3 = events.length; _i3 < _total3; _i3++) { 3013 youTubeIframe.addEventListener(events[_i3], assignEvents, false); 3014 } 3015 3016 var initEvents = ['rendererready', 'loadedmetadata', 'loadeddata', 'canplay']; 3017 3018 for (var _i4 = 0, _total4 = initEvents.length; _i4 < _total4; _i4++) { 3019 var event = (0, _general.createEvent)(initEvents[_i4], youtube); 3020 mediaElement.dispatchEvent(event); 3021 } 3022 }, 3023 onStateChange: function onStateChange(e) { 3024 var events = []; 3025 3026 switch (e.data) { 3027 case -1: 3028 events = ['loadedmetadata']; 3029 paused = true; 3030 ended = false; 3031 break; 3032 case 0: 3033 events = ['ended']; 3034 paused = false; 3035 ended = !youtube.options.youtube.loop; 3036 if (!youtube.options.youtube.loop) { 3037 youtube.stopInterval(); 3038 } 3039 break; 3040 case 1: 3041 events = ['play', 'playing']; 3042 paused = false; 3043 ended = false; 3044 youtube.startInterval(); 3045 break; 3046 case 2: 3047 events = ['pause']; 3048 paused = true; 3049 ended = false; 3050 youtube.stopInterval(); 3051 break; 3052 case 3: 3053 events = ['progress']; 3054 ended = false; 3055 break; 3056 case 5: 3057 events = ['loadeddata', 'loadedmetadata', 'canplay']; 3058 paused = true; 3059 ended = false; 3060 break; 3061 } 3062 3063 for (var _i5 = 0, _total5 = events.length; _i5 < _total5; _i5++) { 3064 var event = (0, _general.createEvent)(events[_i5], youtube); 3065 mediaElement.dispatchEvent(event); 3066 } 3067 }, 3068 onError: function onError(e) { 3069 return errorHandler(e); 3070 } 3071 } 3072 }; 3073 3074 if (isAudio || mediaElement.originalNode.hasAttribute('playsinline')) { 3075 youtubeSettings.playerVars.playsinline = 1; 3076 } 3077 3078 if (mediaElement.originalNode.controls) { 3079 youtubeSettings.playerVars.controls = 1; 3080 } 3081 if (mediaElement.originalNode.autoplay) { 3082 youtubeSettings.playerVars.autoplay = 1; 3083 } 3084 if (mediaElement.originalNode.loop) { 3085 youtubeSettings.playerVars.loop = 1; 3086 } 3087 3088 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) { 3089 youtubeSettings.playerVars.playlist = YouTubeApi.getYouTubeId(mediaElement.originalNode.src); 3090 } 3091 3092 YouTubeApi.enqueueIframe(youtubeSettings); 3093 3094 youtube.onEvent = function (eventName, player, _youTubeState) { 3095 if (_youTubeState !== null && _youTubeState !== undefined) { 3096 mediaElement.youTubeState = _youTubeState; 3097 } 3098 }; 3099 3100 youtube.setSize = function (width, height) { 3101 if (youTubeApi !== null) { 3102 youTubeApi.setSize(width, height); 3103 } 3104 }; 3105 youtube.hide = function () { 3106 youtube.stopInterval(); 3107 youtube.pause(); 3108 if (youTubeIframe) { 3109 youTubeIframe.style.display = 'none'; 3110 } 3111 }; 3112 youtube.show = function () { 3113 if (youTubeIframe) { 3114 youTubeIframe.style.display = ''; 3115 } 3116 }; 3117 youtube.destroy = function () { 3118 youTubeApi.destroy(); 3119 }; 3120 youtube.interval = null; 3121 3122 youtube.startInterval = function () { 3123 youtube.interval = setInterval(function () { 3124 var event = (0, _general.createEvent)('timeupdate', youtube); 3125 mediaElement.dispatchEvent(event); 3126 }, 250); 3127 }; 3128 youtube.stopInterval = function () { 3129 if (youtube.interval) { 3130 clearInterval(youtube.interval); 3131 } 3132 }; 3133 youtube.getPosterUrl = function () { 3134 var quality = options.youtube.imageQuality, 3135 resolutions = ['default', 'hqdefault', 'mqdefault', 'sddefault', 'maxresdefault'], 3136 id = YouTubeApi.getYouTubeId(mediaElement.originalNode.src); 3137 return quality && resolutions.indexOf(quality) > -1 && id ? 'https://img.youtube.com/vi/' + id + '/' + quality + '.jpg' : ''; 3138 }; 3139 3140 return youtube; 3141 } 3142 }; 3143 3144 _window2.default.onYouTubePlayerAPIReady = function () { 3145 YouTubeApi.iFrameReady(); 3146 }; 3147 3148 _media.typeChecks.push(function (url) { 3149 return (/\/\/(www\.youtube|youtu\.?be)/i.test(url) ? 'video/x-youtube' : null 3150 ); 3151 }); 3152 3153 _renderer.renderer.add(YouTubeIframeRenderer); 3154 3155 },{"17":17,"18":18,"19":19,"2":2,"3":3,"7":7,"8":8}],16:[function(_dereq_,module,exports){ 3156 'use strict'; 3157 3158 Object.defineProperty(exports, "__esModule", { 3159 value: true 3160 }); 3161 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; 3162 3163 var _window = _dereq_(3); 3164 3165 var _window2 = _interopRequireDefault(_window); 3166 3167 var _document = _dereq_(2); 3168 3169 var _document2 = _interopRequireDefault(_document); 3170 3171 var _mejs = _dereq_(7); 3172 3173 var _mejs2 = _interopRequireDefault(_mejs); 3174 3175 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 3176 3177 var NAV = exports.NAV = _window2.default.navigator; 3178 var UA = exports.UA = NAV.userAgent.toLowerCase(); 3179 var IS_IPAD = exports.IS_IPAD = /ipad/i.test(UA) && !_window2.default.MSStream; 3180 var IS_IPHONE = exports.IS_IPHONE = /iphone/i.test(UA) && !_window2.default.MSStream; 3181 var IS_IPOD = exports.IS_IPOD = /ipod/i.test(UA) && !_window2.default.MSStream; 3182 var IS_IOS = exports.IS_IOS = /ipad|iphone|ipod/i.test(UA) && !_window2.default.MSStream; 3183 var IS_ANDROID = exports.IS_ANDROID = /android/i.test(UA); 3184 var IS_IE = exports.IS_IE = /(trident|microsoft)/i.test(NAV.appName); 3185 var IS_EDGE = exports.IS_EDGE = 'msLaunchUri' in NAV && !('documentMode' in _document2.default); 3186 var IS_CHROME = exports.IS_CHROME = /chrome/i.test(UA); 3187 var IS_FIREFOX = exports.IS_FIREFOX = /firefox/i.test(UA); 3188 var IS_SAFARI = exports.IS_SAFARI = /safari/i.test(UA) && !IS_CHROME; 3189 var IS_STOCK_ANDROID = exports.IS_STOCK_ANDROID = /^mozilla\/\d+\.\d+\s\(linux;\su;/i.test(UA); 3190 var HAS_MSE = exports.HAS_MSE = 'MediaSource' in _window2.default; 3191 var SUPPORT_POINTER_EVENTS = exports.SUPPORT_POINTER_EVENTS = function () { 3192 var element = _document2.default.createElement('x'), 3193 documentElement = _document2.default.documentElement, 3194 getComputedStyle = _window2.default.getComputedStyle; 3195 3196 if (!('pointerEvents' in element.style)) { 3197 return false; 3198 } 3199 3200 element.style.pointerEvents = 'auto'; 3201 element.style.pointerEvents = 'x'; 3202 documentElement.appendChild(element); 3203 var supports = getComputedStyle && (getComputedStyle(element, '') || {}).pointerEvents === 'auto'; 3204 element.remove(); 3205 return !!supports; 3206 }(); 3207 3208 var SUPPORT_PASSIVE_EVENT = exports.SUPPORT_PASSIVE_EVENT = function () { 3209 var supportsPassive = false; 3210 try { 3211 var opts = Object.defineProperty({}, 'passive', { 3212 get: function get() { 3213 supportsPassive = true; 3214 } 3215 }); 3216 _window2.default.addEventListener('test', null, opts); 3217 } catch (e) {} 3218 3219 return supportsPassive; 3220 }(); 3221 3222 var html5Elements = ['source', 'track', 'audio', 'video']; 3223 var video = void 0; 3224 3225 for (var i = 0, total = html5Elements.length; i < total; i++) { 3226 video = _document2.default.createElement(html5Elements[i]); 3227 } 3228 3229 var SUPPORTS_NATIVE_HLS = exports.SUPPORTS_NATIVE_HLS = IS_SAFARI || IS_IE && /edge/i.test(UA); 3230 3231 var hasiOSFullScreen = video.webkitEnterFullscreen !== undefined; 3232 3233 var hasNativeFullscreen = video.requestFullscreen !== undefined; 3234 3235 if (hasiOSFullScreen && /mac os x 10_5/i.test(UA)) { 3236 hasNativeFullscreen = false; 3237 hasiOSFullScreen = false; 3238 } 3239 3240 var hasWebkitNativeFullScreen = video.webkitRequestFullScreen !== undefined; 3241 var hasMozNativeFullScreen = video.mozRequestFullScreen !== undefined; 3242 var hasMsNativeFullScreen = video.msRequestFullscreen !== undefined; 3243 var hasTrueNativeFullScreen = hasWebkitNativeFullScreen || hasMozNativeFullScreen || hasMsNativeFullScreen; 3244 var nativeFullScreenEnabled = hasTrueNativeFullScreen; 3245 var fullScreenEventName = ''; 3246 var isFullScreen = void 0, 3247 requestFullScreen = void 0, 3248 cancelFullScreen = void 0; 3249 3250 if (hasMozNativeFullScreen) { 3251 nativeFullScreenEnabled = _document2.default.mozFullScreenEnabled; 3252 } else if (hasMsNativeFullScreen) { 3253 nativeFullScreenEnabled = _document2.default.msFullscreenEnabled; 3254 } 3255 3256 if (IS_CHROME) { 3257 hasiOSFullScreen = false; 3258 } 3259 3260 if (hasTrueNativeFullScreen) { 3261 if (hasWebkitNativeFullScreen) { 3262 fullScreenEventName = 'webkitfullscreenchange'; 3263 } else if (hasMozNativeFullScreen) { 3264 fullScreenEventName = 'fullscreenchange'; 3265 } else if (hasMsNativeFullScreen) { 3266 fullScreenEventName = 'MSFullscreenChange'; 3267 } 3268 3269 exports.isFullScreen = isFullScreen = function isFullScreen() { 3270 if (hasMozNativeFullScreen) { 3271 return _document2.default.mozFullScreen; 3272 } else if (hasWebkitNativeFullScreen) { 3273 return _document2.default.webkitIsFullScreen; 3274 } else if (hasMsNativeFullScreen) { 3275 return _document2.default.msFullscreenElement !== null; 3276 } 3277 }; 3278 3279 exports.requestFullScreen = requestFullScreen = function requestFullScreen(el) { 3280 if (hasWebkitNativeFullScreen) { 3281 el.webkitRequestFullScreen(); 3282 } else if (hasMozNativeFullScreen) { 3283 el.mozRequestFullScreen(); 3284 } else if (hasMsNativeFullScreen) { 3285 el.msRequestFullscreen(); 3286 } 3287 }; 3288 3289 exports.cancelFullScreen = cancelFullScreen = function cancelFullScreen() { 3290 if (hasWebkitNativeFullScreen) { 3291 _document2.default.webkitCancelFullScreen(); 3292 } else if (hasMozNativeFullScreen) { 3293 _document2.default.mozCancelFullScreen(); 3294 } else if (hasMsNativeFullScreen) { 3295 _document2.default.msExitFullscreen(); 3296 } 3297 }; 3298 } 3299 3300 var HAS_NATIVE_FULLSCREEN = exports.HAS_NATIVE_FULLSCREEN = hasNativeFullscreen; 3301 var HAS_WEBKIT_NATIVE_FULLSCREEN = exports.HAS_WEBKIT_NATIVE_FULLSCREEN = hasWebkitNativeFullScreen; 3302 var HAS_MOZ_NATIVE_FULLSCREEN = exports.HAS_MOZ_NATIVE_FULLSCREEN = hasMozNativeFullScreen; 3303 var HAS_MS_NATIVE_FULLSCREEN = exports.HAS_MS_NATIVE_FULLSCREEN = hasMsNativeFullScreen; 3304 var HAS_IOS_FULLSCREEN = exports.HAS_IOS_FULLSCREEN = hasiOSFullScreen; 3305 var HAS_TRUE_NATIVE_FULLSCREEN = exports.HAS_TRUE_NATIVE_FULLSCREEN = hasTrueNativeFullScreen; 3306 var HAS_NATIVE_FULLSCREEN_ENABLED = exports.HAS_NATIVE_FULLSCREEN_ENABLED = nativeFullScreenEnabled; 3307 var FULLSCREEN_EVENT_NAME = exports.FULLSCREEN_EVENT_NAME = fullScreenEventName; 3308 exports.isFullScreen = isFullScreen; 3309 exports.requestFullScreen = requestFullScreen; 3310 exports.cancelFullScreen = cancelFullScreen; 3311 3312 3313 _mejs2.default.Features = _mejs2.default.Features || {}; 3314 _mejs2.default.Features.isiPad = IS_IPAD; 3315 _mejs2.default.Features.isiPod = IS_IPOD; 3316 _mejs2.default.Features.isiPhone = IS_IPHONE; 3317 _mejs2.default.Features.isiOS = _mejs2.default.Features.isiPhone || _mejs2.default.Features.isiPad; 3318 _mejs2.default.Features.isAndroid = IS_ANDROID; 3319 _mejs2.default.Features.isIE = IS_IE; 3320 _mejs2.default.Features.isEdge = IS_EDGE; 3321 _mejs2.default.Features.isChrome = IS_CHROME; 3322 _mejs2.default.Features.isFirefox = IS_FIREFOX; 3323 _mejs2.default.Features.isSafari = IS_SAFARI; 3324 _mejs2.default.Features.isStockAndroid = IS_STOCK_ANDROID; 3325 _mejs2.default.Features.hasMSE = HAS_MSE; 3326 _mejs2.default.Features.supportsNativeHLS = SUPPORTS_NATIVE_HLS; 3327 _mejs2.default.Features.supportsPointerEvents = SUPPORT_POINTER_EVENTS; 3328 _mejs2.default.Features.supportsPassiveEvent = SUPPORT_PASSIVE_EVENT; 3329 _mejs2.default.Features.hasiOSFullScreen = HAS_IOS_FULLSCREEN; 3330 _mejs2.default.Features.hasNativeFullscreen = HAS_NATIVE_FULLSCREEN; 3331 _mejs2.default.Features.hasWebkitNativeFullScreen = HAS_WEBKIT_NATIVE_FULLSCREEN; 3332 _mejs2.default.Features.hasMozNativeFullScreen = HAS_MOZ_NATIVE_FULLSCREEN; 3333 _mejs2.default.Features.hasMsNativeFullScreen = HAS_MS_NATIVE_FULLSCREEN; 3334 _mejs2.default.Features.hasTrueNativeFullScreen = HAS_TRUE_NATIVE_FULLSCREEN; 3335 _mejs2.default.Features.nativeFullScreenEnabled = HAS_NATIVE_FULLSCREEN_ENABLED; 3336 _mejs2.default.Features.fullScreenEventName = FULLSCREEN_EVENT_NAME; 3337 _mejs2.default.Features.isFullScreen = isFullScreen; 3338 _mejs2.default.Features.requestFullScreen = requestFullScreen; 3339 _mejs2.default.Features.cancelFullScreen = cancelFullScreen; 3340 3341 },{"2":2,"3":3,"7":7}],17:[function(_dereq_,module,exports){ 3342 'use strict'; 3343 3344 Object.defineProperty(exports, "__esModule", { 3345 value: true 3346 }); 3347 exports.removeClass = exports.addClass = exports.hasClass = undefined; 3348 exports.loadScript = loadScript; 3349 exports.offset = offset; 3350 exports.toggleClass = toggleClass; 3351 exports.fadeOut = fadeOut; 3352 exports.fadeIn = fadeIn; 3353 exports.siblings = siblings; 3354 exports.visible = visible; 3355 exports.ajax = ajax; 3356 3357 var _window = _dereq_(3); 3358 3359 var _window2 = _interopRequireDefault(_window); 3360 3361 var _document = _dereq_(2); 3362 3363 var _document2 = _interopRequireDefault(_document); 3364 3365 var _mejs = _dereq_(7); 3366 3367 var _mejs2 = _interopRequireDefault(_mejs); 3368 3369 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 3370 3371 function loadScript(url) { 3372 return new Promise(function (resolve, reject) { 3373 var script = _document2.default.createElement('script'); 3374 script.src = url; 3375 script.async = true; 3376 script.onload = function () { 3377 script.remove(); 3378 resolve(); 3379 }; 3380 script.onerror = function () { 3381 script.remove(); 3382 reject(); 3383 }; 3384 _document2.default.head.appendChild(script); 3385 }); 3386 } 3387 3388 function offset(el) { 3389 var rect = el.getBoundingClientRect(), 3390 scrollLeft = _window2.default.pageXOffset || _document2.default.documentElement.scrollLeft, 3391 scrollTop = _window2.default.pageYOffset || _document2.default.documentElement.scrollTop; 3392 return { top: rect.top + scrollTop, left: rect.left + scrollLeft }; 3393 } 3394 3395 var hasClassMethod = void 0, 3396 addClassMethod = void 0, 3397 removeClassMethod = void 0; 3398 3399 if ('classList' in _document2.default.documentElement) { 3400 hasClassMethod = function hasClassMethod(el, className) { 3401 return el.classList !== undefined && el.classList.contains(className); 3402 }; 3403 addClassMethod = function addClassMethod(el, className) { 3404 return el.classList.add(className); 3405 }; 3406 removeClassMethod = function removeClassMethod(el, className) { 3407 return el.classList.remove(className); 3408 }; 3409 } else { 3410 hasClassMethod = function hasClassMethod(el, className) { 3411 return new RegExp('\\b' + className + '\\b').test(el.className); 3412 }; 3413 addClassMethod = function addClassMethod(el, className) { 3414 if (!hasClass(el, className)) { 3415 el.className += ' ' + className; 3416 } 3417 }; 3418 removeClassMethod = function removeClassMethod(el, className) { 3419 el.className = el.className.replace(new RegExp('\\b' + className + '\\b', 'g'), ''); 3420 }; 3421 } 3422 3423 var hasClass = exports.hasClass = hasClassMethod; 3424 var addClass = exports.addClass = addClassMethod; 3425 var removeClass = exports.removeClass = removeClassMethod; 3426 3427 function toggleClass(el, className) { 3428 hasClass(el, className) ? removeClass(el, className) : addClass(el, className); 3429 } 3430 3431 function fadeOut(el) { 3432 var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 400; 3433 var callback = arguments[2]; 3434 3435 if (!el.style.opacity) { 3436 el.style.opacity = 1; 3437 } 3438 3439 var start = null; 3440 _window2.default.requestAnimationFrame(function animate(timestamp) { 3441 start = start || timestamp; 3442 var progress = timestamp - start; 3443 var opacity = parseFloat(1 - progress / duration, 2); 3444 el.style.opacity = opacity < 0 ? 0 : opacity; 3445 if (progress > duration) { 3446 if (callback && typeof callback === 'function') { 3447 callback(); 3448 } 3449 } else { 3450 _window2.default.requestAnimationFrame(animate); 3451 } 3452 }); 3453 } 3454 3455 function fadeIn(el) { 3456 var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 400; 3457 var callback = arguments[2]; 3458 3459 if (!el.style.opacity) { 3460 el.style.opacity = 0; 3461 } 3462 3463 var start = null; 3464 _window2.default.requestAnimationFrame(function animate(timestamp) { 3465 start = start || timestamp; 3466 var progress = timestamp - start; 3467 var opacity = parseFloat(progress / duration, 2); 3468 el.style.opacity = opacity > 1 ? 1 : opacity; 3469 if (progress > duration) { 3470 if (callback && typeof callback === 'function') { 3471 callback(); 3472 } 3473 } else { 3474 _window2.default.requestAnimationFrame(animate); 3475 } 3476 }); 3477 } 3478 3479 function siblings(el, filter) { 3480 var siblings = []; 3481 el = el.parentNode.firstChild; 3482 do { 3483 if (!filter || filter(el)) { 3484 siblings.push(el); 3485 } 3486 } while (el = el.nextSibling); 3487 return siblings; 3488 } 3489 3490 function visible(elem) { 3491 if (elem.getClientRects !== undefined && elem.getClientRects === 'function') { 3492 return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length); 3493 } 3494 return !!(elem.offsetWidth || elem.offsetHeight); 3495 } 3496 3497 function ajax(url, dataType, success, error) { 3498 var xhr = _window2.default.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'); 3499 3500 var type = 'application/x-www-form-urlencoded; charset=UTF-8', 3501 completed = false, 3502 accept = '*/'.concat('*'); 3503 3504 switch (dataType) { 3505 case 'text': 3506 type = 'text/plain'; 3507 break; 3508 case 'json': 3509 type = 'application/json, text/javascript'; 3510 break; 3511 case 'html': 3512 type = 'text/html'; 3513 break; 3514 case 'xml': 3515 type = 'application/xml, text/xml'; 3516 break; 3517 } 3518 3519 if (type !== 'application/x-www-form-urlencoded') { 3520 accept = type + ', */*; q=0.01'; 3521 } 3522 3523 if (xhr) { 3524 xhr.open('GET', url, true); 3525 xhr.setRequestHeader('Accept', accept); 3526 xhr.onreadystatechange = function () { 3527 if (completed) { 3528 return; 3529 } 3530 3531 if (xhr.readyState === 4) { 3532 if (xhr.status === 200) { 3533 completed = true; 3534 var data = void 0; 3535 switch (dataType) { 3536 case 'json': 3537 data = JSON.parse(xhr.responseText); 3538 break; 3539 case 'xml': 3540 data = xhr.responseXML; 3541 break; 3542 default: 3543 data = xhr.responseText; 3544 break; 3545 } 3546 success(data); 3547 } else if (typeof error === 'function') { 3548 error(xhr.status); 3549 } 3550 } 3551 }; 3552 3553 xhr.send(); 3554 } 3555 } 3556 3557 _mejs2.default.Utils = _mejs2.default.Utils || {}; 3558 _mejs2.default.Utils.offset = offset; 3559 _mejs2.default.Utils.hasClass = hasClass; 3560 _mejs2.default.Utils.addClass = addClass; 3561 _mejs2.default.Utils.removeClass = removeClass; 3562 _mejs2.default.Utils.toggleClass = toggleClass; 3563 _mejs2.default.Utils.fadeIn = fadeIn; 3564 _mejs2.default.Utils.fadeOut = fadeOut; 3565 _mejs2.default.Utils.siblings = siblings; 3566 _mejs2.default.Utils.visible = visible; 3567 _mejs2.default.Utils.ajax = ajax; 3568 _mejs2.default.Utils.loadScript = loadScript; 3569 3570 },{"2":2,"3":3,"7":7}],18:[function(_dereq_,module,exports){ 3571 'use strict'; 3572 3573 Object.defineProperty(exports, "__esModule", { 3574 value: true 3575 }); 3576 exports.escapeHTML = escapeHTML; 3577 exports.debounce = debounce; 3578 exports.isObjectEmpty = isObjectEmpty; 3579 exports.splitEvents = splitEvents; 3580 exports.createEvent = createEvent; 3581 exports.isNodeAfter = isNodeAfter; 3582 exports.isString = isString; 3583 3584 var _mejs = _dereq_(7); 3585 3586 var _mejs2 = _interopRequireDefault(_mejs); 3587 3588 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 3589 3590 function escapeHTML(input) { 3591 3592 if (typeof input !== 'string') { 3593 throw new Error('Argument passed must be a string'); 3594 } 3595 3596 var map = { 3597 '&': '&', 3598 '<': '<', 3599 '>': '>', 3600 '"': '"' 3601 }; 3602 3603 return input.replace(/[&<>"]/g, function (c) { 3604 return map[c]; 3605 }); 3606 } 3607 3608 function debounce(func, wait) { 3609 var _this = this, 3610 _arguments = arguments; 3611 3612 var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 3613 3614 3615 if (typeof func !== 'function') { 3616 throw new Error('First argument must be a function'); 3617 } 3618 3619 if (typeof wait !== 'number') { 3620 throw new Error('Second argument must be a numeric value'); 3621 } 3622 3623 var timeout = void 0; 3624 return function () { 3625 var context = _this, 3626 args = _arguments; 3627 var later = function later() { 3628 timeout = null; 3629 if (!immediate) { 3630 func.apply(context, args); 3631 } 3632 }; 3633 var callNow = immediate && !timeout; 3634 clearTimeout(timeout); 3635 timeout = setTimeout(later, wait); 3636 3637 if (callNow) { 3638 func.apply(context, args); 3639 } 3640 }; 3641 } 3642 3643 function isObjectEmpty(instance) { 3644 return Object.getOwnPropertyNames(instance).length <= 0; 3645 } 3646 3647 function splitEvents(events, id) { 3648 var rwindow = /^((after|before)print|(before)?unload|hashchange|message|o(ff|n)line|page(hide|show)|popstate|resize|storage)\b/; 3649 3650 var ret = { d: [], w: [] }; 3651 (events || '').split(' ').forEach(function (v) { 3652 var eventName = '' + v + (id ? '.' + id : ''); 3653 3654 if (eventName.startsWith('.')) { 3655 ret.d.push(eventName); 3656 ret.w.push(eventName); 3657 } else { 3658 ret[rwindow.test(v) ? 'w' : 'd'].push(eventName); 3659 } 3660 }); 3661 3662 ret.d = ret.d.join(' '); 3663 ret.w = ret.w.join(' '); 3664 return ret; 3665 } 3666 3667 function createEvent(eventName, target) { 3668 3669 if (typeof eventName !== 'string') { 3670 throw new Error('Event name must be a string'); 3671 } 3672 3673 var eventFrags = eventName.match(/([a-z]+\.([a-z]+))/i), 3674 detail = { 3675 target: target 3676 }; 3677 3678 if (eventFrags !== null) { 3679 eventName = eventFrags[1]; 3680 detail.namespace = eventFrags[2]; 3681 } 3682 3683 return new window.CustomEvent(eventName, { 3684 detail: detail 3685 }); 3686 } 3687 3688 function isNodeAfter(sourceNode, targetNode) { 3689 3690 return !!(sourceNode && targetNode && sourceNode.compareDocumentPosition(targetNode) & 2); 3691 } 3692 3693 function isString(value) { 3694 return typeof value === 'string'; 3695 } 3696 3697 _mejs2.default.Utils = _mejs2.default.Utils || {}; 3698 _mejs2.default.Utils.escapeHTML = escapeHTML; 3699 _mejs2.default.Utils.debounce = debounce; 3700 _mejs2.default.Utils.isObjectEmpty = isObjectEmpty; 3701 _mejs2.default.Utils.splitEvents = splitEvents; 3702 _mejs2.default.Utils.createEvent = createEvent; 3703 _mejs2.default.Utils.isNodeAfter = isNodeAfter; 3704 _mejs2.default.Utils.isString = isString; 3705 3706 },{"7":7}],19:[function(_dereq_,module,exports){ 3707 'use strict'; 3708 3709 Object.defineProperty(exports, "__esModule", { 3710 value: true 3711 }); 3712 exports.typeChecks = undefined; 3713 exports.absolutizeUrl = absolutizeUrl; 3714 exports.formatType = formatType; 3715 exports.getMimeFromType = getMimeFromType; 3716 exports.getTypeFromFile = getTypeFromFile; 3717 exports.getExtension = getExtension; 3718 exports.normalizeExtension = normalizeExtension; 3719 3720 var _mejs = _dereq_(7); 3721 3722 var _mejs2 = _interopRequireDefault(_mejs); 3723 3724 var _general = _dereq_(18); 3725 3726 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 3727 3728 var typeChecks = exports.typeChecks = []; 3729 3730 function absolutizeUrl(url) { 3731 3732 if (typeof url !== 'string') { 3733 throw new Error('`url` argument must be a string'); 3734 } 3735 3736 var el = document.createElement('div'); 3737 el.innerHTML = '<a href="' + (0, _general.escapeHTML)(url) + '">x</a>'; 3738 return el.firstChild.href; 3739 } 3740 3741 function formatType(url) { 3742 var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; 3743 3744 return url && !type ? getTypeFromFile(url) : type; 3745 } 3746 3747 function getMimeFromType(type) { 3748 3749 if (typeof type !== 'string') { 3750 throw new Error('`type` argument must be a string'); 3751 } 3752 3753 return type && type.indexOf(';') > -1 ? type.substr(0, type.indexOf(';')) : type; 3754 } 3755 3756 function getTypeFromFile(url) { 3757 3758 if (typeof url !== 'string') { 3759 throw new Error('`url` argument must be a string'); 3760 } 3761 3762 for (var i = 0, total = typeChecks.length; i < total; i++) { 3763 var type = typeChecks[i](url); 3764 3765 if (type) { 3766 return type; 3767 } 3768 } 3769 3770 var ext = getExtension(url), 3771 normalizedExt = normalizeExtension(ext); 3772 3773 var mime = 'video/mp4'; 3774 3775 if (normalizedExt) { 3776 if (~['mp4', 'm4v', 'ogg', 'ogv', 'webm', 'flv', 'mpeg'].indexOf(normalizedExt)) { 3777 mime = 'video/' + normalizedExt; 3778 } else if ('mov' === normalizedExt) { 3779 mime = 'video/quicktime'; 3780 } else if (~['mp3', 'oga', 'wav', 'mid', 'midi'].indexOf(normalizedExt)) { 3781 mime = 'audio/' + normalizedExt; 3782 } 3783 } 3784 3785 return mime; 3786 } 3787 3788 function getExtension(url) { 3789 3790 if (typeof url !== 'string') { 3791 throw new Error('`url` argument must be a string'); 3792 } 3793 3794 var baseUrl = url.split('?')[0], 3795 baseName = baseUrl.split('\\').pop().split('/').pop(); 3796 return ~baseName.indexOf('.') ? baseName.substring(baseName.lastIndexOf('.') + 1) : ''; 3797 } 3798 3799 function normalizeExtension(extension) { 3800 3801 if (typeof extension !== 'string') { 3802 throw new Error('`extension` argument must be a string'); 3803 } 3804 3805 switch (extension) { 3806 case 'mp4': 3807 case 'm4v': 3808 return 'mp4'; 3809 case 'webm': 3810 case 'webma': 3811 case 'webmv': 3812 return 'webm'; 3813 case 'ogg': 3814 case 'oga': 3815 case 'ogv': 3816 return 'ogg'; 3817 default: 3818 return extension; 3819 } 3820 } 3821 3822 _mejs2.default.Utils = _mejs2.default.Utils || {}; 3823 _mejs2.default.Utils.typeChecks = typeChecks; 3824 _mejs2.default.Utils.absolutizeUrl = absolutizeUrl; 3825 _mejs2.default.Utils.formatType = formatType; 3826 _mejs2.default.Utils.getMimeFromType = getMimeFromType; 3827 _mejs2.default.Utils.getTypeFromFile = getTypeFromFile; 3828 _mejs2.default.Utils.getExtension = getExtension; 3829 _mejs2.default.Utils.normalizeExtension = normalizeExtension; 3830 3831 },{"18":18,"7":7}],20:[function(_dereq_,module,exports){ 3832 'use strict'; 3833 3834 var _document = _dereq_(2); 3835 3836 var _document2 = _interopRequireDefault(_document); 3837 3838 var _promisePolyfill = _dereq_(4); 3839 3840 var _promisePolyfill2 = _interopRequireDefault(_promisePolyfill); 3841 3842 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 3843 3844 (function (arr) { 3845 arr.forEach(function (item) { 3846 if (item.hasOwnProperty('remove')) { 3847 return; 3848 } 3849 Object.defineProperty(item, 'remove', { 3850 configurable: true, 3851 enumerable: true, 3852 writable: true, 3853 value: function remove() { 3854 this.parentNode.removeChild(this); 3855 } 3856 }); 3857 }); 3858 })([Element.prototype, CharacterData.prototype, DocumentType.prototype]); 3859 3860 (function () { 3861 3862 if (typeof window.CustomEvent === 'function') { 3863 return false; 3864 } 3865 3866 function CustomEvent(event, params) { 3867 params = params || { bubbles: false, cancelable: false, detail: undefined }; 3868 var evt = _document2.default.createEvent('CustomEvent'); 3869 evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); 3870 return evt; 3871 } 3872 3873 CustomEvent.prototype = window.Event.prototype; 3874 window.CustomEvent = CustomEvent; 3875 })(); 3876 3877 if (typeof Object.assign !== 'function') { 3878 Object.assign = function (target) { 3879 3880 if (target === null || target === undefined) { 3881 throw new TypeError('Cannot convert undefined or null to object'); 3882 } 3883 3884 var to = Object(target); 3885 3886 for (var index = 1, total = arguments.length; index < total; index++) { 3887 var nextSource = arguments[index]; 3888 3889 if (nextSource !== null) { 3890 for (var nextKey in nextSource) { 3891 if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { 3892 to[nextKey] = nextSource[nextKey]; 3893 } 3894 } 3895 } 3896 } 3897 return to; 3898 }; 3899 } 3900 3901 if (!String.prototype.startsWith) { 3902 String.prototype.startsWith = function (searchString, position) { 3903 position = position || 0; 3904 return this.substr(position, searchString.length) === searchString; 3905 }; 3906 } 3907 3908 if (!Element.prototype.matches) { 3909 Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector || function (s) { 3910 var matches = (this.document || this.ownerDocument).querySelectorAll(s), 3911 i = matches.length - 1; 3912 while (--i >= 0 && matches.item(i) !== this) {} 3913 return i > -1; 3914 }; 3915 } 3916 3917 if (window.Element && !Element.prototype.closest) { 3918 Element.prototype.closest = function (s) { 3919 var matches = (this.document || this.ownerDocument).querySelectorAll(s), 3920 i = void 0, 3921 el = this; 3922 do { 3923 i = matches.length; 3924 while (--i >= 0 && matches.item(i) !== el) {} 3925 } while (i < 0 && (el = el.parentElement)); 3926 return el; 3927 }; 3928 } 3929 3930 (function () { 3931 var lastTime = 0; 3932 var vendors = ['ms', 'moz', 'webkit', 'o']; 3933 for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { 3934 window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame']; 3935 window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame']; 3936 } 3937 3938 if (!window.requestAnimationFrame) window.requestAnimationFrame = function (callback) { 3939 var currTime = new Date().getTime(); 3940 var timeToCall = Math.max(0, 16 - (currTime - lastTime)); 3941 var id = window.setTimeout(function () { 3942 callback(currTime + timeToCall); 3943 }, timeToCall); 3944 lastTime = currTime + timeToCall; 3945 return id; 3946 }; 3947 3948 if (!window.cancelAnimationFrame) window.cancelAnimationFrame = function (id) { 3949 clearTimeout(id); 3950 }; 3951 })(); 3952 3953 if (/firefox/i.test(navigator.userAgent)) { 3954 var getComputedStyle = window.getComputedStyle; 3955 window.getComputedStyle = function (el, pseudoEl) { 3956 var t = getComputedStyle(el, pseudoEl); 3957 return t === null ? { getPropertyValue: function getPropertyValue() {} } : t; 3958 }; 3959 } 3960 3961 if (!window.Promise) { 3962 window.Promise = _promisePolyfill2.default; 3963 } 3964 3965 (function (constructor) { 3966 if (constructor && constructor.prototype && constructor.prototype.children === null) { 3967 Object.defineProperty(constructor.prototype, 'children', { 3968 get: function get() { 3969 var i = 0, 3970 node = void 0, 3971 nodes = this.childNodes, 3972 children = []; 3973 while (node = nodes[i++]) { 3974 if (node.nodeType === 1) { 3975 children.push(node); 3976 } 3977 } 3978 return children; 3979 } 3980 }); 3981 } 3982 })(window.Node || window.Element); 3983 3984 },{"2":2,"4":4}]},{},[20,6,5,9,14,11,10,12,13,15]);
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Thu Nov 21 08:20:01 2024 | Cross-referenced by PHPXref |