mediaelement.js 119 KB

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