mediaelement-and-player.js 259 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522
  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_(15);
  256. var _general = _dereq_(27);
  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. },{"15":15,"27":27,"7":7}],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_(27);
  493. var _media2 = _dereq_(28);
  494. var _renderer = _dereq_(8);
  495. var _constants = _dereq_(25);
  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. },{"2":2,"25":25,"27":27,"28":28,"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. var _window = _dereq_(3);
  959. var _window2 = _interopRequireDefault(_window);
  960. var _document = _dereq_(2);
  961. var _document2 = _interopRequireDefault(_document);
  962. var _i18n = _dereq_(5);
  963. var _i18n2 = _interopRequireDefault(_i18n);
  964. var _player = _dereq_(16);
  965. var _player2 = _interopRequireDefault(_player);
  966. var _constants = _dereq_(25);
  967. var Features = _interopRequireWildcard(_constants);
  968. var _general = _dereq_(27);
  969. var _dom = _dereq_(26);
  970. var _media = _dereq_(28);
  971. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  972. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  973. Object.assign(_player.config, {
  974. usePluginFullScreen: true,
  975. fullscreenText: null,
  976. useFakeFullscreen: false
  977. });
  978. Object.assign(_player2.default.prototype, {
  979. isFullScreen: false,
  980. isNativeFullScreen: false,
  981. isInIframe: false,
  982. isPluginClickThroughCreated: false,
  983. fullscreenMode: '',
  984. containerSizeTimeout: null,
  985. buildfullscreen: function buildfullscreen(player) {
  986. if (!player.isVideo) {
  987. return;
  988. }
  989. player.isInIframe = _window2.default.location !== _window2.default.parent.location;
  990. player.detectFullscreenMode();
  991. var t = this,
  992. fullscreenTitle = (0, _general.isString)(t.options.fullscreenText) ? t.options.fullscreenText : _i18n2.default.t('mejs.fullscreen'),
  993. fullscreenBtn = _document2.default.createElement('div');
  994. fullscreenBtn.className = t.options.classPrefix + 'button ' + t.options.classPrefix + 'fullscreen-button';
  995. fullscreenBtn.innerHTML = '<button type="button" aria-controls="' + t.id + '" title="' + fullscreenTitle + '" aria-label="' + fullscreenTitle + '" tabindex="0"></button>';
  996. t.addControlElement(fullscreenBtn, 'fullscreen');
  997. fullscreenBtn.addEventListener('click', function () {
  998. var isFullScreen = Features.HAS_TRUE_NATIVE_FULLSCREEN && Features.IS_FULLSCREEN || player.isFullScreen;
  999. if (isFullScreen) {
  1000. player.exitFullScreen();
  1001. } else {
  1002. player.enterFullScreen();
  1003. }
  1004. });
  1005. player.fullscreenBtn = fullscreenBtn;
  1006. t.options.keyActions.push({
  1007. keys: [70],
  1008. action: function action(player, media, key, event) {
  1009. if (!event.ctrlKey) {
  1010. if (typeof player.enterFullScreen !== 'undefined') {
  1011. if (player.isFullScreen) {
  1012. player.exitFullScreen();
  1013. } else {
  1014. player.enterFullScreen();
  1015. }
  1016. }
  1017. }
  1018. }
  1019. });
  1020. t.exitFullscreenCallback = function (e) {
  1021. var key = e.which || e.keyCode || 0;
  1022. if (t.options.enableKeyboard && key === 27 && (Features.HAS_TRUE_NATIVE_FULLSCREEN && Features.IS_FULLSCREEN || t.isFullScreen)) {
  1023. player.exitFullScreen();
  1024. }
  1025. };
  1026. t.globalBind('keydown', t.exitFullscreenCallback);
  1027. t.normalHeight = 0;
  1028. t.normalWidth = 0;
  1029. if (Features.HAS_TRUE_NATIVE_FULLSCREEN) {
  1030. var fullscreenChanged = function fullscreenChanged() {
  1031. if (player.isFullScreen) {
  1032. if (Features.isFullScreen()) {
  1033. player.isNativeFullScreen = true;
  1034. player.setControlsSize();
  1035. } else {
  1036. player.isNativeFullScreen = false;
  1037. player.exitFullScreen();
  1038. }
  1039. }
  1040. };
  1041. player.globalBind(Features.FULLSCREEN_EVENT_NAME, fullscreenChanged);
  1042. }
  1043. },
  1044. cleanfullscreen: function cleanfullscreen(player) {
  1045. player.exitFullScreen();
  1046. player.globalUnbind('keydown', player.exitFullscreenCallback);
  1047. },
  1048. detectFullscreenMode: function detectFullscreenMode() {
  1049. var t = this,
  1050. isNative = t.media.rendererName !== null && /(native|html5)/i.test(t.media.rendererName);
  1051. var mode = '';
  1052. if (Features.HAS_TRUE_NATIVE_FULLSCREEN && isNative) {
  1053. mode = 'native-native';
  1054. } else if (Features.HAS_TRUE_NATIVE_FULLSCREEN && !isNative) {
  1055. mode = 'plugin-native';
  1056. } else if (t.usePluginFullScreen && Features.SUPPORT_POINTER_EVENTS) {
  1057. mode = 'plugin-click';
  1058. }
  1059. t.fullscreenMode = mode;
  1060. return mode;
  1061. },
  1062. enterFullScreen: function enterFullScreen() {
  1063. var t = this,
  1064. isNative = t.media.rendererName !== null && /(html5|native)/i.test(t.media.rendererName),
  1065. containerStyles = getComputedStyle(t.getElement(t.container));
  1066. if (!t.isVideo) {
  1067. return;
  1068. }
  1069. if (t.options.useFakeFullscreen === false && Features.IS_IOS && Features.HAS_IOS_FULLSCREEN && typeof t.media.originalNode.webkitEnterFullscreen === 'function' && t.media.originalNode.canPlayType((0, _media.getTypeFromFile)(t.media.getSrc()))) {
  1070. t.media.originalNode.webkitEnterFullscreen();
  1071. return;
  1072. }
  1073. (0, _dom.addClass)(_document2.default.documentElement, t.options.classPrefix + 'fullscreen');
  1074. (0, _dom.addClass)(t.getElement(t.container), t.options.classPrefix + 'container-fullscreen');
  1075. t.normalHeight = parseFloat(containerStyles.height);
  1076. t.normalWidth = parseFloat(containerStyles.width);
  1077. if (t.fullscreenMode === 'native-native' || t.fullscreenMode === 'plugin-native') {
  1078. Features.requestFullScreen(t.getElement(t.container));
  1079. if (t.isInIframe) {
  1080. setTimeout(function checkFullscreen() {
  1081. if (t.isNativeFullScreen) {
  1082. var percentErrorMargin = 0.002,
  1083. windowWidth = _window2.default.innerWidth || _document2.default.documentElement.clientWidth || _document2.default.body.clientWidth,
  1084. screenWidth = screen.width,
  1085. absDiff = Math.abs(screenWidth - windowWidth),
  1086. marginError = screenWidth * percentErrorMargin;
  1087. if (absDiff > marginError) {
  1088. t.exitFullScreen();
  1089. } else {
  1090. setTimeout(checkFullscreen, 500);
  1091. }
  1092. }
  1093. }, 1000);
  1094. }
  1095. }
  1096. t.getElement(t.container).style.width = '100%';
  1097. t.getElement(t.container).style.height = '100%';
  1098. t.containerSizeTimeout = setTimeout(function () {
  1099. t.getElement(t.container).style.width = '100%';
  1100. t.getElement(t.container).style.height = '100%';
  1101. t.setControlsSize();
  1102. }, 500);
  1103. if (isNative) {
  1104. t.node.style.width = '100%';
  1105. t.node.style.height = '100%';
  1106. } else {
  1107. var elements = t.getElement(t.container).querySelectorAll('embed, object, video'),
  1108. _total = elements.length;
  1109. for (var i = 0; i < _total; i++) {
  1110. elements[i].style.width = '100%';
  1111. elements[i].style.height = '100%';
  1112. }
  1113. }
  1114. if (t.options.setDimensions && typeof t.media.setSize === 'function') {
  1115. t.media.setSize(screen.width, screen.height);
  1116. }
  1117. var layers = t.getElement(t.layers).children,
  1118. total = layers.length;
  1119. for (var _i = 0; _i < total; _i++) {
  1120. layers[_i].style.width = '100%';
  1121. layers[_i].style.height = '100%';
  1122. }
  1123. if (t.fullscreenBtn) {
  1124. (0, _dom.removeClass)(t.fullscreenBtn, t.options.classPrefix + 'fullscreen');
  1125. (0, _dom.addClass)(t.fullscreenBtn, t.options.classPrefix + 'unfullscreen');
  1126. }
  1127. t.setControlsSize();
  1128. t.isFullScreen = true;
  1129. var zoomFactor = Math.min(screen.width / t.width, screen.height / t.height),
  1130. captionText = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'captions-text');
  1131. if (captionText) {
  1132. captionText.style.fontSize = zoomFactor * 100 + '%';
  1133. captionText.style.lineHeight = 'normal';
  1134. t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'captions-position').style.bottom = (screen.height - t.normalHeight) / 2 - t.getElement(t.controls).offsetHeight / 2 + zoomFactor + 15 + 'px';
  1135. }
  1136. var event = (0, _general.createEvent)('enteredfullscreen', t.getElement(t.container));
  1137. t.getElement(t.container).dispatchEvent(event);
  1138. },
  1139. exitFullScreen: function exitFullScreen() {
  1140. var t = this,
  1141. isNative = t.media.rendererName !== null && /(native|html5)/i.test(t.media.rendererName);
  1142. if (!t.isVideo) {
  1143. return;
  1144. }
  1145. clearTimeout(t.containerSizeTimeout);
  1146. if (Features.HAS_TRUE_NATIVE_FULLSCREEN && (Features.IS_FULLSCREEN || t.isFullScreen)) {
  1147. Features.cancelFullScreen();
  1148. }
  1149. (0, _dom.removeClass)(_document2.default.documentElement, t.options.classPrefix + 'fullscreen');
  1150. (0, _dom.removeClass)(t.getElement(t.container), t.options.classPrefix + 'container-fullscreen');
  1151. if (t.options.setDimensions) {
  1152. t.getElement(t.container).style.width = t.normalWidth + 'px';
  1153. t.getElement(t.container).style.height = t.normalHeight + 'px';
  1154. if (isNative) {
  1155. t.node.style.width = t.normalWidth + 'px';
  1156. t.node.style.height = t.normalHeight + 'px';
  1157. } else {
  1158. var elements = t.getElement(t.container).querySelectorAll('embed, object, video'),
  1159. _total2 = elements.length;
  1160. for (var i = 0; i < _total2; i++) {
  1161. elements[i].style.width = t.normalWidth + 'px';
  1162. elements[i].style.height = t.normalHeight + 'px';
  1163. }
  1164. }
  1165. if (typeof t.media.setSize === 'function') {
  1166. t.media.setSize(t.normalWidth, t.normalHeight);
  1167. }
  1168. var layers = t.getElement(t.layers).children,
  1169. total = layers.length;
  1170. for (var _i2 = 0; _i2 < total; _i2++) {
  1171. layers[_i2].style.width = t.normalWidth + 'px';
  1172. layers[_i2].style.height = t.normalHeight + 'px';
  1173. }
  1174. }
  1175. if (t.fullscreenBtn) {
  1176. (0, _dom.removeClass)(t.fullscreenBtn, t.options.classPrefix + 'unfullscreen');
  1177. (0, _dom.addClass)(t.fullscreenBtn, t.options.classPrefix + 'fullscreen');
  1178. }
  1179. t.setControlsSize();
  1180. t.isFullScreen = false;
  1181. var captionText = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'captions-text');
  1182. if (captionText) {
  1183. captionText.style.fontSize = '';
  1184. captionText.style.lineHeight = '';
  1185. t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'captions-position').style.bottom = '';
  1186. }
  1187. var event = (0, _general.createEvent)('exitedfullscreen', t.getElement(t.container));
  1188. t.getElement(t.container).dispatchEvent(event);
  1189. }
  1190. });
  1191. },{"16":16,"2":2,"25":25,"26":26,"27":27,"28":28,"3":3,"5":5}],10:[function(_dereq_,module,exports){
  1192. 'use strict';
  1193. var _document = _dereq_(2);
  1194. var _document2 = _interopRequireDefault(_document);
  1195. var _player = _dereq_(16);
  1196. var _player2 = _interopRequireDefault(_player);
  1197. var _i18n = _dereq_(5);
  1198. var _i18n2 = _interopRequireDefault(_i18n);
  1199. var _general = _dereq_(27);
  1200. var _dom = _dereq_(26);
  1201. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1202. Object.assign(_player.config, {
  1203. playText: null,
  1204. pauseText: null
  1205. });
  1206. Object.assign(_player2.default.prototype, {
  1207. buildplaypause: function buildplaypause(player, controls, layers, media) {
  1208. var t = this,
  1209. op = t.options,
  1210. playTitle = (0, _general.isString)(op.playText) ? op.playText : _i18n2.default.t('mejs.play'),
  1211. pauseTitle = (0, _general.isString)(op.pauseText) ? op.pauseText : _i18n2.default.t('mejs.pause'),
  1212. play = _document2.default.createElement('div');
  1213. play.className = t.options.classPrefix + 'button ' + t.options.classPrefix + 'playpause-button ' + t.options.classPrefix + 'play';
  1214. play.innerHTML = '<button type="button" aria-controls="' + t.id + '" title="' + playTitle + '" aria-label="' + pauseTitle + '" tabindex="0"></button>';
  1215. play.addEventListener('click', function () {
  1216. if (t.paused) {
  1217. t.play();
  1218. } else {
  1219. t.pause();
  1220. }
  1221. });
  1222. var playBtn = play.querySelector('button');
  1223. t.addControlElement(play, 'playpause');
  1224. function togglePlayPause(which) {
  1225. if ('play' === which) {
  1226. (0, _dom.removeClass)(play, t.options.classPrefix + 'play');
  1227. (0, _dom.removeClass)(play, t.options.classPrefix + 'replay');
  1228. (0, _dom.addClass)(play, t.options.classPrefix + 'pause');
  1229. playBtn.setAttribute('title', pauseTitle);
  1230. playBtn.setAttribute('aria-label', pauseTitle);
  1231. } else {
  1232. (0, _dom.removeClass)(play, t.options.classPrefix + 'pause');
  1233. (0, _dom.removeClass)(play, t.options.classPrefix + 'replay');
  1234. (0, _dom.addClass)(play, t.options.classPrefix + 'play');
  1235. playBtn.setAttribute('title', playTitle);
  1236. playBtn.setAttribute('aria-label', playTitle);
  1237. }
  1238. }
  1239. togglePlayPause('pse');
  1240. media.addEventListener('loadedmetadata', function () {
  1241. if (media.rendererName.indexOf('flash') === -1) {
  1242. togglePlayPause('pse');
  1243. }
  1244. });
  1245. media.addEventListener('play', function () {
  1246. togglePlayPause('play');
  1247. });
  1248. media.addEventListener('playing', function () {
  1249. togglePlayPause('play');
  1250. });
  1251. media.addEventListener('pause', function () {
  1252. togglePlayPause('pse');
  1253. });
  1254. media.addEventListener('ended', function () {
  1255. if (!player.options.loop) {
  1256. (0, _dom.removeClass)(play, t.options.classPrefix + 'pause');
  1257. (0, _dom.removeClass)(play, t.options.classPrefix + 'play');
  1258. (0, _dom.addClass)(play, t.options.classPrefix + 'replay');
  1259. playBtn.setAttribute('title', playTitle);
  1260. playBtn.setAttribute('aria-label', playTitle);
  1261. }
  1262. });
  1263. }
  1264. });
  1265. },{"16":16,"2":2,"26":26,"27":27,"5":5}],11:[function(_dereq_,module,exports){
  1266. 'use strict';
  1267. var _document = _dereq_(2);
  1268. var _document2 = _interopRequireDefault(_document);
  1269. var _player = _dereq_(16);
  1270. var _player2 = _interopRequireDefault(_player);
  1271. var _i18n = _dereq_(5);
  1272. var _i18n2 = _interopRequireDefault(_i18n);
  1273. var _constants = _dereq_(25);
  1274. var _time = _dereq_(30);
  1275. var _dom = _dereq_(26);
  1276. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1277. Object.assign(_player.config, {
  1278. enableProgressTooltip: true,
  1279. useSmoothHover: true,
  1280. forceLive: false
  1281. });
  1282. Object.assign(_player2.default.prototype, {
  1283. buildprogress: function buildprogress(player, controls, layers, media) {
  1284. var lastKeyPressTime = 0,
  1285. mouseIsDown = false,
  1286. startedPaused = false;
  1287. var t = this,
  1288. autoRewindInitial = player.options.autoRewind,
  1289. tooltip = player.options.enableProgressTooltip ? '<span class="' + t.options.classPrefix + 'time-float">' + ('<span class="' + t.options.classPrefix + 'time-float-current">00:00</span>') + ('<span class="' + t.options.classPrefix + 'time-float-corner"></span>') + '</span>' : '',
  1290. rail = _document2.default.createElement('div');
  1291. rail.className = t.options.classPrefix + 'time-rail';
  1292. rail.innerHTML = '<span class="' + t.options.classPrefix + 'time-total ' + t.options.classPrefix + 'time-slider">' + ('<span class="' + t.options.classPrefix + 'time-buffering"></span>') + ('<span class="' + t.options.classPrefix + 'time-loaded"></span>') + ('<span class="' + t.options.classPrefix + 'time-current"></span>') + ('<span class="' + t.options.classPrefix + 'time-hovered no-hover"></span>') + ('<span class="' + t.options.classPrefix + 'time-handle"><span class="' + t.options.classPrefix + 'time-handle-content"></span></span>') + ('' + tooltip) + '</span>';
  1293. t.addControlElement(rail, 'progress');
  1294. t.options.keyActions.push({
  1295. keys: [37, 227],
  1296. action: function action(player) {
  1297. if (!isNaN(player.duration) && player.duration > 0) {
  1298. if (player.isVideo) {
  1299. player.showControls();
  1300. player.startControlsTimer();
  1301. }
  1302. player.getElement(player.container).querySelector('.' + _player.config.classPrefix + 'time-total').focus();
  1303. var newTime = Math.max(player.currentTime - player.options.defaultSeekBackwardInterval(player), 0);
  1304. player.setCurrentTime(newTime);
  1305. }
  1306. }
  1307. }, {
  1308. keys: [39, 228],
  1309. action: function action(player) {
  1310. if (!isNaN(player.duration) && player.duration > 0) {
  1311. if (player.isVideo) {
  1312. player.showControls();
  1313. player.startControlsTimer();
  1314. }
  1315. player.getElement(player.container).querySelector('.' + _player.config.classPrefix + 'time-total').focus();
  1316. var newTime = Math.min(player.currentTime + player.options.defaultSeekForwardInterval(player), player.duration);
  1317. player.setCurrentTime(newTime);
  1318. }
  1319. }
  1320. });
  1321. t.rail = controls.querySelector('.' + t.options.classPrefix + 'time-rail');
  1322. t.total = controls.querySelector('.' + t.options.classPrefix + 'time-total');
  1323. t.loaded = controls.querySelector('.' + t.options.classPrefix + 'time-loaded');
  1324. t.current = controls.querySelector('.' + t.options.classPrefix + 'time-current');
  1325. t.handle = controls.querySelector('.' + t.options.classPrefix + 'time-handle');
  1326. t.timefloat = controls.querySelector('.' + t.options.classPrefix + 'time-float');
  1327. t.timefloatcurrent = controls.querySelector('.' + t.options.classPrefix + 'time-float-current');
  1328. t.slider = controls.querySelector('.' + t.options.classPrefix + 'time-slider');
  1329. t.hovered = controls.querySelector('.' + t.options.classPrefix + 'time-hovered');
  1330. t.buffer = controls.querySelector('.' + t.options.classPrefix + 'time-buffering');
  1331. t.newTime = 0;
  1332. t.forcedHandlePause = false;
  1333. t.setTransformStyle = function (element, value) {
  1334. element.style.transform = value;
  1335. element.style.webkitTransform = value;
  1336. element.style.MozTransform = value;
  1337. element.style.msTransform = value;
  1338. element.style.OTransform = value;
  1339. };
  1340. t.buffer.style.display = 'none';
  1341. var handleMouseMove = function handleMouseMove(e) {
  1342. var totalStyles = getComputedStyle(t.total),
  1343. offsetStyles = (0, _dom.offset)(t.total),
  1344. width = t.total.offsetWidth,
  1345. transform = function () {
  1346. if (totalStyles.webkitTransform !== undefined) {
  1347. return 'webkitTransform';
  1348. } else if (totalStyles.mozTransform !== undefined) {
  1349. return 'mozTransform ';
  1350. } else if (totalStyles.oTransform !== undefined) {
  1351. return 'oTransform';
  1352. } else if (totalStyles.msTransform !== undefined) {
  1353. return 'msTransform';
  1354. } else {
  1355. return 'transform';
  1356. }
  1357. }(),
  1358. cssMatrix = function () {
  1359. if ('WebKitCSSMatrix' in window) {
  1360. return 'WebKitCSSMatrix';
  1361. } else if ('MSCSSMatrix' in window) {
  1362. return 'MSCSSMatrix';
  1363. } else if ('CSSMatrix' in window) {
  1364. return 'CSSMatrix';
  1365. }
  1366. }();
  1367. var percentage = 0,
  1368. leftPos = 0,
  1369. pos = 0,
  1370. x = void 0;
  1371. if (e.originalEvent && e.originalEvent.changedTouches) {
  1372. x = e.originalEvent.changedTouches[0].pageX;
  1373. } else if (e.changedTouches) {
  1374. x = e.changedTouches[0].pageX;
  1375. } else {
  1376. x = e.pageX;
  1377. }
  1378. if (t.getDuration()) {
  1379. if (x < offsetStyles.left) {
  1380. x = offsetStyles.left;
  1381. } else if (x > width + offsetStyles.left) {
  1382. x = width + offsetStyles.left;
  1383. }
  1384. pos = x - offsetStyles.left;
  1385. percentage = pos / width;
  1386. t.newTime = percentage <= 0.02 ? 0 : percentage * t.getDuration();
  1387. if (mouseIsDown && t.getCurrentTime() !== null && t.newTime.toFixed(4) !== t.getCurrentTime().toFixed(4)) {
  1388. t.setCurrentRailHandle(t.newTime);
  1389. t.updateCurrent(t.newTime);
  1390. }
  1391. if (!_constants.IS_IOS && !_constants.IS_ANDROID) {
  1392. if (pos < 0) {
  1393. pos = 0;
  1394. }
  1395. if (t.options.useSmoothHover && cssMatrix !== null && typeof window[cssMatrix] !== 'undefined') {
  1396. var matrix = new window[cssMatrix](getComputedStyle(t.handle)[transform]),
  1397. handleLocation = matrix.m41,
  1398. hoverScaleX = pos / parseFloat(getComputedStyle(t.total).width) - handleLocation / parseFloat(getComputedStyle(t.total).width);
  1399. t.hovered.style.left = handleLocation + 'px';
  1400. t.setTransformStyle(t.hovered, 'scaleX(' + hoverScaleX + ')');
  1401. t.hovered.setAttribute('pos', pos);
  1402. if (hoverScaleX >= 0) {
  1403. (0, _dom.removeClass)(t.hovered, 'negative');
  1404. } else {
  1405. (0, _dom.addClass)(t.hovered, 'negative');
  1406. }
  1407. }
  1408. if (t.timefloat) {
  1409. var half = t.timefloat.offsetWidth / 2,
  1410. offsetContainer = mejs.Utils.offset(t.getElement(t.container)),
  1411. tooltipStyles = getComputedStyle(t.timefloat);
  1412. if (x - offsetContainer.left < t.timefloat.offsetWidth) {
  1413. leftPos = half;
  1414. } else if (x - offsetContainer.left >= t.getElement(t.container).offsetWidth - half) {
  1415. leftPos = t.total.offsetWidth - half;
  1416. } else {
  1417. leftPos = pos;
  1418. }
  1419. if ((0, _dom.hasClass)(t.getElement(t.container), t.options.classPrefix + 'long-video')) {
  1420. leftPos += parseFloat(tooltipStyles.marginLeft) / 2 + t.timefloat.offsetWidth / 2;
  1421. }
  1422. t.timefloat.style.left = leftPos + 'px';
  1423. t.timefloatcurrent.innerHTML = (0, _time.secondsToTimeCode)(t.newTime, player.options.alwaysShowHours, player.options.showTimecodeFrameCount, player.options.framesPerSecond, player.options.secondsDecimalLength, player.options.timeFormat);
  1424. t.timefloat.style.display = 'block';
  1425. }
  1426. }
  1427. } else if (!_constants.IS_IOS && !_constants.IS_ANDROID && t.timefloat) {
  1428. leftPos = t.timefloat.offsetWidth + width >= t.getElement(t.container).offsetWidth ? t.timefloat.offsetWidth / 2 : 0;
  1429. t.timefloat.style.left = leftPos + 'px';
  1430. t.timefloat.style.left = leftPos + 'px';
  1431. t.timefloat.style.display = 'block';
  1432. }
  1433. },
  1434. updateSlider = function updateSlider() {
  1435. var seconds = t.getCurrentTime(),
  1436. timeSliderText = _i18n2.default.t('mejs.time-slider'),
  1437. time = (0, _time.secondsToTimeCode)(seconds, player.options.alwaysShowHours, player.options.showTimecodeFrameCount, player.options.framesPerSecond, player.options.secondsDecimalLength, player.options.timeFormat),
  1438. duration = t.getDuration();
  1439. t.slider.setAttribute('role', 'slider');
  1440. t.slider.tabIndex = 0;
  1441. if (media.paused) {
  1442. t.slider.setAttribute('aria-label', timeSliderText);
  1443. t.slider.setAttribute('aria-valuemin', 0);
  1444. t.slider.setAttribute('aria-valuemax', duration);
  1445. t.slider.setAttribute('aria-valuenow', seconds);
  1446. t.slider.setAttribute('aria-valuetext', time);
  1447. } else {
  1448. t.slider.removeAttribute('aria-label');
  1449. t.slider.removeAttribute('aria-valuemin');
  1450. t.slider.removeAttribute('aria-valuemax');
  1451. t.slider.removeAttribute('aria-valuenow');
  1452. t.slider.removeAttribute('aria-valuetext');
  1453. }
  1454. },
  1455. restartPlayer = function restartPlayer() {
  1456. if (new Date() - lastKeyPressTime >= 1000) {
  1457. t.play();
  1458. }
  1459. },
  1460. handleMouseup = function handleMouseup() {
  1461. if (mouseIsDown && t.getCurrentTime() !== null && t.newTime.toFixed(4) !== t.getCurrentTime().toFixed(4)) {
  1462. t.setCurrentTime(t.newTime);
  1463. t.setCurrentRailHandle(t.newTime);
  1464. t.updateCurrent(t.newTime);
  1465. }
  1466. if (t.forcedHandlePause) {
  1467. t.slider.focus();
  1468. t.play();
  1469. }
  1470. t.forcedHandlePause = false;
  1471. };
  1472. t.slider.addEventListener('focus', function () {
  1473. player.options.autoRewind = false;
  1474. });
  1475. t.slider.addEventListener('blur', function () {
  1476. player.options.autoRewind = autoRewindInitial;
  1477. });
  1478. t.slider.addEventListener('keydown', function (e) {
  1479. if (new Date() - lastKeyPressTime >= 1000) {
  1480. startedPaused = t.paused;
  1481. }
  1482. if (t.options.enableKeyboard && t.options.keyActions.length) {
  1483. var keyCode = e.which || e.keyCode || 0,
  1484. duration = t.getDuration(),
  1485. seekForward = player.options.defaultSeekForwardInterval(media),
  1486. seekBackward = player.options.defaultSeekBackwardInterval(media);
  1487. var seekTime = t.getCurrentTime();
  1488. var volume = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'volume-slider');
  1489. if (keyCode === 38 || keyCode === 40) {
  1490. if (volume) {
  1491. volume.style.display = 'block';
  1492. }
  1493. if (t.isVideo) {
  1494. t.showControls();
  1495. t.startControlsTimer();
  1496. }
  1497. var newVolume = keyCode === 38 ? Math.min(t.volume + 0.1, 1) : Math.max(t.volume - 0.1, 0),
  1498. mutePlayer = newVolume <= 0;
  1499. t.setVolume(newVolume);
  1500. t.setMuted(mutePlayer);
  1501. return;
  1502. } else {
  1503. if (volume) {
  1504. volume.style.display = 'none';
  1505. }
  1506. }
  1507. switch (keyCode) {
  1508. case 37:
  1509. if (t.getDuration() !== Infinity) {
  1510. seekTime -= seekBackward;
  1511. }
  1512. break;
  1513. case 39:
  1514. if (t.getDuration() !== Infinity) {
  1515. seekTime += seekForward;
  1516. }
  1517. break;
  1518. case 36:
  1519. seekTime = 0;
  1520. break;
  1521. case 35:
  1522. seekTime = duration;
  1523. break;
  1524. case 13:
  1525. case 32:
  1526. if (_constants.IS_FIREFOX) {
  1527. if (t.paused) {
  1528. t.play();
  1529. } else {
  1530. t.pause();
  1531. }
  1532. }
  1533. return;
  1534. default:
  1535. return;
  1536. }
  1537. seekTime = seekTime < 0 ? 0 : seekTime >= duration ? duration : Math.floor(seekTime);
  1538. lastKeyPressTime = new Date();
  1539. if (!startedPaused) {
  1540. player.pause();
  1541. }
  1542. if (seekTime < t.getDuration() && !startedPaused) {
  1543. setTimeout(restartPlayer, 1100);
  1544. }
  1545. t.setCurrentTime(seekTime);
  1546. player.showControls();
  1547. e.preventDefault();
  1548. e.stopPropagation();
  1549. }
  1550. });
  1551. var events = ['mousedown', 'touchstart'];
  1552. t.slider.addEventListener('dragstart', function () {
  1553. return false;
  1554. });
  1555. for (var i = 0, total = events.length; i < total; i++) {
  1556. t.slider.addEventListener(events[i], function (e) {
  1557. t.forcedHandlePause = false;
  1558. if (t.getDuration() !== Infinity) {
  1559. if (e.which === 1 || e.which === 0) {
  1560. if (!t.paused) {
  1561. t.pause();
  1562. t.forcedHandlePause = true;
  1563. }
  1564. mouseIsDown = true;
  1565. handleMouseMove(e);
  1566. var endEvents = ['mouseup', 'touchend'];
  1567. for (var j = 0, totalEvents = endEvents.length; j < totalEvents; j++) {
  1568. t.getElement(t.container).addEventListener(endEvents[j], function (event) {
  1569. var target = event.target;
  1570. if (target === t.slider || target.closest('.' + t.options.classPrefix + 'time-slider')) {
  1571. handleMouseMove(event);
  1572. }
  1573. });
  1574. }
  1575. t.globalBind('mouseup.dur touchend.dur', function () {
  1576. handleMouseup();
  1577. mouseIsDown = false;
  1578. if (t.timefloat) {
  1579. t.timefloat.style.display = 'none';
  1580. }
  1581. });
  1582. }
  1583. }
  1584. }, _constants.SUPPORT_PASSIVE_EVENT && events[i] === 'touchstart' ? { passive: true } : false);
  1585. }
  1586. t.slider.addEventListener('mouseenter', function (e) {
  1587. if (e.target === t.slider && t.getDuration() !== Infinity) {
  1588. t.getElement(t.container).addEventListener('mousemove', function (event) {
  1589. var target = event.target;
  1590. if (target === t.slider || target.closest('.' + t.options.classPrefix + 'time-slider')) {
  1591. handleMouseMove(event);
  1592. }
  1593. });
  1594. if (t.timefloat && !_constants.IS_IOS && !_constants.IS_ANDROID) {
  1595. t.timefloat.style.display = 'block';
  1596. }
  1597. if (t.hovered && !_constants.IS_IOS && !_constants.IS_ANDROID && t.options.useSmoothHover) {
  1598. (0, _dom.removeClass)(t.hovered, 'no-hover');
  1599. }
  1600. }
  1601. });
  1602. t.slider.addEventListener('mouseleave', function () {
  1603. if (t.getDuration() !== Infinity) {
  1604. if (!mouseIsDown) {
  1605. if (t.timefloat) {
  1606. t.timefloat.style.display = 'none';
  1607. }
  1608. if (t.hovered && t.options.useSmoothHover) {
  1609. (0, _dom.addClass)(t.hovered, 'no-hover');
  1610. }
  1611. }
  1612. }
  1613. });
  1614. t.broadcastCallback = function (e) {
  1615. var broadcast = controls.querySelector('.' + t.options.classPrefix + 'broadcast');
  1616. if (!t.options.forceLive && t.getDuration() !== Infinity) {
  1617. if (broadcast) {
  1618. t.slider.style.display = '';
  1619. broadcast.remove();
  1620. }
  1621. player.setProgressRail(e);
  1622. if (!t.forcedHandlePause) {
  1623. player.setCurrentRail(e);
  1624. }
  1625. updateSlider();
  1626. } else if (!broadcast || t.options.forceLive) {
  1627. var label = _document2.default.createElement('span');
  1628. label.className = t.options.classPrefix + 'broadcast';
  1629. label.innerText = _i18n2.default.t('mejs.live-broadcast');
  1630. t.slider.style.display = 'none';
  1631. t.rail.appendChild(label);
  1632. }
  1633. };
  1634. media.addEventListener('progress', t.broadcastCallback);
  1635. media.addEventListener('timeupdate', t.broadcastCallback);
  1636. media.addEventListener('play', function () {
  1637. t.buffer.style.display = 'none';
  1638. });
  1639. media.addEventListener('playing', function () {
  1640. t.buffer.style.display = 'none';
  1641. });
  1642. media.addEventListener('seeking', function () {
  1643. t.buffer.style.display = '';
  1644. });
  1645. media.addEventListener('seeked', function () {
  1646. t.buffer.style.display = 'none';
  1647. });
  1648. media.addEventListener('pause', function () {
  1649. t.buffer.style.display = 'none';
  1650. });
  1651. media.addEventListener('waiting', function () {
  1652. t.buffer.style.display = '';
  1653. });
  1654. media.addEventListener('loadeddata', function () {
  1655. t.buffer.style.display = '';
  1656. });
  1657. media.addEventListener('canplay', function () {
  1658. t.buffer.style.display = 'none';
  1659. });
  1660. media.addEventListener('error', function () {
  1661. t.buffer.style.display = 'none';
  1662. });
  1663. t.getElement(t.container).addEventListener('controlsresize', function (e) {
  1664. if (t.getDuration() !== Infinity) {
  1665. player.setProgressRail(e);
  1666. if (!t.forcedHandlePause) {
  1667. player.setCurrentRail(e);
  1668. }
  1669. }
  1670. });
  1671. },
  1672. cleanprogress: function cleanprogress(player, controls, layers, media) {
  1673. media.removeEventListener('progress', player.broadcastCallback);
  1674. media.removeEventListener('timeupdate', player.broadcastCallback);
  1675. if (player.rail) {
  1676. player.rail.remove();
  1677. }
  1678. },
  1679. setProgressRail: function setProgressRail(e) {
  1680. var t = this,
  1681. target = e !== undefined ? e.detail.target || e.target : t.media;
  1682. var percent = null;
  1683. if (target && target.buffered && target.buffered.length > 0 && target.buffered.end && t.getDuration()) {
  1684. percent = target.buffered.end(target.buffered.length - 1) / t.getDuration();
  1685. } else if (target && target.bytesTotal !== undefined && target.bytesTotal > 0 && target.bufferedBytes !== undefined) {
  1686. percent = target.bufferedBytes / target.bytesTotal;
  1687. } else if (e && e.lengthComputable && e.total !== 0) {
  1688. percent = e.loaded / e.total;
  1689. }
  1690. if (percent !== null) {
  1691. percent = Math.min(1, Math.max(0, percent));
  1692. if (t.loaded) {
  1693. t.setTransformStyle(t.loaded, 'scaleX(' + percent + ')');
  1694. }
  1695. }
  1696. },
  1697. setCurrentRailHandle: function setCurrentRailHandle(fakeTime) {
  1698. var t = this;
  1699. t.setCurrentRailMain(t, fakeTime);
  1700. },
  1701. setCurrentRail: function setCurrentRail() {
  1702. var t = this;
  1703. t.setCurrentRailMain(t);
  1704. },
  1705. setCurrentRailMain: function setCurrentRailMain(t, fakeTime) {
  1706. if (t.getCurrentTime() !== undefined && t.getDuration()) {
  1707. var nTime = typeof fakeTime === 'undefined' ? t.getCurrentTime() : fakeTime;
  1708. if (t.total && t.handle) {
  1709. var tW = parseFloat(getComputedStyle(t.total).width);
  1710. var newWidth = Math.round(tW * nTime / t.getDuration()),
  1711. handlePos = newWidth - Math.round(t.handle.offsetWidth / 2);
  1712. handlePos = handlePos < 0 ? 0 : handlePos;
  1713. t.setTransformStyle(t.current, 'scaleX(' + newWidth / tW + ')');
  1714. t.setTransformStyle(t.handle, 'translateX(' + handlePos + 'px)');
  1715. if (t.options.useSmoothHover && !(0, _dom.hasClass)(t.hovered, 'no-hover')) {
  1716. var pos = parseInt(t.hovered.getAttribute('pos'), 10);
  1717. pos = isNaN(pos) ? 0 : pos;
  1718. var hoverScaleX = pos / tW - handlePos / tW;
  1719. t.hovered.style.left = handlePos + 'px';
  1720. t.setTransformStyle(t.hovered, 'scaleX(' + hoverScaleX + ')');
  1721. if (hoverScaleX >= 0) {
  1722. (0, _dom.removeClass)(t.hovered, 'negative');
  1723. } else {
  1724. (0, _dom.addClass)(t.hovered, 'negative');
  1725. }
  1726. }
  1727. }
  1728. }
  1729. }
  1730. });
  1731. },{"16":16,"2":2,"25":25,"26":26,"30":30,"5":5}],12:[function(_dereq_,module,exports){
  1732. 'use strict';
  1733. var _document = _dereq_(2);
  1734. var _document2 = _interopRequireDefault(_document);
  1735. var _player = _dereq_(16);
  1736. var _player2 = _interopRequireDefault(_player);
  1737. var _time = _dereq_(30);
  1738. var _dom = _dereq_(26);
  1739. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1740. Object.assign(_player.config, {
  1741. duration: 0,
  1742. timeAndDurationSeparator: '<span> | </span>'
  1743. });
  1744. Object.assign(_player2.default.prototype, {
  1745. buildcurrent: function buildcurrent(player, controls, layers, media) {
  1746. var t = this,
  1747. time = _document2.default.createElement('div');
  1748. time.className = t.options.classPrefix + 'time';
  1749. time.setAttribute('role', 'timer');
  1750. time.setAttribute('aria-live', 'off');
  1751. time.innerHTML = '<span class="' + t.options.classPrefix + 'currenttime">' + (0, _time.secondsToTimeCode)(0, player.options.alwaysShowHours, player.options.showTimecodeFrameCount, player.options.framesPerSecond, player.options.secondsDecimalLength, player.options.timeFormat) + '</span>';
  1752. t.addControlElement(time, 'current');
  1753. player.updateCurrent();
  1754. t.updateTimeCallback = function () {
  1755. if (t.controlsAreVisible) {
  1756. player.updateCurrent();
  1757. }
  1758. };
  1759. media.addEventListener('timeupdate', t.updateTimeCallback);
  1760. },
  1761. cleancurrent: function cleancurrent(player, controls, layers, media) {
  1762. media.removeEventListener('timeupdate', player.updateTimeCallback);
  1763. },
  1764. buildduration: function buildduration(player, controls, layers, media) {
  1765. var t = this,
  1766. currTime = controls.lastChild.querySelector('.' + t.options.classPrefix + 'currenttime');
  1767. if (currTime) {
  1768. controls.querySelector('.' + t.options.classPrefix + 'time').innerHTML += t.options.timeAndDurationSeparator + '<span class="' + t.options.classPrefix + 'duration">' + ((0, _time.secondsToTimeCode)(t.options.duration, t.options.alwaysShowHours, t.options.showTimecodeFrameCount, t.options.framesPerSecond, t.options.secondsDecimalLength, t.options.timeFormat) + '</span>');
  1769. } else {
  1770. if (controls.querySelector('.' + t.options.classPrefix + 'currenttime')) {
  1771. (0, _dom.addClass)(controls.querySelector('.' + t.options.classPrefix + 'currenttime').parentNode, t.options.classPrefix + 'currenttime-container');
  1772. }
  1773. var duration = _document2.default.createElement('div');
  1774. duration.className = t.options.classPrefix + 'time ' + t.options.classPrefix + 'duration-container';
  1775. duration.innerHTML = '<span class="' + t.options.classPrefix + 'duration">' + ((0, _time.secondsToTimeCode)(t.options.duration, t.options.alwaysShowHours, t.options.showTimecodeFrameCount, t.options.framesPerSecond, t.options.secondsDecimalLength, t.options.timeFormat) + '</span>');
  1776. t.addControlElement(duration, 'duration');
  1777. }
  1778. t.updateDurationCallback = function () {
  1779. if (t.controlsAreVisible) {
  1780. player.updateDuration();
  1781. }
  1782. };
  1783. media.addEventListener('timeupdate', t.updateDurationCallback);
  1784. },
  1785. cleanduration: function cleanduration(player, controls, layers, media) {
  1786. media.removeEventListener('timeupdate', player.updateDurationCallback);
  1787. },
  1788. updateCurrent: function updateCurrent() {
  1789. var t = this;
  1790. var currentTime = t.getCurrentTime();
  1791. if (isNaN(currentTime)) {
  1792. currentTime = 0;
  1793. }
  1794. var timecode = (0, _time.secondsToTimeCode)(currentTime, t.options.alwaysShowHours, t.options.showTimecodeFrameCount, t.options.framesPerSecond, t.options.secondsDecimalLength, t.options.timeFormat);
  1795. if (timecode.length > 5) {
  1796. (0, _dom.addClass)(t.getElement(t.container), t.options.classPrefix + 'long-video');
  1797. } else {
  1798. (0, _dom.removeClass)(t.getElement(t.container), t.options.classPrefix + 'long-video');
  1799. }
  1800. if (t.getElement(t.controls).querySelector('.' + t.options.classPrefix + 'currenttime')) {
  1801. t.getElement(t.controls).querySelector('.' + t.options.classPrefix + 'currenttime').innerText = timecode;
  1802. }
  1803. },
  1804. updateDuration: function updateDuration() {
  1805. var t = this;
  1806. var duration = t.getDuration();
  1807. if (t.media !== undefined && (isNaN(duration) || duration === Infinity || duration < 0)) {
  1808. t.media.duration = t.options.duration = duration = 0;
  1809. }
  1810. if (t.options.duration > 0) {
  1811. duration = t.options.duration;
  1812. }
  1813. var timecode = (0, _time.secondsToTimeCode)(duration, t.options.alwaysShowHours, t.options.showTimecodeFrameCount, t.options.framesPerSecond, t.options.secondsDecimalLength, t.options.timeFormat);
  1814. if (timecode.length > 5) {
  1815. (0, _dom.addClass)(t.getElement(t.container), t.options.classPrefix + 'long-video');
  1816. } else {
  1817. (0, _dom.removeClass)(t.getElement(t.container), t.options.classPrefix + 'long-video');
  1818. }
  1819. if (t.getElement(t.controls).querySelector('.' + t.options.classPrefix + 'duration') && duration > 0) {
  1820. t.getElement(t.controls).querySelector('.' + t.options.classPrefix + 'duration').innerHTML = timecode;
  1821. }
  1822. }
  1823. });
  1824. },{"16":16,"2":2,"26":26,"30":30}],13:[function(_dereq_,module,exports){
  1825. 'use strict';
  1826. var _document = _dereq_(2);
  1827. var _document2 = _interopRequireDefault(_document);
  1828. var _mejs = _dereq_(7);
  1829. var _mejs2 = _interopRequireDefault(_mejs);
  1830. var _i18n = _dereq_(5);
  1831. var _i18n2 = _interopRequireDefault(_i18n);
  1832. var _player = _dereq_(16);
  1833. var _player2 = _interopRequireDefault(_player);
  1834. var _time = _dereq_(30);
  1835. var _general = _dereq_(27);
  1836. var _dom = _dereq_(26);
  1837. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1838. Object.assign(_player.config, {
  1839. startLanguage: '',
  1840. tracksText: null,
  1841. chaptersText: null,
  1842. tracksAriaLive: false,
  1843. hideCaptionsButtonWhenEmpty: true,
  1844. toggleCaptionsButtonWhenOnlyOne: false,
  1845. slidesSelector: ''
  1846. });
  1847. Object.assign(_player2.default.prototype, {
  1848. hasChapters: false,
  1849. buildtracks: function buildtracks(player, controls, layers, media) {
  1850. this.findTracks();
  1851. if (!player.tracks.length && (!player.trackFiles || !player.trackFiles.length === 0)) {
  1852. return;
  1853. }
  1854. var t = this,
  1855. attr = t.options.tracksAriaLive ? ' role="log" aria-live="assertive" aria-atomic="false"' : '',
  1856. tracksTitle = (0, _general.isString)(t.options.tracksText) ? t.options.tracksText : _i18n2.default.t('mejs.captions-subtitles'),
  1857. chaptersTitle = (0, _general.isString)(t.options.chaptersText) ? t.options.chaptersText : _i18n2.default.t('mejs.captions-chapters'),
  1858. total = player.trackFiles === null ? player.tracks.length : player.trackFiles.length;
  1859. if (t.domNode.textTracks) {
  1860. for (var i = t.domNode.textTracks.length - 1; i >= 0; i--) {
  1861. t.domNode.textTracks[i].mode = 'hidden';
  1862. }
  1863. }
  1864. t.cleartracks(player);
  1865. player.captions = _document2.default.createElement('div');
  1866. player.captions.className = t.options.classPrefix + 'captions-layer ' + t.options.classPrefix + 'layer';
  1867. player.captions.innerHTML = '<div class="' + t.options.classPrefix + 'captions-position ' + t.options.classPrefix + 'captions-position-hover"' + attr + '>' + ('<span class="' + t.options.classPrefix + 'captions-text"></span>') + '</div>';
  1868. player.captions.style.display = 'none';
  1869. layers.insertBefore(player.captions, layers.firstChild);
  1870. player.captionsText = player.captions.querySelector('.' + t.options.classPrefix + 'captions-text');
  1871. player.captionsButton = _document2.default.createElement('div');
  1872. player.captionsButton.className = t.options.classPrefix + 'button ' + t.options.classPrefix + 'captions-button';
  1873. player.captionsButton.innerHTML = '<button type="button" aria-controls="' + t.id + '" title="' + tracksTitle + '" aria-label="' + tracksTitle + '" tabindex="0"></button>' + ('<div class="' + t.options.classPrefix + 'captions-selector ' + t.options.classPrefix + 'offscreen">') + ('<ul class="' + t.options.classPrefix + 'captions-selector-list">') + ('<li class="' + t.options.classPrefix + 'captions-selector-list-item">') + ('<input type="radio" class="' + t.options.classPrefix + 'captions-selector-input" ') + ('name="' + player.id + '_captions" id="' + player.id + '_captions_none" ') + 'value="none" checked disabled>' + ('<label class="' + t.options.classPrefix + 'captions-selector-label ') + (t.options.classPrefix + 'captions-selected" ') + ('for="' + player.id + '_captions_none">' + _i18n2.default.t('mejs.none') + '</label>') + '</li>' + '</ul>' + '</div>';
  1874. t.addControlElement(player.captionsButton, 'tracks');
  1875. player.captionsButton.querySelector('.' + t.options.classPrefix + 'captions-selector-input').disabled = false;
  1876. player.chaptersButton = _document2.default.createElement('div');
  1877. player.chaptersButton.className = t.options.classPrefix + 'button ' + t.options.classPrefix + 'chapters-button';
  1878. player.chaptersButton.innerHTML = '<button type="button" aria-controls="' + t.id + '" title="' + chaptersTitle + '" aria-label="' + chaptersTitle + '" tabindex="0"></button>' + ('<div class="' + t.options.classPrefix + 'chapters-selector ' + t.options.classPrefix + 'offscreen">') + ('<ul class="' + t.options.classPrefix + 'chapters-selector-list"></ul>') + '</div>';
  1879. var subtitleCount = 0;
  1880. for (var _i = 0; _i < total; _i++) {
  1881. var kind = player.tracks[_i].kind,
  1882. src = player.tracks[_i].src;
  1883. if (src.trim()) {
  1884. if (kind === 'subtitles' || kind === 'captions') {
  1885. subtitleCount++;
  1886. } else if (kind === 'chapters' && !controls.querySelector('.' + t.options.classPrefix + 'chapter-selector')) {
  1887. player.captionsButton.parentNode.insertBefore(player.chaptersButton, player.captionsButton);
  1888. }
  1889. }
  1890. }
  1891. player.trackToLoad = -1;
  1892. player.selectedTrack = null;
  1893. player.isLoadingTrack = false;
  1894. for (var _i2 = 0; _i2 < total; _i2++) {
  1895. var _kind = player.tracks[_i2].kind;
  1896. if (player.tracks[_i2].src.trim() && (_kind === 'subtitles' || _kind === 'captions')) {
  1897. player.addTrackButton(player.tracks[_i2].trackId, player.tracks[_i2].srclang, player.tracks[_i2].label);
  1898. }
  1899. }
  1900. player.loadNextTrack();
  1901. var inEvents = ['mouseenter', 'focusin'],
  1902. outEvents = ['mouseleave', 'focusout'];
  1903. if (t.options.toggleCaptionsButtonWhenOnlyOne && subtitleCount === 1) {
  1904. player.captionsButton.addEventListener('click', function (e) {
  1905. var trackId = 'none';
  1906. if (player.selectedTrack === null) {
  1907. trackId = player.tracks[0].trackId;
  1908. }
  1909. var keyboard = e.keyCode || e.which;
  1910. player.setTrack(trackId, typeof keyboard !== 'undefined');
  1911. });
  1912. } else {
  1913. var labels = player.captionsButton.querySelectorAll('.' + t.options.classPrefix + 'captions-selector-label'),
  1914. captions = player.captionsButton.querySelectorAll('input[type=radio]');
  1915. for (var _i3 = 0, _total = inEvents.length; _i3 < _total; _i3++) {
  1916. player.captionsButton.addEventListener(inEvents[_i3], function () {
  1917. (0, _dom.removeClass)(this.querySelector('.' + t.options.classPrefix + 'captions-selector'), t.options.classPrefix + 'offscreen');
  1918. });
  1919. }
  1920. for (var _i4 = 0, _total2 = outEvents.length; _i4 < _total2; _i4++) {
  1921. player.captionsButton.addEventListener(outEvents[_i4], function () {
  1922. (0, _dom.addClass)(this.querySelector('.' + t.options.classPrefix + 'captions-selector'), t.options.classPrefix + 'offscreen');
  1923. });
  1924. }
  1925. for (var _i5 = 0, _total3 = captions.length; _i5 < _total3; _i5++) {
  1926. captions[_i5].addEventListener('click', function (e) {
  1927. var keyboard = e.keyCode || e.which;
  1928. player.setTrack(this.value, typeof keyboard !== 'undefined');
  1929. });
  1930. }
  1931. for (var _i6 = 0, _total4 = labels.length; _i6 < _total4; _i6++) {
  1932. labels[_i6].addEventListener('click', function (e) {
  1933. var radio = (0, _dom.siblings)(this, function (el) {
  1934. return el.tagName === 'INPUT';
  1935. })[0],
  1936. event = (0, _general.createEvent)('click', radio);
  1937. radio.dispatchEvent(event);
  1938. e.preventDefault();
  1939. });
  1940. }
  1941. player.captionsButton.addEventListener('keydown', function (e) {
  1942. e.stopPropagation();
  1943. });
  1944. }
  1945. for (var _i7 = 0, _total5 = inEvents.length; _i7 < _total5; _i7++) {
  1946. player.chaptersButton.addEventListener(inEvents[_i7], function () {
  1947. if (this.querySelector('.' + t.options.classPrefix + 'chapters-selector-list').children.length) {
  1948. (0, _dom.removeClass)(this.querySelector('.' + t.options.classPrefix + 'chapters-selector'), t.options.classPrefix + 'offscreen');
  1949. }
  1950. });
  1951. }
  1952. for (var _i8 = 0, _total6 = outEvents.length; _i8 < _total6; _i8++) {
  1953. player.chaptersButton.addEventListener(outEvents[_i8], function () {
  1954. (0, _dom.addClass)(this.querySelector('.' + t.options.classPrefix + 'chapters-selector'), t.options.classPrefix + 'offscreen');
  1955. });
  1956. }
  1957. player.chaptersButton.addEventListener('keydown', function (e) {
  1958. e.stopPropagation();
  1959. });
  1960. if (!player.options.alwaysShowControls) {
  1961. player.getElement(player.container).addEventListener('controlsshown', function () {
  1962. (0, _dom.addClass)(player.getElement(player.container).querySelector('.' + t.options.classPrefix + 'captions-position'), t.options.classPrefix + 'captions-position-hover');
  1963. });
  1964. player.getElement(player.container).addEventListener('controlshidden', function () {
  1965. if (!media.paused) {
  1966. (0, _dom.removeClass)(player.getElement(player.container).querySelector('.' + t.options.classPrefix + 'captions-position'), t.options.classPrefix + 'captions-position-hover');
  1967. }
  1968. });
  1969. } else {
  1970. (0, _dom.addClass)(player.getElement(player.container).querySelector('.' + t.options.classPrefix + 'captions-position'), t.options.classPrefix + 'captions-position-hover');
  1971. }
  1972. media.addEventListener('timeupdate', function () {
  1973. player.displayCaptions();
  1974. });
  1975. if (player.options.slidesSelector !== '') {
  1976. player.slidesContainer = _document2.default.querySelectorAll(player.options.slidesSelector);
  1977. media.addEventListener('timeupdate', function () {
  1978. player.displaySlides();
  1979. });
  1980. }
  1981. },
  1982. cleartracks: function cleartracks(player) {
  1983. if (player) {
  1984. if (player.captions) {
  1985. player.captions.remove();
  1986. }
  1987. if (player.chapters) {
  1988. player.chapters.remove();
  1989. }
  1990. if (player.captionsText) {
  1991. player.captionsText.remove();
  1992. }
  1993. if (player.captionsButton) {
  1994. player.captionsButton.remove();
  1995. }
  1996. if (player.chaptersButton) {
  1997. player.chaptersButton.remove();
  1998. }
  1999. }
  2000. },
  2001. rebuildtracks: function rebuildtracks() {
  2002. var t = this;
  2003. t.findTracks();
  2004. t.buildtracks(t, t.getElement(t.controls), t.getElement(t.layers), t.media);
  2005. },
  2006. findTracks: function findTracks() {
  2007. var t = this,
  2008. tracktags = t.trackFiles === null ? t.node.querySelectorAll('track') : t.trackFiles,
  2009. total = tracktags.length;
  2010. t.tracks = [];
  2011. for (var i = 0; i < total; i++) {
  2012. var track = tracktags[i],
  2013. srclang = track.getAttribute('srclang').toLowerCase() || '',
  2014. trackId = t.id + '_track_' + i + '_' + track.getAttribute('kind') + '_' + srclang;
  2015. t.tracks.push({
  2016. trackId: trackId,
  2017. srclang: srclang,
  2018. src: track.getAttribute('src'),
  2019. kind: track.getAttribute('kind'),
  2020. label: track.getAttribute('label') || '',
  2021. entries: [],
  2022. isLoaded: false
  2023. });
  2024. }
  2025. },
  2026. setTrack: function setTrack(trackId, setByKeyboard) {
  2027. var t = this,
  2028. radios = t.captionsButton.querySelectorAll('input[type="radio"]'),
  2029. captions = t.captionsButton.querySelectorAll('.' + t.options.classPrefix + 'captions-selected'),
  2030. track = t.captionsButton.querySelector('input[value="' + trackId + '"]');
  2031. for (var i = 0, total = radios.length; i < total; i++) {
  2032. radios[i].checked = false;
  2033. }
  2034. for (var _i9 = 0, _total7 = captions.length; _i9 < _total7; _i9++) {
  2035. (0, _dom.removeClass)(captions[_i9], t.options.classPrefix + 'captions-selected');
  2036. }
  2037. track.checked = true;
  2038. var labels = (0, _dom.siblings)(track, function (el) {
  2039. return (0, _dom.hasClass)(el, t.options.classPrefix + 'captions-selector-label');
  2040. });
  2041. for (var _i10 = 0, _total8 = labels.length; _i10 < _total8; _i10++) {
  2042. (0, _dom.addClass)(labels[_i10], t.options.classPrefix + 'captions-selected');
  2043. }
  2044. if (trackId === 'none') {
  2045. t.selectedTrack = null;
  2046. (0, _dom.removeClass)(t.captionsButton, t.options.classPrefix + 'captions-enabled');
  2047. } else {
  2048. for (var _i11 = 0, _total9 = t.tracks.length; _i11 < _total9; _i11++) {
  2049. var _track = t.tracks[_i11];
  2050. if (_track.trackId === trackId) {
  2051. if (t.selectedTrack === null) {
  2052. (0, _dom.addClass)(t.captionsButton, t.options.classPrefix + 'captions-enabled');
  2053. }
  2054. t.selectedTrack = _track;
  2055. t.captions.setAttribute('lang', t.selectedTrack.srclang);
  2056. t.displayCaptions();
  2057. break;
  2058. }
  2059. }
  2060. }
  2061. var event = (0, _general.createEvent)('captionschange', t.media);
  2062. event.detail.caption = t.selectedTrack;
  2063. t.media.dispatchEvent(event);
  2064. if (!setByKeyboard) {
  2065. setTimeout(function () {
  2066. t.getElement(t.container).focus();
  2067. }, 500);
  2068. }
  2069. },
  2070. loadNextTrack: function loadNextTrack() {
  2071. var t = this;
  2072. t.trackToLoad++;
  2073. if (t.trackToLoad < t.tracks.length) {
  2074. t.isLoadingTrack = true;
  2075. t.loadTrack(t.trackToLoad);
  2076. } else {
  2077. t.isLoadingTrack = false;
  2078. t.checkForTracks();
  2079. }
  2080. },
  2081. loadTrack: function loadTrack(index) {
  2082. var t = this,
  2083. track = t.tracks[index];
  2084. if (track !== undefined && (track.src !== undefined || track.src !== "")) {
  2085. (0, _dom.ajax)(track.src, 'text', function (d) {
  2086. track.entries = typeof d === 'string' && /<tt\s+xml/ig.exec(d) ? _mejs2.default.TrackFormatParser.dfxp.parse(d) : _mejs2.default.TrackFormatParser.webvtt.parse(d);
  2087. track.isLoaded = true;
  2088. t.enableTrackButton(track);
  2089. t.loadNextTrack();
  2090. if (track.kind === 'slides') {
  2091. t.setupSlides(track);
  2092. } else if (track.kind === 'chapters' && !t.hasChapters) {
  2093. t.drawChapters(track);
  2094. t.hasChapters = true;
  2095. }
  2096. }, function () {
  2097. t.removeTrackButton(track.trackId);
  2098. t.loadNextTrack();
  2099. });
  2100. }
  2101. },
  2102. enableTrackButton: function enableTrackButton(track) {
  2103. var t = this,
  2104. lang = track.srclang,
  2105. target = _document2.default.getElementById('' + track.trackId);
  2106. if (!target) {
  2107. return;
  2108. }
  2109. var label = track.label;
  2110. if (label === '') {
  2111. label = _i18n2.default.t(_mejs2.default.language.codes[lang]) || lang;
  2112. }
  2113. target.disabled = false;
  2114. var targetSiblings = (0, _dom.siblings)(target, function (el) {
  2115. return (0, _dom.hasClass)(el, t.options.classPrefix + 'captions-selector-label');
  2116. });
  2117. for (var i = 0, total = targetSiblings.length; i < total; i++) {
  2118. targetSiblings[i].innerHTML = label;
  2119. }
  2120. if (t.options.startLanguage === lang) {
  2121. target.checked = true;
  2122. var event = (0, _general.createEvent)('click', target);
  2123. target.dispatchEvent(event);
  2124. }
  2125. },
  2126. removeTrackButton: function removeTrackButton(trackId) {
  2127. var element = _document2.default.getElementById('' + trackId);
  2128. if (element) {
  2129. var button = element.closest('li');
  2130. if (button) {
  2131. button.remove();
  2132. }
  2133. }
  2134. },
  2135. addTrackButton: function addTrackButton(trackId, lang, label) {
  2136. var t = this;
  2137. if (label === '') {
  2138. label = _i18n2.default.t(_mejs2.default.language.codes[lang]) || lang;
  2139. }
  2140. t.captionsButton.querySelector('ul').innerHTML += '<li class="' + t.options.classPrefix + 'captions-selector-list-item">' + ('<input type="radio" class="' + t.options.classPrefix + 'captions-selector-input" ') + ('name="' + t.id + '_captions" id="' + trackId + '" value="' + trackId + '" disabled>') + ('<label class="' + t.options.classPrefix + 'captions-selector-label"') + ('for="' + trackId + '">' + label + ' (loading)</label>') + '</li>';
  2141. },
  2142. checkForTracks: function checkForTracks() {
  2143. var t = this;
  2144. var hasSubtitles = false;
  2145. if (t.options.hideCaptionsButtonWhenEmpty) {
  2146. for (var i = 0, total = t.tracks.length; i < total; i++) {
  2147. var kind = t.tracks[i].kind;
  2148. if ((kind === 'subtitles' || kind === 'captions') && t.tracks[i].isLoaded) {
  2149. hasSubtitles = true;
  2150. break;
  2151. }
  2152. }
  2153. t.captionsButton.style.display = hasSubtitles ? '' : 'none';
  2154. t.setControlsSize();
  2155. }
  2156. },
  2157. displayCaptions: function displayCaptions() {
  2158. if (this.tracks === undefined) {
  2159. return;
  2160. }
  2161. var t = this,
  2162. track = t.selectedTrack,
  2163. sanitize = function sanitize(html) {
  2164. var div = _document2.default.createElement('div');
  2165. div.innerHTML = html;
  2166. var scripts = div.getElementsByTagName('script');
  2167. var i = scripts.length;
  2168. while (i--) {
  2169. scripts[i].remove();
  2170. }
  2171. var allElements = div.getElementsByTagName('*');
  2172. for (var _i12 = 0, n = allElements.length; _i12 < n; _i12++) {
  2173. var attributesObj = allElements[_i12].attributes,
  2174. attributes = Array.prototype.slice.call(attributesObj);
  2175. for (var j = 0, total = attributes.length; j < total; j++) {
  2176. if (attributes[j].name.startsWith('on') || attributes[j].value.startsWith('javascript')) {
  2177. allElements[_i12].remove();
  2178. } else if (attributes[j].name === 'style') {
  2179. allElements[_i12].removeAttribute(attributes[j].name);
  2180. }
  2181. }
  2182. }
  2183. return div.innerHTML;
  2184. };
  2185. if (track !== null && track.isLoaded) {
  2186. var i = t.searchTrackPosition(track.entries, t.media.currentTime);
  2187. if (i > -1) {
  2188. t.captionsText.innerHTML = sanitize(track.entries[i].text);
  2189. t.captionsText.className = t.options.classPrefix + 'captions-text ' + (track.entries[i].identifier || '');
  2190. t.captions.style.display = '';
  2191. t.captions.style.height = '0px';
  2192. return;
  2193. }
  2194. t.captions.style.display = 'none';
  2195. } else {
  2196. t.captions.style.display = 'none';
  2197. }
  2198. },
  2199. setupSlides: function setupSlides(track) {
  2200. var t = this;
  2201. t.slides = track;
  2202. t.slides.entries.imgs = [t.slides.entries.length];
  2203. t.showSlide(0);
  2204. },
  2205. showSlide: function showSlide(index) {
  2206. var _this = this;
  2207. var t = this;
  2208. if (t.tracks === undefined || t.slidesContainer === undefined) {
  2209. return;
  2210. }
  2211. var url = t.slides.entries[index].text;
  2212. var img = t.slides.entries[index].imgs;
  2213. if (img === undefined || img.fadeIn === undefined) {
  2214. var image = _document2.default.createElement('img');
  2215. image.src = url;
  2216. image.addEventListener('load', function () {
  2217. var self = _this,
  2218. visible = (0, _dom.siblings)(self, function (el) {
  2219. return visible(el);
  2220. });
  2221. self.style.display = 'none';
  2222. t.slidesContainer.innerHTML += self.innerHTML;
  2223. (0, _dom.fadeIn)(t.slidesContainer.querySelector(image));
  2224. for (var i = 0, total = visible.length; i < total; i++) {
  2225. (0, _dom.fadeOut)(visible[i], 400);
  2226. }
  2227. });
  2228. t.slides.entries[index].imgs = img = image;
  2229. } else if (!(0, _dom.visible)(img)) {
  2230. var _visible = (0, _dom.siblings)(self, function (el) {
  2231. return _visible(el);
  2232. });
  2233. (0, _dom.fadeIn)(t.slidesContainer.querySelector(img));
  2234. for (var i = 0, total = _visible.length; i < total; i++) {
  2235. (0, _dom.fadeOut)(_visible[i]);
  2236. }
  2237. }
  2238. },
  2239. displaySlides: function displaySlides() {
  2240. var t = this;
  2241. if (this.slides === undefined) {
  2242. return;
  2243. }
  2244. var slides = t.slides,
  2245. i = t.searchTrackPosition(slides.entries, t.media.currentTime);
  2246. if (i > -1) {
  2247. t.showSlide(i);
  2248. }
  2249. },
  2250. drawChapters: function drawChapters(chapters) {
  2251. var t = this,
  2252. total = chapters.entries.length;
  2253. if (!total) {
  2254. return;
  2255. }
  2256. t.chaptersButton.querySelector('ul').innerHTML = '';
  2257. for (var i = 0; i < total; i++) {
  2258. t.chaptersButton.querySelector('ul').innerHTML += '<li class="' + t.options.classPrefix + 'chapters-selector-list-item" ' + 'role="menuitemcheckbox" aria-live="polite" aria-disabled="false" aria-checked="false">' + ('<input type="radio" class="' + t.options.classPrefix + 'captions-selector-input" ') + ('name="' + t.id + '_chapters" id="' + t.id + '_chapters_' + i + '" value="' + chapters.entries[i].start + '" disabled>') + ('<label class="' + t.options.classPrefix + 'chapters-selector-label"') + ('for="' + t.id + '_chapters_' + i + '">' + chapters.entries[i].text + '</label>') + '</li>';
  2259. }
  2260. var radios = t.chaptersButton.querySelectorAll('input[type="radio"]'),
  2261. labels = t.chaptersButton.querySelectorAll('.' + t.options.classPrefix + 'chapters-selector-label');
  2262. for (var _i13 = 0, _total10 = radios.length; _i13 < _total10; _i13++) {
  2263. radios[_i13].disabled = false;
  2264. radios[_i13].checked = false;
  2265. radios[_i13].addEventListener('click', function (e) {
  2266. var self = this,
  2267. listItems = t.chaptersButton.querySelectorAll('li'),
  2268. label = (0, _dom.siblings)(self, function (el) {
  2269. return (0, _dom.hasClass)(el, t.options.classPrefix + 'chapters-selector-label');
  2270. })[0];
  2271. self.checked = true;
  2272. self.parentNode.setAttribute('aria-checked', true);
  2273. (0, _dom.addClass)(label, t.options.classPrefix + 'chapters-selected');
  2274. (0, _dom.removeClass)(t.chaptersButton.querySelector('.' + t.options.classPrefix + 'chapters-selected'), t.options.classPrefix + 'chapters-selected');
  2275. for (var _i14 = 0, _total11 = listItems.length; _i14 < _total11; _i14++) {
  2276. listItems[_i14].setAttribute('aria-checked', false);
  2277. }
  2278. var keyboard = e.keyCode || e.which;
  2279. if (typeof keyboard === 'undefined') {
  2280. setTimeout(function () {
  2281. t.getElement(t.container).focus();
  2282. }, 500);
  2283. }
  2284. t.media.setCurrentTime(parseFloat(self.value));
  2285. if (t.media.paused) {
  2286. t.media.play();
  2287. }
  2288. });
  2289. }
  2290. for (var _i15 = 0, _total12 = labels.length; _i15 < _total12; _i15++) {
  2291. labels[_i15].addEventListener('click', function (e) {
  2292. var radio = (0, _dom.siblings)(this, function (el) {
  2293. return el.tagName === 'INPUT';
  2294. })[0],
  2295. event = (0, _general.createEvent)('click', radio);
  2296. radio.dispatchEvent(event);
  2297. e.preventDefault();
  2298. });
  2299. }
  2300. },
  2301. searchTrackPosition: function searchTrackPosition(tracks, currentTime) {
  2302. var lo = 0,
  2303. hi = tracks.length - 1,
  2304. mid = void 0,
  2305. start = void 0,
  2306. stop = void 0;
  2307. while (lo <= hi) {
  2308. mid = lo + hi >> 1;
  2309. start = tracks[mid].start;
  2310. stop = tracks[mid].stop;
  2311. if (currentTime >= start && currentTime < stop) {
  2312. return mid;
  2313. } else if (start < currentTime) {
  2314. lo = mid + 1;
  2315. } else if (start > currentTime) {
  2316. hi = mid - 1;
  2317. }
  2318. }
  2319. return -1;
  2320. }
  2321. });
  2322. _mejs2.default.language = {
  2323. codes: {
  2324. af: 'mejs.afrikaans',
  2325. sq: 'mejs.albanian',
  2326. ar: 'mejs.arabic',
  2327. be: 'mejs.belarusian',
  2328. bg: 'mejs.bulgarian',
  2329. ca: 'mejs.catalan',
  2330. zh: 'mejs.chinese',
  2331. 'zh-cn': 'mejs.chinese-simplified',
  2332. 'zh-tw': 'mejs.chines-traditional',
  2333. hr: 'mejs.croatian',
  2334. cs: 'mejs.czech',
  2335. da: 'mejs.danish',
  2336. nl: 'mejs.dutch',
  2337. en: 'mejs.english',
  2338. et: 'mejs.estonian',
  2339. fl: 'mejs.filipino',
  2340. fi: 'mejs.finnish',
  2341. fr: 'mejs.french',
  2342. gl: 'mejs.galician',
  2343. de: 'mejs.german',
  2344. el: 'mejs.greek',
  2345. ht: 'mejs.haitian-creole',
  2346. iw: 'mejs.hebrew',
  2347. hi: 'mejs.hindi',
  2348. hu: 'mejs.hungarian',
  2349. is: 'mejs.icelandic',
  2350. id: 'mejs.indonesian',
  2351. ga: 'mejs.irish',
  2352. it: 'mejs.italian',
  2353. ja: 'mejs.japanese',
  2354. ko: 'mejs.korean',
  2355. lv: 'mejs.latvian',
  2356. lt: 'mejs.lithuanian',
  2357. mk: 'mejs.macedonian',
  2358. ms: 'mejs.malay',
  2359. mt: 'mejs.maltese',
  2360. no: 'mejs.norwegian',
  2361. fa: 'mejs.persian',
  2362. pl: 'mejs.polish',
  2363. pt: 'mejs.portuguese',
  2364. ro: 'mejs.romanian',
  2365. ru: 'mejs.russian',
  2366. sr: 'mejs.serbian',
  2367. sk: 'mejs.slovak',
  2368. sl: 'mejs.slovenian',
  2369. es: 'mejs.spanish',
  2370. sw: 'mejs.swahili',
  2371. sv: 'mejs.swedish',
  2372. tl: 'mejs.tagalog',
  2373. th: 'mejs.thai',
  2374. tr: 'mejs.turkish',
  2375. uk: 'mejs.ukrainian',
  2376. vi: 'mejs.vietnamese',
  2377. cy: 'mejs.welsh',
  2378. yi: 'mejs.yiddish'
  2379. }
  2380. };
  2381. _mejs2.default.TrackFormatParser = {
  2382. webvtt: {
  2383. pattern: /^((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{1,3})?) --\> ((?:[0-9]{1,2}:)?[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/,
  2384. parse: function parse(trackText) {
  2385. var lines = trackText.split(/\r?\n/),
  2386. entries = [];
  2387. var timecode = void 0,
  2388. text = void 0,
  2389. identifier = void 0;
  2390. for (var i = 0, total = lines.length; i < total; i++) {
  2391. timecode = this.pattern.exec(lines[i]);
  2392. if (timecode && i < lines.length) {
  2393. if (i - 1 >= 0 && lines[i - 1] !== '') {
  2394. identifier = lines[i - 1];
  2395. }
  2396. i++;
  2397. text = lines[i];
  2398. i++;
  2399. while (lines[i] !== '' && i < lines.length) {
  2400. text = text + '\n' + lines[i];
  2401. i++;
  2402. }
  2403. text = text.trim().replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, "<a href='$1' target='_blank'>$1</a>");
  2404. entries.push({
  2405. identifier: identifier,
  2406. start: (0, _time.convertSMPTEtoSeconds)(timecode[1]) === 0 ? 0.200 : (0, _time.convertSMPTEtoSeconds)(timecode[1]),
  2407. stop: (0, _time.convertSMPTEtoSeconds)(timecode[3]),
  2408. text: text,
  2409. settings: timecode[5]
  2410. });
  2411. }
  2412. identifier = '';
  2413. }
  2414. return entries;
  2415. }
  2416. },
  2417. dfxp: {
  2418. parse: function parse(trackText) {
  2419. trackText = $(trackText).filter('tt');
  2420. var container = trackText.firstChild,
  2421. lines = container.querySelectorAll('p'),
  2422. styleNode = trackText.getElementById('' + container.attr('style')),
  2423. entries = [];
  2424. var styles = void 0;
  2425. if (styleNode.length) {
  2426. styleNode.removeAttribute('id');
  2427. var attributes = styleNode.attributes;
  2428. if (attributes.length) {
  2429. styles = {};
  2430. for (var i = 0, total = attributes.length; i < total; i++) {
  2431. styles[attributes[i].name.split(":")[1]] = attributes[i].value;
  2432. }
  2433. }
  2434. }
  2435. for (var _i16 = 0, _total13 = lines.length; _i16 < _total13; _i16++) {
  2436. var style = void 0,
  2437. _temp = {
  2438. start: null,
  2439. stop: null,
  2440. style: null,
  2441. text: null
  2442. };
  2443. if (lines.eq(_i16).attr('begin')) {
  2444. _temp.start = (0, _time.convertSMPTEtoSeconds)(lines.eq(_i16).attr('begin'));
  2445. }
  2446. if (!_temp.start && lines.eq(_i16 - 1).attr('end')) {
  2447. _temp.start = (0, _time.convertSMPTEtoSeconds)(lines.eq(_i16 - 1).attr('end'));
  2448. }
  2449. if (lines.eq(_i16).attr('end')) {
  2450. _temp.stop = (0, _time.convertSMPTEtoSeconds)(lines.eq(_i16).attr('end'));
  2451. }
  2452. if (!_temp.stop && lines.eq(_i16 + 1).attr('begin')) {
  2453. _temp.stop = (0, _time.convertSMPTEtoSeconds)(lines.eq(_i16 + 1).attr('begin'));
  2454. }
  2455. if (styles) {
  2456. style = '';
  2457. for (var _style in styles) {
  2458. style += _style + ':' + styles[_style] + ';';
  2459. }
  2460. }
  2461. if (style) {
  2462. _temp.style = style;
  2463. }
  2464. if (_temp.start === 0) {
  2465. _temp.start = 0.200;
  2466. }
  2467. _temp.text = lines.eq(_i16).innerHTML.trim().replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, "<a href='$1' target='_blank'>$1</a>");
  2468. entries.push(_temp);
  2469. }
  2470. return entries;
  2471. }
  2472. }
  2473. };
  2474. },{"16":16,"2":2,"26":26,"27":27,"30":30,"5":5,"7":7}],14:[function(_dereq_,module,exports){
  2475. 'use strict';
  2476. var _document = _dereq_(2);
  2477. var _document2 = _interopRequireDefault(_document);
  2478. var _player = _dereq_(16);
  2479. var _player2 = _interopRequireDefault(_player);
  2480. var _i18n = _dereq_(5);
  2481. var _i18n2 = _interopRequireDefault(_i18n);
  2482. var _constants = _dereq_(25);
  2483. var _general = _dereq_(27);
  2484. var _dom = _dereq_(26);
  2485. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2486. Object.assign(_player.config, {
  2487. muteText: null,
  2488. unmuteText: null,
  2489. allyVolumeControlText: null,
  2490. hideVolumeOnTouchDevices: true,
  2491. audioVolume: 'horizontal',
  2492. videoVolume: 'vertical',
  2493. startVolume: 0.8
  2494. });
  2495. Object.assign(_player2.default.prototype, {
  2496. buildvolume: function buildvolume(player, controls, layers, media) {
  2497. if ((_constants.IS_ANDROID || _constants.IS_IOS) && this.options.hideVolumeOnTouchDevices) {
  2498. return;
  2499. }
  2500. var t = this,
  2501. mode = t.isVideo ? t.options.videoVolume : t.options.audioVolume,
  2502. muteText = (0, _general.isString)(t.options.muteText) ? t.options.muteText : _i18n2.default.t('mejs.mute'),
  2503. unmuteText = (0, _general.isString)(t.options.unmuteText) ? t.options.unmuteText : _i18n2.default.t('mejs.unmute'),
  2504. volumeControlText = (0, _general.isString)(t.options.allyVolumeControlText) ? t.options.allyVolumeControlText : _i18n2.default.t('mejs.volume-help-text'),
  2505. mute = _document2.default.createElement('div');
  2506. mute.className = t.options.classPrefix + 'button ' + t.options.classPrefix + 'volume-button ' + t.options.classPrefix + 'mute';
  2507. mute.innerHTML = mode === 'horizontal' ? '<button type="button" aria-controls="' + t.id + '" title="' + muteText + '" aria-label="' + muteText + '" tabindex="0"></button>' : '<button type="button" aria-controls="' + t.id + '" title="' + muteText + '" aria-label="' + muteText + '" tabindex="0"></button>' + ('<a href="javascript:void(0);" class="' + t.options.classPrefix + 'volume-slider" ') + ('aria-label="' + _i18n2.default.t('mejs.volume-slider') + '" aria-valuemin="0" aria-valuemax="100" role="slider" ') + 'aria-orientation="vertical">' + ('<span class="' + t.options.classPrefix + 'offscreen">' + volumeControlText + '</span>') + ('<div class="' + t.options.classPrefix + 'volume-total">') + ('<div class="' + t.options.classPrefix + 'volume-current"></div>') + ('<div class="' + t.options.classPrefix + 'volume-handle"></div>') + '</div>' + '</a>';
  2508. t.addControlElement(mute, 'volume');
  2509. t.options.keyActions.push({
  2510. keys: [38],
  2511. action: function action(player) {
  2512. var volumeSlider = player.getElement(player.container).querySelector('.' + _player.config.classPrefix + 'volume-slider');
  2513. if (volumeSlider || player.getElement(player.container).querySelector('.' + _player.config.classPrefix + 'volume-slider').matches(':focus')) {
  2514. volumeSlider.style.display = 'block';
  2515. }
  2516. if (player.isVideo) {
  2517. player.showControls();
  2518. player.startControlsTimer();
  2519. }
  2520. var newVolume = Math.min(player.volume + 0.1, 1);
  2521. player.setVolume(newVolume);
  2522. if (newVolume > 0) {
  2523. player.setMuted(false);
  2524. }
  2525. }
  2526. }, {
  2527. keys: [40],
  2528. action: function action(player) {
  2529. var volumeSlider = player.getElement(player.container).querySelector('.' + _player.config.classPrefix + 'volume-slider');
  2530. if (volumeSlider) {
  2531. volumeSlider.style.display = 'block';
  2532. }
  2533. if (player.isVideo) {
  2534. player.showControls();
  2535. player.startControlsTimer();
  2536. }
  2537. var newVolume = Math.max(player.volume - 0.1, 0);
  2538. player.setVolume(newVolume);
  2539. if (newVolume <= 0.1) {
  2540. player.setMuted(true);
  2541. }
  2542. }
  2543. }, {
  2544. keys: [77],
  2545. action: function action(player) {
  2546. player.getElement(player.container).querySelector('.' + _player.config.classPrefix + 'volume-slider').style.display = 'block';
  2547. if (player.isVideo) {
  2548. player.showControls();
  2549. player.startControlsTimer();
  2550. }
  2551. if (player.media.muted) {
  2552. player.setMuted(false);
  2553. } else {
  2554. player.setMuted(true);
  2555. }
  2556. }
  2557. });
  2558. if (mode === 'horizontal') {
  2559. var anchor = _document2.default.createElement('a');
  2560. anchor.className = t.options.classPrefix + 'horizontal-volume-slider';
  2561. anchor.href = 'javascript:void(0);';
  2562. anchor.setAttribute('aria-label', _i18n2.default.t('mejs.volume-slider'));
  2563. anchor.setAttribute('aria-valuemin', 0);
  2564. anchor.setAttribute('aria-valuemax', 100);
  2565. anchor.setAttribute('role', 'slider');
  2566. anchor.innerHTML += '<span class="' + t.options.classPrefix + 'offscreen">' + volumeControlText + '</span>' + ('<div class="' + t.options.classPrefix + 'horizontal-volume-total">') + ('<div class="' + t.options.classPrefix + 'horizontal-volume-current"></div>') + ('<div class="' + t.options.classPrefix + 'horizontal-volume-handle"></div>') + '</div>';
  2567. mute.parentNode.insertBefore(anchor, mute.nextSibling);
  2568. }
  2569. var mouseIsDown = false,
  2570. mouseIsOver = false,
  2571. modified = false,
  2572. updateVolumeSlider = function updateVolumeSlider() {
  2573. var volume = Math.floor(media.volume * 100);
  2574. volumeSlider.setAttribute('aria-valuenow', volume);
  2575. volumeSlider.setAttribute('aria-valuetext', volume + '%');
  2576. };
  2577. var volumeSlider = mode === 'vertical' ? t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'volume-slider') : t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'horizontal-volume-slider'),
  2578. volumeTotal = mode === 'vertical' ? t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'volume-total') : t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'horizontal-volume-total'),
  2579. volumeCurrent = mode === 'vertical' ? t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'volume-current') : t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'horizontal-volume-current'),
  2580. volumeHandle = mode === 'vertical' ? t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'volume-handle') : t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'horizontal-volume-handle'),
  2581. positionVolumeHandle = function positionVolumeHandle(volume) {
  2582. if (volume === null || isNaN(volume) || volume === undefined) {
  2583. return;
  2584. }
  2585. volume = Math.max(0, volume);
  2586. volume = Math.min(volume, 1);
  2587. if (volume === 0) {
  2588. (0, _dom.removeClass)(mute, t.options.classPrefix + 'mute');
  2589. (0, _dom.addClass)(mute, t.options.classPrefix + 'unmute');
  2590. var button = mute.firstElementChild;
  2591. button.setAttribute('title', unmuteText);
  2592. button.setAttribute('aria-label', unmuteText);
  2593. } else {
  2594. (0, _dom.removeClass)(mute, t.options.classPrefix + 'unmute');
  2595. (0, _dom.addClass)(mute, t.options.classPrefix + 'mute');
  2596. var _button = mute.firstElementChild;
  2597. _button.setAttribute('title', muteText);
  2598. _button.setAttribute('aria-label', muteText);
  2599. }
  2600. var volumePercentage = volume * 100 + '%',
  2601. volumeStyles = getComputedStyle(volumeHandle);
  2602. if (mode === 'vertical') {
  2603. volumeCurrent.style.bottom = 0;
  2604. volumeCurrent.style.height = volumePercentage;
  2605. volumeHandle.style.bottom = volumePercentage;
  2606. volumeHandle.style.marginBottom = -parseFloat(volumeStyles.height) / 2 + 'px';
  2607. } else {
  2608. volumeCurrent.style.left = 0;
  2609. volumeCurrent.style.width = volumePercentage;
  2610. volumeHandle.style.left = volumePercentage;
  2611. volumeHandle.style.marginLeft = -parseFloat(volumeStyles.width) / 2 + 'px';
  2612. }
  2613. },
  2614. handleVolumeMove = function handleVolumeMove(e) {
  2615. var totalOffset = (0, _dom.offset)(volumeTotal),
  2616. volumeStyles = getComputedStyle(volumeTotal);
  2617. modified = true;
  2618. var volume = null;
  2619. if (mode === 'vertical') {
  2620. var railHeight = parseFloat(volumeStyles.height),
  2621. newY = e.pageY - totalOffset.top;
  2622. volume = (railHeight - newY) / railHeight;
  2623. if (totalOffset.top === 0 || totalOffset.left === 0) {
  2624. return;
  2625. }
  2626. } else {
  2627. var railWidth = parseFloat(volumeStyles.width),
  2628. newX = e.pageX - totalOffset.left;
  2629. volume = newX / railWidth;
  2630. }
  2631. volume = Math.max(0, volume);
  2632. volume = Math.min(volume, 1);
  2633. positionVolumeHandle(volume);
  2634. t.setMuted(volume === 0);
  2635. t.setVolume(volume);
  2636. e.preventDefault();
  2637. e.stopPropagation();
  2638. },
  2639. toggleMute = function toggleMute() {
  2640. if (t.muted) {
  2641. positionVolumeHandle(0);
  2642. (0, _dom.removeClass)(mute, t.options.classPrefix + 'mute');
  2643. (0, _dom.addClass)(mute, t.options.classPrefix + 'unmute');
  2644. } else {
  2645. positionVolumeHandle(media.volume);
  2646. (0, _dom.removeClass)(mute, t.options.classPrefix + 'unmute');
  2647. (0, _dom.addClass)(mute, t.options.classPrefix + 'mute');
  2648. }
  2649. };
  2650. player.getElement(player.container).addEventListener('keydown', function (e) {
  2651. var hasFocus = !!e.target.closest('.' + t.options.classPrefix + 'container');
  2652. if (!hasFocus && mode === 'vertical') {
  2653. volumeSlider.style.display = 'none';
  2654. }
  2655. });
  2656. mute.addEventListener('mouseenter', function (e) {
  2657. if (e.target === mute) {
  2658. volumeSlider.style.display = 'block';
  2659. mouseIsOver = true;
  2660. e.preventDefault();
  2661. e.stopPropagation();
  2662. }
  2663. });
  2664. mute.addEventListener('focusin', function () {
  2665. volumeSlider.style.display = 'block';
  2666. mouseIsOver = true;
  2667. });
  2668. mute.addEventListener('focusout', function (e) {
  2669. if ((!e.relatedTarget || e.relatedTarget && !e.relatedTarget.matches('.' + t.options.classPrefix + 'volume-slider')) && mode === 'vertical') {
  2670. volumeSlider.style.display = 'none';
  2671. }
  2672. });
  2673. mute.addEventListener('mouseleave', function () {
  2674. mouseIsOver = false;
  2675. if (!mouseIsDown && mode === 'vertical') {
  2676. volumeSlider.style.display = 'none';
  2677. }
  2678. });
  2679. mute.addEventListener('focusout', function () {
  2680. mouseIsOver = false;
  2681. });
  2682. mute.addEventListener('keydown', function (e) {
  2683. if (t.options.enableKeyboard && t.options.keyActions.length) {
  2684. var keyCode = e.which || e.keyCode || 0,
  2685. volume = media.volume;
  2686. switch (keyCode) {
  2687. case 38:
  2688. volume = Math.min(volume + 0.1, 1);
  2689. break;
  2690. case 40:
  2691. volume = Math.max(0, volume - 0.1);
  2692. break;
  2693. default:
  2694. return true;
  2695. }
  2696. mouseIsDown = false;
  2697. positionVolumeHandle(volume);
  2698. media.setVolume(volume);
  2699. e.preventDefault();
  2700. e.stopPropagation();
  2701. }
  2702. });
  2703. mute.querySelector('button').addEventListener('click', function () {
  2704. media.setMuted(!media.muted);
  2705. var event = (0, _general.createEvent)('volumechange', media);
  2706. media.dispatchEvent(event);
  2707. });
  2708. volumeSlider.addEventListener('dragstart', function () {
  2709. return false;
  2710. });
  2711. volumeSlider.addEventListener('mouseover', function () {
  2712. mouseIsOver = true;
  2713. });
  2714. volumeSlider.addEventListener('focusin', function () {
  2715. volumeSlider.style.display = 'block';
  2716. mouseIsOver = true;
  2717. });
  2718. volumeSlider.addEventListener('focusout', function () {
  2719. mouseIsOver = false;
  2720. if (!mouseIsDown && mode === 'vertical') {
  2721. volumeSlider.style.display = 'none';
  2722. }
  2723. });
  2724. volumeSlider.addEventListener('mousedown', function (e) {
  2725. handleVolumeMove(e);
  2726. t.globalBind('mousemove.vol', function (event) {
  2727. var target = event.target;
  2728. if (mouseIsDown && (target === volumeSlider || target.closest(mode === 'vertical' ? '.' + t.options.classPrefix + 'volume-slider' : '.' + t.options.classPrefix + 'horizontal-volume-slider'))) {
  2729. handleVolumeMove(event);
  2730. }
  2731. });
  2732. t.globalBind('mouseup.vol', function () {
  2733. mouseIsDown = false;
  2734. if (!mouseIsOver && mode === 'vertical') {
  2735. volumeSlider.style.display = 'none';
  2736. }
  2737. });
  2738. mouseIsDown = true;
  2739. e.preventDefault();
  2740. e.stopPropagation();
  2741. });
  2742. media.addEventListener('volumechange', function (e) {
  2743. if (!mouseIsDown) {
  2744. toggleMute();
  2745. }
  2746. updateVolumeSlider(e);
  2747. });
  2748. var rendered = false;
  2749. media.addEventListener('rendererready', function () {
  2750. if (!modified) {
  2751. setTimeout(function () {
  2752. rendered = true;
  2753. if (player.options.startVolume === 0 || media.originalNode.muted) {
  2754. media.setMuted(true);
  2755. player.options.startVolume = 0;
  2756. }
  2757. media.setVolume(player.options.startVolume);
  2758. t.setControlsSize();
  2759. }, 250);
  2760. }
  2761. });
  2762. media.addEventListener('loadedmetadata', function () {
  2763. setTimeout(function () {
  2764. if (!modified && !rendered) {
  2765. if (player.options.startVolume === 0 || media.originalNode.muted) {
  2766. media.setMuted(true);
  2767. }
  2768. media.setVolume(player.options.startVolume);
  2769. t.setControlsSize();
  2770. }
  2771. rendered = false;
  2772. }, 250);
  2773. });
  2774. if (player.options.startVolume === 0 || media.originalNode.muted) {
  2775. media.setMuted(true);
  2776. player.options.startVolume = 0;
  2777. toggleMute();
  2778. }
  2779. t.getElement(t.container).addEventListener('controlsresize', function () {
  2780. toggleMute();
  2781. });
  2782. }
  2783. });
  2784. },{"16":16,"2":2,"25":25,"26":26,"27":27,"5":5}],15:[function(_dereq_,module,exports){
  2785. 'use strict';
  2786. Object.defineProperty(exports, "__esModule", {
  2787. value: true
  2788. });
  2789. var EN = exports.EN = {
  2790. 'mejs.plural-form': 1,
  2791. 'mejs.download-file': 'Download File',
  2792. '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/',
  2793. 'mejs.fullscreen': 'Fullscreen',
  2794. 'mejs.play': 'Play',
  2795. 'mejs.pause': 'Pause',
  2796. 'mejs.time-slider': 'Time Slider',
  2797. 'mejs.time-help-text': 'Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.',
  2798. 'mejs.live-broadcast': 'Live Broadcast',
  2799. 'mejs.volume-help-text': 'Use Up/Down Arrow keys to increase or decrease volume.',
  2800. 'mejs.unmute': 'Unmute',
  2801. 'mejs.mute': 'Mute',
  2802. 'mejs.volume-slider': 'Volume Slider',
  2803. 'mejs.video-player': 'Video Player',
  2804. 'mejs.audio-player': 'Audio Player',
  2805. 'mejs.captions-subtitles': 'Captions/Subtitles',
  2806. 'mejs.captions-chapters': 'Chapters',
  2807. 'mejs.none': 'None',
  2808. 'mejs.afrikaans': 'Afrikaans',
  2809. 'mejs.albanian': 'Albanian',
  2810. 'mejs.arabic': 'Arabic',
  2811. 'mejs.belarusian': 'Belarusian',
  2812. 'mejs.bulgarian': 'Bulgarian',
  2813. 'mejs.catalan': 'Catalan',
  2814. 'mejs.chinese': 'Chinese',
  2815. 'mejs.chinese-simplified': 'Chinese (Simplified)',
  2816. 'mejs.chinese-traditional': 'Chinese (Traditional)',
  2817. 'mejs.croatian': 'Croatian',
  2818. 'mejs.czech': 'Czech',
  2819. 'mejs.danish': 'Danish',
  2820. 'mejs.dutch': 'Dutch',
  2821. 'mejs.english': 'English',
  2822. 'mejs.estonian': 'Estonian',
  2823. 'mejs.filipino': 'Filipino',
  2824. 'mejs.finnish': 'Finnish',
  2825. 'mejs.french': 'French',
  2826. 'mejs.galician': 'Galician',
  2827. 'mejs.german': 'German',
  2828. 'mejs.greek': 'Greek',
  2829. 'mejs.haitian-creole': 'Haitian Creole',
  2830. 'mejs.hebrew': 'Hebrew',
  2831. 'mejs.hindi': 'Hindi',
  2832. 'mejs.hungarian': 'Hungarian',
  2833. 'mejs.icelandic': 'Icelandic',
  2834. 'mejs.indonesian': 'Indonesian',
  2835. 'mejs.irish': 'Irish',
  2836. 'mejs.italian': 'Italian',
  2837. 'mejs.japanese': 'Japanese',
  2838. 'mejs.korean': 'Korean',
  2839. 'mejs.latvian': 'Latvian',
  2840. 'mejs.lithuanian': 'Lithuanian',
  2841. 'mejs.macedonian': 'Macedonian',
  2842. 'mejs.malay': 'Malay',
  2843. 'mejs.maltese': 'Maltese',
  2844. 'mejs.norwegian': 'Norwegian',
  2845. 'mejs.persian': 'Persian',
  2846. 'mejs.polish': 'Polish',
  2847. 'mejs.portuguese': 'Portuguese',
  2848. 'mejs.romanian': 'Romanian',
  2849. 'mejs.russian': 'Russian',
  2850. 'mejs.serbian': 'Serbian',
  2851. 'mejs.slovak': 'Slovak',
  2852. 'mejs.slovenian': 'Slovenian',
  2853. 'mejs.spanish': 'Spanish',
  2854. 'mejs.swahili': 'Swahili',
  2855. 'mejs.swedish': 'Swedish',
  2856. 'mejs.tagalog': 'Tagalog',
  2857. 'mejs.thai': 'Thai',
  2858. 'mejs.turkish': 'Turkish',
  2859. 'mejs.ukrainian': 'Ukrainian',
  2860. 'mejs.vietnamese': 'Vietnamese',
  2861. 'mejs.welsh': 'Welsh',
  2862. 'mejs.yiddish': 'Yiddish'
  2863. };
  2864. },{}],16:[function(_dereq_,module,exports){
  2865. 'use strict';
  2866. Object.defineProperty(exports, "__esModule", {
  2867. value: true
  2868. });
  2869. exports.config = undefined;
  2870. 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; };
  2871. 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; }; }();
  2872. var _window = _dereq_(3);
  2873. var _window2 = _interopRequireDefault(_window);
  2874. var _document = _dereq_(2);
  2875. var _document2 = _interopRequireDefault(_document);
  2876. var _mejs = _dereq_(7);
  2877. var _mejs2 = _interopRequireDefault(_mejs);
  2878. var _mediaelement = _dereq_(6);
  2879. var _mediaelement2 = _interopRequireDefault(_mediaelement);
  2880. var _default = _dereq_(17);
  2881. var _default2 = _interopRequireDefault(_default);
  2882. var _i18n = _dereq_(5);
  2883. var _i18n2 = _interopRequireDefault(_i18n);
  2884. var _constants = _dereq_(25);
  2885. var _general = _dereq_(27);
  2886. var _time = _dereq_(30);
  2887. var _media = _dereq_(28);
  2888. var _dom = _dereq_(26);
  2889. var dom = _interopRequireWildcard(_dom);
  2890. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  2891. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2892. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2893. _mejs2.default.mepIndex = 0;
  2894. _mejs2.default.players = {};
  2895. var config = exports.config = {
  2896. poster: '',
  2897. showPosterWhenEnded: false,
  2898. showPosterWhenPaused: false,
  2899. defaultVideoWidth: 480,
  2900. defaultVideoHeight: 270,
  2901. videoWidth: -1,
  2902. videoHeight: -1,
  2903. defaultAudioWidth: 400,
  2904. defaultAudioHeight: 40,
  2905. defaultSeekBackwardInterval: function defaultSeekBackwardInterval(media) {
  2906. return media.getDuration() * 0.05;
  2907. },
  2908. defaultSeekForwardInterval: function defaultSeekForwardInterval(media) {
  2909. return media.getDuration() * 0.05;
  2910. },
  2911. setDimensions: true,
  2912. audioWidth: -1,
  2913. audioHeight: -1,
  2914. loop: false,
  2915. autoRewind: true,
  2916. enableAutosize: true,
  2917. timeFormat: '',
  2918. alwaysShowHours: false,
  2919. showTimecodeFrameCount: false,
  2920. framesPerSecond: 25,
  2921. alwaysShowControls: false,
  2922. hideVideoControlsOnLoad: false,
  2923. hideVideoControlsOnPause: false,
  2924. clickToPlayPause: true,
  2925. controlsTimeoutDefault: 1500,
  2926. controlsTimeoutMouseEnter: 2500,
  2927. controlsTimeoutMouseLeave: 1000,
  2928. iPadUseNativeControls: false,
  2929. iPhoneUseNativeControls: false,
  2930. AndroidUseNativeControls: false,
  2931. features: ['playpause', 'current', 'progress', 'duration', 'tracks', 'volume', 'fullscreen'],
  2932. useDefaultControls: false,
  2933. isVideo: true,
  2934. stretching: 'auto',
  2935. classPrefix: 'mejs__',
  2936. enableKeyboard: true,
  2937. pauseOtherPlayers: true,
  2938. secondsDecimalLength: 0,
  2939. customError: null,
  2940. keyActions: [{
  2941. keys: [32, 179],
  2942. action: function action(player) {
  2943. if (!_constants.IS_FIREFOX) {
  2944. if (player.paused || player.ended) {
  2945. player.play();
  2946. } else {
  2947. player.pause();
  2948. }
  2949. }
  2950. }
  2951. }]
  2952. };
  2953. _mejs2.default.MepDefaults = config;
  2954. var MediaElementPlayer = function () {
  2955. function MediaElementPlayer(node, o) {
  2956. _classCallCheck(this, MediaElementPlayer);
  2957. var t = this,
  2958. element = typeof node === 'string' ? _document2.default.getElementById(node) : node;
  2959. if (!(t instanceof MediaElementPlayer)) {
  2960. return new MediaElementPlayer(element, o);
  2961. }
  2962. t.node = t.media = element;
  2963. if (!t.node) {
  2964. return;
  2965. }
  2966. if (t.media.player) {
  2967. return t.media.player;
  2968. }
  2969. t.hasFocus = false;
  2970. t.controlsAreVisible = true;
  2971. t.controlsEnabled = true;
  2972. t.controlsTimer = null;
  2973. t.currentMediaTime = 0;
  2974. t.proxy = null;
  2975. if (o === undefined) {
  2976. var options = t.node.getAttribute('data-mejsoptions');
  2977. o = options ? JSON.parse(options) : {};
  2978. }
  2979. t.options = Object.assign({}, config, o);
  2980. if (t.options.loop && !t.media.getAttribute('loop')) {
  2981. t.media.loop = true;
  2982. t.node.loop = true;
  2983. } else if (t.media.loop) {
  2984. t.options.loop = true;
  2985. }
  2986. if (!t.options.timeFormat) {
  2987. t.options.timeFormat = 'mm:ss';
  2988. if (t.options.alwaysShowHours) {
  2989. t.options.timeFormat = 'hh:mm:ss';
  2990. }
  2991. if (t.options.showTimecodeFrameCount) {
  2992. t.options.timeFormat += ':ff';
  2993. }
  2994. }
  2995. (0, _time.calculateTimeFormat)(0, t.options, t.options.framesPerSecond || 25);
  2996. t.id = 'mep_' + _mejs2.default.mepIndex++;
  2997. _mejs2.default.players[t.id] = t;
  2998. t.init();
  2999. return t;
  3000. }
  3001. _createClass(MediaElementPlayer, [{
  3002. key: 'getElement',
  3003. value: function getElement(element) {
  3004. return element;
  3005. }
  3006. }, {
  3007. key: 'init',
  3008. value: function init() {
  3009. var t = this,
  3010. playerOptions = Object.assign({}, t.options, {
  3011. success: function success(media, domNode) {
  3012. t._meReady(media, domNode);
  3013. },
  3014. error: function error(e) {
  3015. t._handleError(e);
  3016. }
  3017. }),
  3018. tagName = t.node.tagName.toLowerCase();
  3019. t.isDynamic = tagName !== 'audio' && tagName !== 'video' && tagName !== 'iframe';
  3020. t.isVideo = t.isDynamic ? t.options.isVideo : tagName !== 'audio' && t.options.isVideo;
  3021. t.mediaFiles = null;
  3022. t.trackFiles = null;
  3023. if (_constants.IS_IPAD && t.options.iPadUseNativeControls || _constants.IS_IPHONE && t.options.iPhoneUseNativeControls) {
  3024. t.node.setAttribute('controls', true);
  3025. if (_constants.IS_IPAD && t.node.getAttribute('autoplay')) {
  3026. t.play();
  3027. }
  3028. } else if ((t.isVideo || !t.isVideo && (t.options.features.length || t.options.useDefaultControls)) && !(_constants.IS_ANDROID && t.options.AndroidUseNativeControls)) {
  3029. t.node.removeAttribute('controls');
  3030. var videoPlayerTitle = t.isVideo ? _i18n2.default.t('mejs.video-player') : _i18n2.default.t('mejs.audio-player');
  3031. var offscreen = _document2.default.createElement('span');
  3032. offscreen.className = t.options.classPrefix + 'offscreen';
  3033. offscreen.innerText = videoPlayerTitle;
  3034. t.media.parentNode.insertBefore(offscreen, t.media);
  3035. t.container = _document2.default.createElement('div');
  3036. t.getElement(t.container).id = t.id;
  3037. t.getElement(t.container).className = t.options.classPrefix + 'container ' + t.options.classPrefix + 'container-keyboard-inactive ' + t.media.className;
  3038. t.getElement(t.container).tabIndex = 0;
  3039. t.getElement(t.container).setAttribute('role', 'application');
  3040. t.getElement(t.container).setAttribute('aria-label', videoPlayerTitle);
  3041. t.getElement(t.container).innerHTML = '<div class="' + t.options.classPrefix + 'inner">' + ('<div class="' + t.options.classPrefix + 'mediaelement"></div>') + ('<div class="' + t.options.classPrefix + 'layers"></div>') + ('<div class="' + t.options.classPrefix + 'controls"></div>') + '</div>';
  3042. t.getElement(t.container).addEventListener('focus', function (e) {
  3043. if (!t.controlsAreVisible && !t.hasFocus && t.controlsEnabled) {
  3044. t.showControls(true);
  3045. var btnSelector = (0, _general.isNodeAfter)(e.relatedTarget, t.getElement(t.container)) ? '.' + t.options.classPrefix + 'controls .' + t.options.classPrefix + 'button:last-child > button' : '.' + t.options.classPrefix + 'playpause-button > button',
  3046. button = t.getElement(t.container).querySelector(btnSelector);
  3047. button.focus();
  3048. }
  3049. });
  3050. t.node.parentNode.insertBefore(t.getElement(t.container), t.node);
  3051. if (!t.options.features.length && !t.options.useDefaultControls) {
  3052. t.getElement(t.container).style.background = 'transparent';
  3053. t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'controls').style.display = 'none';
  3054. }
  3055. if (t.isVideo && t.options.stretching === 'fill' && !dom.hasClass(t.getElement(t.container).parentNode, t.options.classPrefix + 'fill-container')) {
  3056. t.outerContainer = t.media.parentNode;
  3057. var wrapper = _document2.default.createElement('div');
  3058. wrapper.className = t.options.classPrefix + 'fill-container';
  3059. t.getElement(t.container).parentNode.insertBefore(wrapper, t.getElement(t.container));
  3060. wrapper.appendChild(t.getElement(t.container));
  3061. }
  3062. if (_constants.IS_ANDROID) {
  3063. dom.addClass(t.getElement(t.container), t.options.classPrefix + 'android');
  3064. }
  3065. if (_constants.IS_IOS) {
  3066. dom.addClass(t.getElement(t.container), t.options.classPrefix + 'ios');
  3067. }
  3068. if (_constants.IS_IPAD) {
  3069. dom.addClass(t.getElement(t.container), t.options.classPrefix + 'ipad');
  3070. }
  3071. if (_constants.IS_IPHONE) {
  3072. dom.addClass(t.getElement(t.container), t.options.classPrefix + 'iphone');
  3073. }
  3074. dom.addClass(t.getElement(t.container), t.isVideo ? t.options.classPrefix + 'video' : t.options.classPrefix + 'audio');
  3075. if (_constants.IS_SAFARI && !_constants.IS_IOS) {
  3076. dom.addClass(t.getElement(t.container), t.options.classPrefix + 'hide-cues');
  3077. var cloneNode = t.node.cloneNode(),
  3078. children = t.node.children,
  3079. mediaFiles = [],
  3080. tracks = [];
  3081. for (var i = 0, total = children.length; i < total; i++) {
  3082. var childNode = children[i];
  3083. (function () {
  3084. switch (childNode.tagName.toLowerCase()) {
  3085. case 'source':
  3086. var elements = {};
  3087. Array.prototype.slice.call(childNode.attributes).forEach(function (item) {
  3088. elements[item.name] = item.value;
  3089. });
  3090. elements.type = (0, _media.formatType)(elements.src, elements.type);
  3091. mediaFiles.push(elements);
  3092. break;
  3093. case 'track':
  3094. childNode.mode = 'hidden';
  3095. tracks.push(childNode);
  3096. break;
  3097. default:
  3098. cloneNode.appendChild(childNode);
  3099. break;
  3100. }
  3101. })();
  3102. }
  3103. t.node.remove();
  3104. t.node = t.media = cloneNode;
  3105. if (mediaFiles.length) {
  3106. t.mediaFiles = mediaFiles;
  3107. }
  3108. if (tracks.length) {
  3109. t.trackFiles = tracks;
  3110. }
  3111. }
  3112. t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'mediaelement').appendChild(t.node);
  3113. t.media.player = t;
  3114. t.controls = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'controls');
  3115. t.layers = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'layers');
  3116. var tagType = t.isVideo ? 'video' : 'audio',
  3117. capsTagName = tagType.substring(0, 1).toUpperCase() + tagType.substring(1);
  3118. if (t.options[tagType + 'Width'] > 0 || t.options[tagType + 'Width'].toString().indexOf('%') > -1) {
  3119. t.width = t.options[tagType + 'Width'];
  3120. } else if (t.node.style.width !== '' && t.node.style.width !== null) {
  3121. t.width = t.node.style.width;
  3122. } else if (t.node.getAttribute('width')) {
  3123. t.width = t.node.getAttribute('width');
  3124. } else {
  3125. t.width = t.options['default' + capsTagName + 'Width'];
  3126. }
  3127. if (t.options[tagType + 'Height'] > 0 || t.options[tagType + 'Height'].toString().indexOf('%') > -1) {
  3128. t.height = t.options[tagType + 'Height'];
  3129. } else if (t.node.style.height !== '' && t.node.style.height !== null) {
  3130. t.height = t.node.style.height;
  3131. } else if (t.node.getAttribute('height')) {
  3132. t.height = t.node.getAttribute('height');
  3133. } else {
  3134. t.height = t.options['default' + capsTagName + 'Height'];
  3135. }
  3136. t.initialAspectRatio = t.height >= t.width ? t.width / t.height : t.height / t.width;
  3137. t.setPlayerSize(t.width, t.height);
  3138. playerOptions.pluginWidth = t.width;
  3139. playerOptions.pluginHeight = t.height;
  3140. } else if (!t.isVideo && !t.options.features.length && !t.options.useDefaultControls) {
  3141. t.node.style.display = 'none';
  3142. }
  3143. _mejs2.default.MepDefaults = playerOptions;
  3144. new _mediaelement2.default(t.media, playerOptions, t.mediaFiles);
  3145. if (t.getElement(t.container) !== undefined && t.options.features.length && t.controlsAreVisible && !t.options.hideVideoControlsOnLoad) {
  3146. var event = (0, _general.createEvent)('controlsshown', t.getElement(t.container));
  3147. t.getElement(t.container).dispatchEvent(event);
  3148. }
  3149. }
  3150. }, {
  3151. key: 'showControls',
  3152. value: function showControls(doAnimation) {
  3153. var t = this;
  3154. doAnimation = doAnimation === undefined || doAnimation;
  3155. if (t.controlsAreVisible || !t.isVideo) {
  3156. return;
  3157. }
  3158. if (doAnimation) {
  3159. (function () {
  3160. dom.fadeIn(t.getElement(t.controls), 200, function () {
  3161. dom.removeClass(t.getElement(t.controls), t.options.classPrefix + 'offscreen');
  3162. var event = (0, _general.createEvent)('controlsshown', t.getElement(t.container));
  3163. t.getElement(t.container).dispatchEvent(event);
  3164. });
  3165. var controls = t.getElement(t.container).querySelectorAll('.' + t.options.classPrefix + 'control');
  3166. var _loop = function _loop(i, total) {
  3167. dom.fadeIn(controls[i], 200, function () {
  3168. dom.removeClass(controls[i], t.options.classPrefix + 'offscreen');
  3169. });
  3170. };
  3171. for (var i = 0, total = controls.length; i < total; i++) {
  3172. _loop(i, total);
  3173. }
  3174. })();
  3175. } else {
  3176. dom.removeClass(t.getElement(t.controls), t.options.classPrefix + 'offscreen');
  3177. t.getElement(t.controls).style.display = '';
  3178. t.getElement(t.controls).style.opacity = 1;
  3179. var controls = t.getElement(t.container).querySelectorAll('.' + t.options.classPrefix + 'control');
  3180. for (var i = 0, total = controls.length; i < total; i++) {
  3181. dom.removeClass(controls[i], t.options.classPrefix + 'offscreen');
  3182. controls[i].style.display = '';
  3183. }
  3184. var event = (0, _general.createEvent)('controlsshown', t.getElement(t.container));
  3185. t.getElement(t.container).dispatchEvent(event);
  3186. }
  3187. t.controlsAreVisible = true;
  3188. t.setControlsSize();
  3189. }
  3190. }, {
  3191. key: 'hideControls',
  3192. value: function hideControls(doAnimation, forceHide) {
  3193. var t = this;
  3194. doAnimation = doAnimation === undefined || doAnimation;
  3195. if (forceHide !== true && (!t.controlsAreVisible || t.options.alwaysShowControls || t.paused && t.readyState === 4 && (!t.options.hideVideoControlsOnLoad && t.currentTime <= 0 || !t.options.hideVideoControlsOnPause && t.currentTime > 0) || t.isVideo && !t.options.hideVideoControlsOnLoad && !t.readyState || t.ended)) {
  3196. return;
  3197. }
  3198. if (doAnimation) {
  3199. (function () {
  3200. dom.fadeOut(t.getElement(t.controls), 200, function () {
  3201. dom.addClass(t.getElement(t.controls), t.options.classPrefix + 'offscreen');
  3202. t.getElement(t.controls).style.display = '';
  3203. var event = (0, _general.createEvent)('controlshidden', t.getElement(t.container));
  3204. t.getElement(t.container).dispatchEvent(event);
  3205. });
  3206. var controls = t.getElement(t.container).querySelectorAll('.' + t.options.classPrefix + 'control');
  3207. var _loop2 = function _loop2(i, total) {
  3208. dom.fadeOut(controls[i], 200, function () {
  3209. dom.addClass(controls[i], t.options.classPrefix + 'offscreen');
  3210. controls[i].style.display = '';
  3211. });
  3212. };
  3213. for (var i = 0, total = controls.length; i < total; i++) {
  3214. _loop2(i, total);
  3215. }
  3216. })();
  3217. } else {
  3218. dom.addClass(t.getElement(t.controls), t.options.classPrefix + 'offscreen');
  3219. t.getElement(t.controls).style.display = '';
  3220. t.getElement(t.controls).style.opacity = 0;
  3221. var controls = t.getElement(t.container).querySelectorAll('.' + t.options.classPrefix + 'control');
  3222. for (var i = 0, total = controls.length; i < total; i++) {
  3223. dom.addClass(controls[i], t.options.classPrefix + 'offscreen');
  3224. controls[i].style.display = '';
  3225. }
  3226. var event = (0, _general.createEvent)('controlshidden', t.getElement(t.container));
  3227. t.getElement(t.container).dispatchEvent(event);
  3228. }
  3229. t.controlsAreVisible = false;
  3230. }
  3231. }, {
  3232. key: 'startControlsTimer',
  3233. value: function startControlsTimer(timeout) {
  3234. var t = this;
  3235. timeout = typeof timeout !== 'undefined' ? timeout : t.options.controlsTimeoutDefault;
  3236. t.killControlsTimer('start');
  3237. t.controlsTimer = setTimeout(function () {
  3238. t.hideControls();
  3239. t.killControlsTimer('hide');
  3240. }, timeout);
  3241. }
  3242. }, {
  3243. key: 'killControlsTimer',
  3244. value: function killControlsTimer() {
  3245. var t = this;
  3246. if (t.controlsTimer !== null) {
  3247. clearTimeout(t.controlsTimer);
  3248. delete t.controlsTimer;
  3249. t.controlsTimer = null;
  3250. }
  3251. }
  3252. }, {
  3253. key: 'disableControls',
  3254. value: function disableControls() {
  3255. var t = this;
  3256. t.killControlsTimer();
  3257. t.controlsEnabled = false;
  3258. t.hideControls(false, true);
  3259. }
  3260. }, {
  3261. key: 'enableControls',
  3262. value: function enableControls() {
  3263. var t = this;
  3264. t.controlsEnabled = true;
  3265. t.showControls(false);
  3266. }
  3267. }, {
  3268. key: '_setDefaultPlayer',
  3269. value: function _setDefaultPlayer() {
  3270. var t = this;
  3271. if (t.proxy) {
  3272. t.proxy.pause();
  3273. }
  3274. t.proxy = new _default2.default(t);
  3275. t.media.addEventListener('loadedmetadata', function () {
  3276. if (t.getCurrentTime() > 0 && t.currentMediaTime > 0) {
  3277. t.setCurrentTime(t.currentMediaTime);
  3278. if (!_constants.IS_IOS && !_constants.IS_ANDROID) {
  3279. t.play();
  3280. }
  3281. }
  3282. });
  3283. }
  3284. }, {
  3285. key: '_meReady',
  3286. value: function _meReady(media, domNode) {
  3287. var t = this,
  3288. autoplayAttr = domNode.getAttribute('autoplay'),
  3289. autoplay = !(autoplayAttr === undefined || autoplayAttr === null || autoplayAttr === 'false'),
  3290. isNative = media.rendererName !== null && /(native|html5)/i.test(t.media.rendererName);
  3291. if (t.getElement(t.controls)) {
  3292. t.enableControls();
  3293. }
  3294. if (t.getElement(t.container) && t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'overlay-play')) {
  3295. t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'overlay-play').style.display = '';
  3296. }
  3297. if (t.created) {
  3298. return;
  3299. }
  3300. t.created = true;
  3301. t.media = media;
  3302. t.domNode = domNode;
  3303. if (!(_constants.IS_ANDROID && t.options.AndroidUseNativeControls) && !(_constants.IS_IPAD && t.options.iPadUseNativeControls) && !(_constants.IS_IPHONE && t.options.iPhoneUseNativeControls)) {
  3304. if (!t.isVideo && !t.options.features.length && !t.options.useDefaultControls) {
  3305. if (autoplay && isNative) {
  3306. t.play();
  3307. }
  3308. if (t.options.success) {
  3309. if (typeof t.options.success === 'string') {
  3310. _window2.default[t.options.success](t.media, t.domNode, t);
  3311. } else {
  3312. t.options.success(t.media, t.domNode, t);
  3313. }
  3314. }
  3315. return;
  3316. }
  3317. t.featurePosition = {};
  3318. t._setDefaultPlayer();
  3319. t.buildposter(t, t.getElement(t.controls), t.getElement(t.layers), t.media);
  3320. t.buildkeyboard(t, t.getElement(t.controls), t.getElement(t.layers), t.media);
  3321. t.buildoverlays(t, t.getElement(t.controls), t.getElement(t.layers), t.media);
  3322. if (t.options.useDefaultControls) {
  3323. var defaultControls = ['playpause', 'current', 'progress', 'duration', 'tracks', 'volume', 'fullscreen'];
  3324. t.options.features = defaultControls.concat(t.options.features.filter(function (item) {
  3325. return defaultControls.indexOf(item) === -1;
  3326. }));
  3327. }
  3328. t.buildfeatures(t, t.getElement(t.controls), t.getElement(t.layers), t.media);
  3329. var event = (0, _general.createEvent)('controlsready', t.getElement(t.container));
  3330. t.getElement(t.container).dispatchEvent(event);
  3331. t.setPlayerSize(t.width, t.height);
  3332. t.setControlsSize();
  3333. if (t.isVideo) {
  3334. t.clickToPlayPauseCallback = function () {
  3335. if (t.options.clickToPlayPause) {
  3336. var button = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'overlay-button'),
  3337. pressed = button.getAttribute('aria-pressed');
  3338. if (t.paused && pressed) {
  3339. t.pause();
  3340. } else if (t.paused) {
  3341. t.play();
  3342. } else {
  3343. t.pause();
  3344. }
  3345. button.setAttribute('aria-pressed', !pressed);
  3346. t.getElement(t.container).focus();
  3347. }
  3348. };
  3349. t.createIframeLayer();
  3350. t.media.addEventListener('click', t.clickToPlayPauseCallback);
  3351. if ((_constants.IS_ANDROID || _constants.IS_IOS) && !t.options.alwaysShowControls) {
  3352. t.node.addEventListener('touchstart', function () {
  3353. if (t.controlsAreVisible) {
  3354. t.hideControls(false);
  3355. } else {
  3356. if (t.controlsEnabled) {
  3357. t.showControls(false);
  3358. }
  3359. }
  3360. }, _constants.SUPPORT_PASSIVE_EVENT ? { passive: true } : false);
  3361. } else {
  3362. t.getElement(t.container).addEventListener('mouseenter', function () {
  3363. if (t.controlsEnabled) {
  3364. if (!t.options.alwaysShowControls) {
  3365. t.killControlsTimer('enter');
  3366. t.showControls();
  3367. t.startControlsTimer(t.options.controlsTimeoutMouseEnter);
  3368. }
  3369. }
  3370. });
  3371. t.getElement(t.container).addEventListener('mousemove', function () {
  3372. if (t.controlsEnabled) {
  3373. if (!t.controlsAreVisible) {
  3374. t.showControls();
  3375. }
  3376. if (!t.options.alwaysShowControls) {
  3377. t.startControlsTimer(t.options.controlsTimeoutMouseEnter);
  3378. }
  3379. }
  3380. });
  3381. t.getElement(t.container).addEventListener('mouseleave', function () {
  3382. if (t.controlsEnabled) {
  3383. if (!t.paused && !t.options.alwaysShowControls) {
  3384. t.startControlsTimer(t.options.controlsTimeoutMouseLeave);
  3385. }
  3386. }
  3387. });
  3388. }
  3389. if (t.options.hideVideoControlsOnLoad) {
  3390. t.hideControls(false);
  3391. }
  3392. if (t.options.enableAutosize) {
  3393. t.media.addEventListener('loadedmetadata', function (e) {
  3394. var target = e !== undefined ? e.detail.target || e.target : t.media;
  3395. if (t.options.videoHeight <= 0 && !t.domNode.getAttribute('height') && !t.domNode.style.height && target !== null && !isNaN(target.videoHeight)) {
  3396. t.setPlayerSize(target.videoWidth, target.videoHeight);
  3397. t.setControlsSize();
  3398. t.media.setSize(target.videoWidth, target.videoHeight);
  3399. }
  3400. });
  3401. }
  3402. }
  3403. t.media.addEventListener('play', function () {
  3404. t.hasFocus = true;
  3405. for (var playerIndex in _mejs2.default.players) {
  3406. if (_mejs2.default.players.hasOwnProperty(playerIndex)) {
  3407. var p = _mejs2.default.players[playerIndex];
  3408. if (p.id !== t.id && t.options.pauseOtherPlayers && !p.paused && !p.ended) {
  3409. p.pause();
  3410. p.hasFocus = false;
  3411. }
  3412. }
  3413. }
  3414. if (!(_constants.IS_ANDROID || _constants.IS_IOS) && !t.options.alwaysShowControls && t.isVideo) {
  3415. t.hideControls();
  3416. }
  3417. });
  3418. t.media.addEventListener('ended', function () {
  3419. if (t.options.autoRewind) {
  3420. try {
  3421. t.setCurrentTime(0);
  3422. setTimeout(function () {
  3423. var loadingElement = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'overlay-loading');
  3424. if (loadingElement && loadingElement.parentNode) {
  3425. loadingElement.parentNode.style.display = 'none';
  3426. }
  3427. }, 20);
  3428. } catch (exp) {
  3429. }
  3430. }
  3431. if (typeof t.media.renderer.stop === 'function') {
  3432. t.media.renderer.stop();
  3433. } else {
  3434. t.pause();
  3435. }
  3436. if (t.setProgressRail) {
  3437. t.setProgressRail();
  3438. }
  3439. if (t.setCurrentRail) {
  3440. t.setCurrentRail();
  3441. }
  3442. if (t.options.loop) {
  3443. t.play();
  3444. } else if (!t.options.alwaysShowControls && t.controlsEnabled) {
  3445. t.showControls();
  3446. }
  3447. });
  3448. t.media.addEventListener('loadedmetadata', function () {
  3449. (0, _time.calculateTimeFormat)(t.getDuration(), t.options, t.options.framesPerSecond || 25);
  3450. if (t.updateDuration) {
  3451. t.updateDuration();
  3452. }
  3453. if (t.updateCurrent) {
  3454. t.updateCurrent();
  3455. }
  3456. if (!t.isFullScreen) {
  3457. t.setPlayerSize(t.width, t.height);
  3458. t.setControlsSize();
  3459. }
  3460. });
  3461. var duration = null;
  3462. t.media.addEventListener('timeupdate', function () {
  3463. if (!isNaN(t.getDuration()) && duration !== t.getDuration()) {
  3464. duration = t.getDuration();
  3465. (0, _time.calculateTimeFormat)(duration, t.options, t.options.framesPerSecond || 25);
  3466. if (t.updateDuration) {
  3467. t.updateDuration();
  3468. }
  3469. if (t.updateCurrent) {
  3470. t.updateCurrent();
  3471. }
  3472. t.setControlsSize();
  3473. }
  3474. });
  3475. t.getElement(t.container).addEventListener('click', function (e) {
  3476. dom.addClass(e.currentTarget, t.options.classPrefix + 'container-keyboard-inactive');
  3477. });
  3478. t.getElement(t.container).addEventListener('focusin', function (e) {
  3479. dom.removeClass(e.currentTarget, t.options.classPrefix + 'container-keyboard-inactive');
  3480. if (t.isVideo && !_constants.IS_ANDROID && !_constants.IS_IOS && t.controlsEnabled && !t.options.alwaysShowControls) {
  3481. t.killControlsTimer('enter');
  3482. t.showControls();
  3483. t.startControlsTimer(t.options.controlsTimeoutMouseEnter);
  3484. }
  3485. });
  3486. t.getElement(t.container).addEventListener('focusout', function (e) {
  3487. setTimeout(function () {
  3488. if (e.relatedTarget) {
  3489. if (t.keyboardAction && !e.relatedTarget.closest('.' + t.options.classPrefix + 'container')) {
  3490. t.keyboardAction = false;
  3491. if (t.isVideo && !t.options.alwaysShowControls && !t.paused) {
  3492. t.startControlsTimer(t.options.controlsTimeoutMouseLeave);
  3493. }
  3494. }
  3495. }
  3496. }, 0);
  3497. });
  3498. setTimeout(function () {
  3499. t.setPlayerSize(t.width, t.height);
  3500. t.setControlsSize();
  3501. }, 0);
  3502. t.globalResizeCallback = function () {
  3503. if (!(t.isFullScreen || _constants.HAS_TRUE_NATIVE_FULLSCREEN && _document2.default.webkitIsFullScreen)) {
  3504. t.setPlayerSize(t.width, t.height);
  3505. }
  3506. t.setControlsSize();
  3507. };
  3508. t.globalBind('resize', t.globalResizeCallback);
  3509. }
  3510. if (autoplay && isNative) {
  3511. t.play();
  3512. }
  3513. if (t.options.success) {
  3514. if (typeof t.options.success === 'string') {
  3515. _window2.default[t.options.success](t.media, t.domNode, t);
  3516. } else {
  3517. t.options.success(t.media, t.domNode, t);
  3518. }
  3519. }
  3520. }
  3521. }, {
  3522. key: '_handleError',
  3523. value: function _handleError(e, media, node) {
  3524. var t = this,
  3525. play = t.getElement(t.layers).querySelector('.' + t.options.classPrefix + 'overlay-play');
  3526. if (play) {
  3527. play.style.display = 'none';
  3528. }
  3529. if (t.options.error) {
  3530. t.options.error(e, media, node);
  3531. }
  3532. if (t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'cannotplay')) {
  3533. t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'cannotplay').remove();
  3534. }
  3535. var errorContainer = _document2.default.createElement('div');
  3536. errorContainer.className = t.options.classPrefix + 'cannotplay';
  3537. errorContainer.style.width = '100%';
  3538. errorContainer.style.height = '100%';
  3539. var errorContent = typeof t.options.customError === 'function' ? t.options.customError(t.media, t.media.originalNode) : t.options.customError,
  3540. imgError = '';
  3541. if (!errorContent) {
  3542. var poster = t.media.originalNode.getAttribute('poster');
  3543. if (poster) {
  3544. imgError = '<img src="' + poster + '" alt="' + _mejs2.default.i18n.t('mejs.download-file') + '">';
  3545. }
  3546. if (e.message) {
  3547. errorContent = '<p>' + e.message + '</p>';
  3548. }
  3549. if (e.urls) {
  3550. for (var i = 0, total = e.urls.length; i < total; i++) {
  3551. var url = e.urls[i];
  3552. errorContent += '<a href="' + url.src + '" data-type="' + url.type + '"><span>' + _mejs2.default.i18n.t('mejs.download-file') + ': ' + url.src + '</span></a>';
  3553. }
  3554. }
  3555. }
  3556. if (errorContent && t.getElement(t.layers).querySelector('.' + t.options.classPrefix + 'overlay-error')) {
  3557. errorContainer.innerHTML = errorContent;
  3558. t.getElement(t.layers).querySelector('.' + t.options.classPrefix + 'overlay-error').innerHTML = '' + imgError + errorContainer.outerHTML;
  3559. t.getElement(t.layers).querySelector('.' + t.options.classPrefix + 'overlay-error').parentNode.style.display = 'block';
  3560. }
  3561. if (t.controlsEnabled) {
  3562. t.disableControls();
  3563. }
  3564. }
  3565. }, {
  3566. key: 'setPlayerSize',
  3567. value: function setPlayerSize(width, height) {
  3568. var t = this;
  3569. if (!t.options.setDimensions) {
  3570. return false;
  3571. }
  3572. if (typeof width !== 'undefined') {
  3573. t.width = width;
  3574. }
  3575. if (typeof height !== 'undefined') {
  3576. t.height = height;
  3577. }
  3578. switch (t.options.stretching) {
  3579. case 'fill':
  3580. if (t.isVideo) {
  3581. t.setFillMode();
  3582. } else {
  3583. t.setDimensions(t.width, t.height);
  3584. }
  3585. break;
  3586. case 'responsive':
  3587. t.setResponsiveMode();
  3588. break;
  3589. case 'none':
  3590. t.setDimensions(t.width, t.height);
  3591. break;
  3592. default:
  3593. if (t.hasFluidMode() === true) {
  3594. t.setResponsiveMode();
  3595. } else {
  3596. t.setDimensions(t.width, t.height);
  3597. }
  3598. break;
  3599. }
  3600. }
  3601. }, {
  3602. key: 'hasFluidMode',
  3603. value: function hasFluidMode() {
  3604. var t = this;
  3605. return t.height.toString().indexOf('%') !== -1 || t.node && t.node.style.maxWidth && t.node.style.maxWidth !== 'none' && t.node.style.maxWidth !== t.width || t.node && t.node.currentStyle && t.node.currentStyle.maxWidth === '100%';
  3606. }
  3607. }, {
  3608. key: 'setResponsiveMode',
  3609. value: function setResponsiveMode() {
  3610. var t = this,
  3611. parent = function () {
  3612. var parentEl = void 0,
  3613. el = t.getElement(t.container);
  3614. while (el) {
  3615. try {
  3616. if (_constants.IS_FIREFOX && el.tagName.toLowerCase() === 'html' && _window2.default.self !== _window2.default.top && _window2.default.frameElement !== null) {
  3617. return _window2.default.frameElement;
  3618. } else {
  3619. parentEl = el.parentElement;
  3620. }
  3621. } catch (e) {
  3622. parentEl = el.parentElement;
  3623. }
  3624. if (parentEl && dom.visible(parentEl)) {
  3625. return parentEl;
  3626. }
  3627. el = parentEl;
  3628. }
  3629. return null;
  3630. }(),
  3631. parentStyles = parent ? getComputedStyle(parent, null) : getComputedStyle(_document2.default.body, null),
  3632. nativeWidth = function () {
  3633. if (t.isVideo) {
  3634. if (t.node.videoWidth && t.node.videoWidth > 0) {
  3635. return t.node.videoWidth;
  3636. } else if (t.node.getAttribute('width')) {
  3637. return t.node.getAttribute('width');
  3638. } else {
  3639. return t.options.defaultVideoWidth;
  3640. }
  3641. } else {
  3642. return t.options.defaultAudioWidth;
  3643. }
  3644. }(),
  3645. nativeHeight = function () {
  3646. if (t.isVideo) {
  3647. if (t.node.videoHeight && t.node.videoHeight > 0) {
  3648. return t.node.videoHeight;
  3649. } else if (t.node.getAttribute('height')) {
  3650. return t.node.getAttribute('height');
  3651. } else {
  3652. return t.options.defaultVideoHeight;
  3653. }
  3654. } else {
  3655. return t.options.defaultAudioHeight;
  3656. }
  3657. }(),
  3658. aspectRatio = function () {
  3659. var ratio = 1;
  3660. if (!t.isVideo) {
  3661. return ratio;
  3662. }
  3663. if (t.node.videoWidth && t.node.videoWidth > 0 && t.node.videoHeight && t.node.videoHeight > 0) {
  3664. ratio = t.height >= t.width ? t.node.videoWidth / t.node.videoHeight : t.node.videoHeight / t.node.videoWidth;
  3665. } else {
  3666. ratio = t.initialAspectRatio;
  3667. }
  3668. if (isNaN(ratio) || ratio < 0.01 || ratio > 100) {
  3669. ratio = 1;
  3670. }
  3671. return ratio;
  3672. }(),
  3673. parentHeight = parseFloat(parentStyles.height);
  3674. var newHeight = void 0,
  3675. parentWidth = parseFloat(parentStyles.width);
  3676. if (t.isVideo) {
  3677. if (t.height === '100%') {
  3678. newHeight = parseFloat(parentWidth * nativeHeight / nativeWidth, 10);
  3679. } else {
  3680. newHeight = t.height >= t.width ? parseFloat(parentWidth / aspectRatio, 10) : parseFloat(parentWidth * aspectRatio, 10);
  3681. }
  3682. } else {
  3683. newHeight = nativeHeight;
  3684. }
  3685. if (isNaN(newHeight)) {
  3686. newHeight = parentHeight;
  3687. }
  3688. if (t.getElement(t.container).parentNode.length > 0 && t.getElement(t.container).parentNode.tagName.toLowerCase() === 'body') {
  3689. parentWidth = _window2.default.innerWidth || _document2.default.documentElement.clientWidth || _document2.default.body.clientWidth;
  3690. newHeight = _window2.default.innerHeight || _document2.default.documentElement.clientHeight || _document2.default.body.clientHeight;
  3691. }
  3692. if (newHeight && parentWidth) {
  3693. t.getElement(t.container).style.width = parentWidth + 'px';
  3694. t.getElement(t.container).style.height = newHeight + 'px';
  3695. t.node.style.width = '100%';
  3696. t.node.style.height = '100%';
  3697. if (t.isVideo && t.media.setSize) {
  3698. t.media.setSize(parentWidth, newHeight);
  3699. }
  3700. var layerChildren = t.getElement(t.layers).children;
  3701. for (var i = 0, total = layerChildren.length; i < total; i++) {
  3702. layerChildren[i].style.width = '100%';
  3703. layerChildren[i].style.height = '100%';
  3704. }
  3705. }
  3706. }
  3707. }, {
  3708. key: 'setFillMode',
  3709. value: function setFillMode() {
  3710. var t = this;
  3711. var isIframe = _window2.default.self !== _window2.default.top && _window2.default.frameElement !== null;
  3712. var parent = function () {
  3713. var parentEl = void 0,
  3714. el = t.getElement(t.container);
  3715. while (el) {
  3716. try {
  3717. if (_constants.IS_FIREFOX && el.tagName.toLowerCase() === 'html' && _window2.default.self !== _window2.default.top && _window2.default.frameElement !== null) {
  3718. return _window2.default.frameElement;
  3719. } else {
  3720. parentEl = el.parentElement;
  3721. }
  3722. } catch (e) {
  3723. parentEl = el.parentElement;
  3724. }
  3725. if (parentEl && dom.visible(parentEl)) {
  3726. return parentEl;
  3727. }
  3728. el = parentEl;
  3729. }
  3730. return null;
  3731. }();
  3732. var parentStyles = parent ? getComputedStyle(parent, null) : getComputedStyle(_document2.default.body, null);
  3733. if (t.node.style.height !== 'none' && t.node.style.height !== t.height) {
  3734. t.node.style.height = 'auto';
  3735. }
  3736. if (t.node.style.maxWidth !== 'none' && t.node.style.maxWidth !== t.width) {
  3737. t.node.style.maxWidth = 'none';
  3738. }
  3739. if (t.node.style.maxHeight !== 'none' && t.node.style.maxHeight !== t.height) {
  3740. t.node.style.maxHeight = 'none';
  3741. }
  3742. if (t.node.currentStyle) {
  3743. if (t.node.currentStyle.height === '100%') {
  3744. t.node.currentStyle.height = 'auto';
  3745. }
  3746. if (t.node.currentStyle.maxWidth === '100%') {
  3747. t.node.currentStyle.maxWidth = 'none';
  3748. }
  3749. if (t.node.currentStyle.maxHeight === '100%') {
  3750. t.node.currentStyle.maxHeight = 'none';
  3751. }
  3752. }
  3753. if (!isIframe && !parseFloat(parentStyles.width)) {
  3754. parent.style.width = t.media.offsetWidth + 'px';
  3755. }
  3756. if (!isIframe && !parseFloat(parentStyles.height)) {
  3757. parent.style.height = t.media.offsetHeight + 'px';
  3758. }
  3759. parentStyles = getComputedStyle(parent);
  3760. var parentWidth = parseFloat(parentStyles.width),
  3761. parentHeight = parseFloat(parentStyles.height);
  3762. t.setDimensions('100%', '100%');
  3763. var poster = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'poster>img');
  3764. if (poster) {
  3765. poster.style.display = '';
  3766. }
  3767. var targetElement = t.getElement(t.container).querySelectorAll('object, embed, iframe, video'),
  3768. initHeight = t.height,
  3769. initWidth = t.width,
  3770. scaleX1 = parentWidth,
  3771. scaleY1 = initHeight * parentWidth / initWidth,
  3772. scaleX2 = initWidth * parentHeight / initHeight,
  3773. scaleY2 = parentHeight,
  3774. bScaleOnWidth = scaleX2 > parentWidth === false,
  3775. finalWidth = bScaleOnWidth ? Math.floor(scaleX1) : Math.floor(scaleX2),
  3776. finalHeight = bScaleOnWidth ? Math.floor(scaleY1) : Math.floor(scaleY2),
  3777. width = bScaleOnWidth ? parentWidth + 'px' : finalWidth + 'px',
  3778. height = bScaleOnWidth ? finalHeight + 'px' : parentHeight + 'px';
  3779. for (var i = 0, total = targetElement.length; i < total; i++) {
  3780. targetElement[i].style.height = height;
  3781. targetElement[i].style.width = width;
  3782. if (t.media.setSize) {
  3783. t.media.setSize(width, height);
  3784. }
  3785. targetElement[i].style.marginLeft = Math.floor((parentWidth - finalWidth) / 2) + 'px';
  3786. targetElement[i].style.marginTop = 0;
  3787. }
  3788. }
  3789. }, {
  3790. key: 'setDimensions',
  3791. value: function setDimensions(width, height) {
  3792. var t = this;
  3793. width = (0, _general.isString)(width) && width.indexOf('%') > -1 ? width : parseFloat(width) + 'px';
  3794. height = (0, _general.isString)(height) && height.indexOf('%') > -1 ? height : parseFloat(height) + 'px';
  3795. t.getElement(t.container).style.width = width;
  3796. t.getElement(t.container).style.height = height;
  3797. var layers = t.getElement(t.layers).children;
  3798. for (var i = 0, total = layers.length; i < total; i++) {
  3799. layers[i].style.width = width;
  3800. layers[i].style.height = height;
  3801. }
  3802. }
  3803. }, {
  3804. key: 'setControlsSize',
  3805. value: function setControlsSize() {
  3806. var t = this;
  3807. if (!dom.visible(t.getElement(t.container))) {
  3808. return;
  3809. }
  3810. if (t.rail && dom.visible(t.rail)) {
  3811. var totalStyles = t.total ? getComputedStyle(t.total, null) : null,
  3812. totalMargin = totalStyles ? parseFloat(totalStyles.marginLeft) + parseFloat(totalStyles.marginRight) : 0,
  3813. railStyles = getComputedStyle(t.rail),
  3814. railMargin = parseFloat(railStyles.marginLeft) + parseFloat(railStyles.marginRight);
  3815. var siblingsWidth = 0;
  3816. var siblings = dom.siblings(t.rail, function (el) {
  3817. return el !== t.rail;
  3818. }),
  3819. total = siblings.length;
  3820. for (var i = 0; i < total; i++) {
  3821. siblingsWidth += siblings[i].offsetWidth;
  3822. }
  3823. siblingsWidth += totalMargin + (totalMargin === 0 ? railMargin * 2 : railMargin) + 1;
  3824. t.getElement(t.container).style.minWidth = siblingsWidth + 'px';
  3825. var event = (0, _general.createEvent)('controlsresize', t.getElement(t.container));
  3826. t.getElement(t.container).dispatchEvent(event);
  3827. } else {
  3828. var children = t.getElement(t.controls).children;
  3829. var minWidth = 0;
  3830. for (var _i = 0, _total = children.length; _i < _total; _i++) {
  3831. minWidth += children[_i].offsetWidth;
  3832. }
  3833. t.getElement(t.container).style.minWidth = minWidth + 'px';
  3834. }
  3835. }
  3836. }, {
  3837. key: 'addControlElement',
  3838. value: function addControlElement(element, key) {
  3839. var t = this;
  3840. if (t.featurePosition[key] !== undefined) {
  3841. var child = t.getElement(t.controls).children[t.featurePosition[key] - 1];
  3842. child.parentNode.insertBefore(element, child.nextSibling);
  3843. } else {
  3844. t.getElement(t.controls).appendChild(element);
  3845. var children = t.getElement(t.controls).children;
  3846. for (var i = 0, total = children.length; i < total; i++) {
  3847. if (element === children[i]) {
  3848. t.featurePosition[key] = i;
  3849. break;
  3850. }
  3851. }
  3852. }
  3853. }
  3854. }, {
  3855. key: 'createIframeLayer',
  3856. value: function createIframeLayer() {
  3857. var t = this;
  3858. if (t.isVideo && t.media.rendererName !== null && t.media.rendererName.indexOf('iframe') > -1 && !_document2.default.getElementById(t.media.id + '-iframe-overlay')) {
  3859. var layer = _document2.default.createElement('div'),
  3860. target = _document2.default.getElementById(t.media.id + '_' + t.media.rendererName);
  3861. layer.id = t.media.id + '-iframe-overlay';
  3862. layer.className = t.options.classPrefix + 'iframe-overlay';
  3863. layer.addEventListener('click', function (e) {
  3864. if (t.options.clickToPlayPause) {
  3865. if (t.paused) {
  3866. t.play();
  3867. } else {
  3868. t.pause();
  3869. }
  3870. e.preventDefault();
  3871. e.stopPropagation();
  3872. }
  3873. });
  3874. target.parentNode.insertBefore(layer, target);
  3875. }
  3876. }
  3877. }, {
  3878. key: 'resetSize',
  3879. value: function resetSize() {
  3880. var t = this;
  3881. setTimeout(function () {
  3882. t.setPlayerSize(t.width, t.height);
  3883. t.setControlsSize();
  3884. }, 50);
  3885. }
  3886. }, {
  3887. key: 'setPoster',
  3888. value: function setPoster(url) {
  3889. var t = this;
  3890. if (t.getElement(t.container)) {
  3891. var posterDiv = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'poster');
  3892. if (!posterDiv) {
  3893. posterDiv = _document2.default.createElement('div');
  3894. posterDiv.className = t.options.classPrefix + 'poster ' + t.options.classPrefix + 'layer';
  3895. t.getElement(t.layers).appendChild(posterDiv);
  3896. }
  3897. var posterImg = posterDiv.querySelector('img');
  3898. if (!posterImg && url) {
  3899. posterImg = _document2.default.createElement('img');
  3900. posterImg.className = t.options.classPrefix + 'poster-img';
  3901. posterImg.width = '100%';
  3902. posterImg.height = '100%';
  3903. posterDiv.style.display = '';
  3904. posterDiv.appendChild(posterImg);
  3905. }
  3906. if (url) {
  3907. posterImg.setAttribute('src', url);
  3908. posterDiv.style.backgroundImage = 'url("' + url + '")';
  3909. posterDiv.style.display = '';
  3910. } else if (posterImg) {
  3911. posterDiv.style.backgroundImage = 'none';
  3912. posterDiv.style.display = 'none';
  3913. posterImg.remove();
  3914. } else {
  3915. posterDiv.style.display = 'none';
  3916. }
  3917. } else if (_constants.IS_IPAD && t.options.iPadUseNativeControls || _constants.IS_IPHONE && t.options.iPhoneUseNativeControls || _constants.IS_ANDROID && t.options.AndroidUseNativeControls) {
  3918. t.media.originalNode.poster = url;
  3919. }
  3920. }
  3921. }, {
  3922. key: 'changeSkin',
  3923. value: function changeSkin(className) {
  3924. var t = this;
  3925. t.getElement(t.container).className = t.options.classPrefix + 'container ' + className;
  3926. t.setPlayerSize(t.width, t.height);
  3927. t.setControlsSize();
  3928. }
  3929. }, {
  3930. key: 'globalBind',
  3931. value: function globalBind(events, callback) {
  3932. var t = this,
  3933. doc = t.node ? t.node.ownerDocument : _document2.default;
  3934. events = (0, _general.splitEvents)(events, t.id);
  3935. if (events.d) {
  3936. var eventList = events.d.split(' ');
  3937. for (var i = 0, total = eventList.length; i < total; i++) {
  3938. eventList[i].split('.').reduce(function (part, e) {
  3939. doc.addEventListener(e, callback, false);
  3940. return e;
  3941. }, '');
  3942. }
  3943. }
  3944. if (events.w) {
  3945. var _eventList = events.w.split(' ');
  3946. for (var _i2 = 0, _total2 = _eventList.length; _i2 < _total2; _i2++) {
  3947. _eventList[_i2].split('.').reduce(function (part, e) {
  3948. _window2.default.addEventListener(e, callback, false);
  3949. return e;
  3950. }, '');
  3951. }
  3952. }
  3953. }
  3954. }, {
  3955. key: 'globalUnbind',
  3956. value: function globalUnbind(events, callback) {
  3957. var t = this,
  3958. doc = t.node ? t.node.ownerDocument : _document2.default;
  3959. events = (0, _general.splitEvents)(events, t.id);
  3960. if (events.d) {
  3961. var eventList = events.d.split(' ');
  3962. for (var i = 0, total = eventList.length; i < total; i++) {
  3963. eventList[i].split('.').reduce(function (part, e) {
  3964. doc.removeEventListener(e, callback, false);
  3965. return e;
  3966. }, '');
  3967. }
  3968. }
  3969. if (events.w) {
  3970. var _eventList2 = events.w.split(' ');
  3971. for (var _i3 = 0, _total3 = _eventList2.length; _i3 < _total3; _i3++) {
  3972. _eventList2[_i3].split('.').reduce(function (part, e) {
  3973. _window2.default.removeEventListener(e, callback, false);
  3974. return e;
  3975. }, '');
  3976. }
  3977. }
  3978. }
  3979. }, {
  3980. key: 'buildfeatures',
  3981. value: function buildfeatures(player, controls, layers, media) {
  3982. var t = this;
  3983. for (var i = 0, total = t.options.features.length; i < total; i++) {
  3984. var feature = t.options.features[i];
  3985. if (t['build' + feature]) {
  3986. try {
  3987. t['build' + feature](player, controls, layers, media);
  3988. } catch (e) {
  3989. console.error('error building ' + feature, e);
  3990. }
  3991. }
  3992. }
  3993. }
  3994. }, {
  3995. key: 'buildposter',
  3996. value: function buildposter(player, controls, layers, media) {
  3997. var t = this,
  3998. poster = _document2.default.createElement('div');
  3999. poster.className = t.options.classPrefix + 'poster ' + t.options.classPrefix + 'layer';
  4000. layers.appendChild(poster);
  4001. var posterUrl = media.originalNode.getAttribute('poster');
  4002. if (player.options.poster !== '') {
  4003. if (posterUrl && _constants.IS_IOS) {
  4004. media.originalNode.removeAttribute('poster');
  4005. }
  4006. posterUrl = player.options.poster;
  4007. }
  4008. if (posterUrl) {
  4009. t.setPoster(posterUrl);
  4010. } else if (t.media.renderer !== null && typeof t.media.renderer.getPosterUrl === 'function') {
  4011. t.setPoster(t.media.renderer.getPosterUrl());
  4012. } else {
  4013. poster.style.display = 'none';
  4014. }
  4015. media.addEventListener('play', function () {
  4016. poster.style.display = 'none';
  4017. });
  4018. media.addEventListener('playing', function () {
  4019. poster.style.display = 'none';
  4020. });
  4021. if (player.options.showPosterWhenEnded && player.options.autoRewind) {
  4022. media.addEventListener('ended', function () {
  4023. poster.style.display = '';
  4024. });
  4025. }
  4026. media.addEventListener('error', function () {
  4027. poster.style.display = 'none';
  4028. });
  4029. if (player.options.showPosterWhenPaused) {
  4030. media.addEventListener('pause', function () {
  4031. if (!player.ended) {
  4032. poster.style.display = '';
  4033. }
  4034. });
  4035. }
  4036. }
  4037. }, {
  4038. key: 'buildoverlays',
  4039. value: function buildoverlays(player, controls, layers, media) {
  4040. if (!player.isVideo) {
  4041. return;
  4042. }
  4043. var t = this,
  4044. loading = _document2.default.createElement('div'),
  4045. error = _document2.default.createElement('div'),
  4046. bigPlay = _document2.default.createElement('div');
  4047. loading.style.display = 'none';
  4048. loading.className = t.options.classPrefix + 'overlay ' + t.options.classPrefix + 'layer';
  4049. loading.innerHTML = '<div class="' + t.options.classPrefix + 'overlay-loading">' + ('<span class="' + t.options.classPrefix + 'overlay-loading-bg-img"></span>') + '</div>';
  4050. layers.appendChild(loading);
  4051. error.style.display = 'none';
  4052. error.className = t.options.classPrefix + 'overlay ' + t.options.classPrefix + 'layer';
  4053. error.innerHTML = '<div class="' + t.options.classPrefix + 'overlay-error"></div>';
  4054. layers.appendChild(error);
  4055. bigPlay.className = t.options.classPrefix + 'overlay ' + t.options.classPrefix + 'layer ' + t.options.classPrefix + 'overlay-play';
  4056. bigPlay.innerHTML = '<div class="' + t.options.classPrefix + 'overlay-button" role="button" tabindex="0" ' + ('aria-label="' + _i18n2.default.t('mejs.play') + '" aria-pressed="false"></div>');
  4057. bigPlay.addEventListener('click', function () {
  4058. if (t.options.clickToPlayPause) {
  4059. var button = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'overlay-button'),
  4060. pressed = button.getAttribute('aria-pressed');
  4061. if (t.paused) {
  4062. t.play();
  4063. } else {
  4064. t.pause();
  4065. }
  4066. button.setAttribute('aria-pressed', !!pressed);
  4067. t.getElement(t.container).focus();
  4068. }
  4069. });
  4070. bigPlay.addEventListener('keydown', function (e) {
  4071. var keyPressed = e.keyCode || e.which || 0;
  4072. if (keyPressed === 13 || _constants.IS_FIREFOX && keyPressed === 32) {
  4073. var event = (0, _general.createEvent)('click', bigPlay);
  4074. bigPlay.dispatchEvent(event);
  4075. return false;
  4076. }
  4077. });
  4078. layers.appendChild(bigPlay);
  4079. if (t.media.rendererName !== null && (/(youtube|facebook)/i.test(t.media.rendererName) && !(t.media.originalNode.getAttribute('poster') || player.options.poster || typeof t.media.renderer.getPosterUrl === 'function' && t.media.renderer.getPosterUrl()) || _constants.IS_STOCK_ANDROID || t.media.originalNode.getAttribute('autoplay'))) {
  4080. bigPlay.style.display = 'none';
  4081. }
  4082. var hasError = false;
  4083. media.addEventListener('play', function () {
  4084. bigPlay.style.display = 'none';
  4085. loading.style.display = 'none';
  4086. error.style.display = 'none';
  4087. hasError = false;
  4088. });
  4089. media.addEventListener('playing', function () {
  4090. bigPlay.style.display = 'none';
  4091. loading.style.display = 'none';
  4092. error.style.display = 'none';
  4093. hasError = false;
  4094. });
  4095. media.addEventListener('seeking', function () {
  4096. bigPlay.style.display = 'none';
  4097. loading.style.display = '';
  4098. hasError = false;
  4099. });
  4100. media.addEventListener('seeked', function () {
  4101. bigPlay.style.display = t.paused && !_constants.IS_STOCK_ANDROID ? '' : 'none';
  4102. loading.style.display = 'none';
  4103. hasError = false;
  4104. });
  4105. media.addEventListener('pause', function () {
  4106. loading.style.display = 'none';
  4107. if (!_constants.IS_STOCK_ANDROID && !hasError) {
  4108. bigPlay.style.display = '';
  4109. }
  4110. hasError = false;
  4111. });
  4112. media.addEventListener('waiting', function () {
  4113. loading.style.display = '';
  4114. hasError = false;
  4115. });
  4116. media.addEventListener('loadeddata', function () {
  4117. loading.style.display = '';
  4118. if (_constants.IS_ANDROID) {
  4119. media.canplayTimeout = setTimeout(function () {
  4120. if (_document2.default.createEvent) {
  4121. var evt = _document2.default.createEvent('HTMLEvents');
  4122. evt.initEvent('canplay', true, true);
  4123. return media.dispatchEvent(evt);
  4124. }
  4125. }, 300);
  4126. }
  4127. hasError = false;
  4128. });
  4129. media.addEventListener('canplay', function () {
  4130. loading.style.display = 'none';
  4131. clearTimeout(media.canplayTimeout);
  4132. hasError = false;
  4133. });
  4134. media.addEventListener('error', function (e) {
  4135. t._handleError(e, t.media, t.node);
  4136. loading.style.display = 'none';
  4137. bigPlay.style.display = 'none';
  4138. hasError = true;
  4139. });
  4140. media.addEventListener('loadedmetadata', function () {
  4141. if (!t.controlsEnabled) {
  4142. t.enableControls();
  4143. }
  4144. });
  4145. media.addEventListener('keydown', function (e) {
  4146. t.onkeydown(player, media, e);
  4147. hasError = false;
  4148. });
  4149. }
  4150. }, {
  4151. key: 'buildkeyboard',
  4152. value: function buildkeyboard(player, controls, layers, media) {
  4153. var t = this;
  4154. t.getElement(t.container).addEventListener('keydown', function () {
  4155. t.keyboardAction = true;
  4156. });
  4157. t.globalKeydownCallback = function (event) {
  4158. var container = _document2.default.activeElement.closest('.' + t.options.classPrefix + 'container'),
  4159. target = t.media.closest('.' + t.options.classPrefix + 'container');
  4160. t.hasFocus = !!(container && target && container.id === target.id);
  4161. return t.onkeydown(player, media, event);
  4162. };
  4163. t.globalClickCallback = function (event) {
  4164. t.hasFocus = !!event.target.closest('.' + t.options.classPrefix + 'container');
  4165. };
  4166. t.globalBind('keydown', t.globalKeydownCallback);
  4167. t.globalBind('click', t.globalClickCallback);
  4168. }
  4169. }, {
  4170. key: 'onkeydown',
  4171. value: function onkeydown(player, media, e) {
  4172. if (player.hasFocus && player.options.enableKeyboard) {
  4173. for (var i = 0, total = player.options.keyActions.length; i < total; i++) {
  4174. var keyAction = player.options.keyActions[i];
  4175. for (var j = 0, jl = keyAction.keys.length; j < jl; j++) {
  4176. if (e.keyCode === keyAction.keys[j]) {
  4177. keyAction.action(player, media, e.keyCode, e);
  4178. e.preventDefault();
  4179. e.stopPropagation();
  4180. return;
  4181. }
  4182. }
  4183. }
  4184. }
  4185. return true;
  4186. }
  4187. }, {
  4188. key: 'play',
  4189. value: function play() {
  4190. this.proxy.play();
  4191. }
  4192. }, {
  4193. key: 'pause',
  4194. value: function pause() {
  4195. this.proxy.pause();
  4196. }
  4197. }, {
  4198. key: 'load',
  4199. value: function load() {
  4200. this.proxy.load();
  4201. }
  4202. }, {
  4203. key: 'setCurrentTime',
  4204. value: function setCurrentTime(time) {
  4205. this.proxy.setCurrentTime(time);
  4206. }
  4207. }, {
  4208. key: 'getCurrentTime',
  4209. value: function getCurrentTime() {
  4210. return this.proxy.currentTime;
  4211. }
  4212. }, {
  4213. key: 'getDuration',
  4214. value: function getDuration() {
  4215. return this.proxy.duration;
  4216. }
  4217. }, {
  4218. key: 'setVolume',
  4219. value: function setVolume(volume) {
  4220. this.proxy.volume = volume;
  4221. }
  4222. }, {
  4223. key: 'getVolume',
  4224. value: function getVolume() {
  4225. return this.proxy.getVolume();
  4226. }
  4227. }, {
  4228. key: 'setMuted',
  4229. value: function setMuted(value) {
  4230. this.proxy.setMuted(value);
  4231. }
  4232. }, {
  4233. key: 'setSrc',
  4234. value: function setSrc(src) {
  4235. if (!this.controlsEnabled) {
  4236. this.enableControls();
  4237. }
  4238. this.proxy.setSrc(src);
  4239. }
  4240. }, {
  4241. key: 'getSrc',
  4242. value: function getSrc() {
  4243. return this.proxy.getSrc();
  4244. }
  4245. }, {
  4246. key: 'canPlayType',
  4247. value: function canPlayType(type) {
  4248. return this.proxy.canPlayType(type);
  4249. }
  4250. }, {
  4251. key: 'remove',
  4252. value: function remove() {
  4253. var t = this,
  4254. rendererName = t.media.rendererName,
  4255. src = t.media.originalNode.src;
  4256. for (var featureIndex in t.options.features) {
  4257. var feature = t.options.features[featureIndex];
  4258. if (t['clean' + feature]) {
  4259. try {
  4260. t['clean' + feature](t, t.getElement(t.layers), t.getElement(t.controls), t.media);
  4261. } catch (e) {
  4262. console.error('error cleaning ' + feature, e);
  4263. }
  4264. }
  4265. }
  4266. var nativeWidth = t.node.getAttribute('width'),
  4267. nativeHeight = t.node.getAttribute('height');
  4268. if (nativeWidth) {
  4269. if (nativeWidth.indexOf('%') === -1) {
  4270. nativeWidth = nativeWidth + 'px';
  4271. }
  4272. } else {
  4273. nativeWidth = 'auto';
  4274. }
  4275. if (nativeHeight) {
  4276. if (nativeHeight.indexOf('%') === -1) {
  4277. nativeHeight = nativeHeight + 'px';
  4278. }
  4279. } else {
  4280. nativeHeight = 'auto';
  4281. }
  4282. t.node.style.width = nativeWidth;
  4283. t.node.style.height = nativeHeight;
  4284. t.setPlayerSize(0, 0);
  4285. if (!t.isDynamic) {
  4286. (function () {
  4287. t.node.setAttribute('controls', true);
  4288. t.node.setAttribute('id', t.node.getAttribute('id').replace('_' + rendererName, '').replace('_from_mejs', ''));
  4289. var poster = t.getElement(t.container).querySelector('.' + t.options.classPrefix + 'poster>img');
  4290. if (poster) {
  4291. t.node.setAttribute('poster', poster.src);
  4292. }
  4293. delete t.node.autoplay;
  4294. t.node.setAttribute('src', '');
  4295. if (t.media.canPlayType((0, _media.getTypeFromFile)(src)) !== '') {
  4296. t.node.setAttribute('src', src);
  4297. }
  4298. if (rendererName && rendererName.indexOf('iframe') > -1) {
  4299. var layer = _document2.default.getElementById(t.media.id + '-iframe-overlay');
  4300. layer.remove();
  4301. }
  4302. var node = t.node.cloneNode();
  4303. node.style.display = '';
  4304. t.getElement(t.container).parentNode.insertBefore(node, t.getElement(t.container));
  4305. t.node.remove();
  4306. if (t.mediaFiles) {
  4307. for (var i = 0, total = t.mediaFiles.length; i < total; i++) {
  4308. var source = _document2.default.createElement('source');
  4309. source.setAttribute('src', t.mediaFiles[i].src);
  4310. source.setAttribute('type', t.mediaFiles[i].type);
  4311. node.appendChild(source);
  4312. }
  4313. }
  4314. if (t.trackFiles) {
  4315. var _loop3 = function _loop3(_i4, _total4) {
  4316. var track = t.trackFiles[_i4];
  4317. var newTrack = _document2.default.createElement('track');
  4318. newTrack.kind = track.kind;
  4319. newTrack.label = track.label;
  4320. newTrack.srclang = track.srclang;
  4321. newTrack.src = track.src;
  4322. node.appendChild(newTrack);
  4323. newTrack.addEventListener('load', function () {
  4324. this.mode = 'showing';
  4325. node.textTracks[_i4].mode = 'showing';
  4326. });
  4327. };
  4328. for (var _i4 = 0, _total4 = t.trackFiles.length; _i4 < _total4; _i4++) {
  4329. _loop3(_i4, _total4);
  4330. }
  4331. }
  4332. delete t.node;
  4333. delete t.mediaFiles;
  4334. delete t.trackFiles;
  4335. })();
  4336. } else {
  4337. t.getElement(t.container).parentNode.insertBefore(t.node, t.getElement(t.container));
  4338. }
  4339. if (t.media.renderer && typeof t.media.renderer.destroy === 'function') {
  4340. t.media.renderer.destroy();
  4341. }
  4342. delete _mejs2.default.players[t.id];
  4343. if (_typeof(t.getElement(t.container)) === 'object') {
  4344. var offscreen = t.getElement(t.container).parentNode.querySelector('.' + t.options.classPrefix + 'offscreen');
  4345. offscreen.remove();
  4346. t.getElement(t.container).remove();
  4347. }
  4348. t.globalUnbind('resize', t.globalResizeCallback);
  4349. t.globalUnbind('keydown', t.globalKeydownCallback);
  4350. t.globalUnbind('click', t.globalClickCallback);
  4351. delete t.media.player;
  4352. }
  4353. }, {
  4354. key: 'paused',
  4355. get: function get() {
  4356. return this.proxy.paused;
  4357. }
  4358. }, {
  4359. key: 'muted',
  4360. get: function get() {
  4361. return this.proxy.muted;
  4362. },
  4363. set: function set(muted) {
  4364. this.setMuted(muted);
  4365. }
  4366. }, {
  4367. key: 'ended',
  4368. get: function get() {
  4369. return this.proxy.ended;
  4370. }
  4371. }, {
  4372. key: 'readyState',
  4373. get: function get() {
  4374. return this.proxy.readyState;
  4375. }
  4376. }, {
  4377. key: 'currentTime',
  4378. set: function set(time) {
  4379. this.setCurrentTime(time);
  4380. },
  4381. get: function get() {
  4382. return this.getCurrentTime();
  4383. }
  4384. }, {
  4385. key: 'duration',
  4386. get: function get() {
  4387. return this.getDuration();
  4388. }
  4389. }, {
  4390. key: 'volume',
  4391. set: function set(volume) {
  4392. this.setVolume(volume);
  4393. },
  4394. get: function get() {
  4395. return this.getVolume();
  4396. }
  4397. }, {
  4398. key: 'src',
  4399. set: function set(src) {
  4400. this.setSrc(src);
  4401. },
  4402. get: function get() {
  4403. return this.getSrc();
  4404. }
  4405. }]);
  4406. return MediaElementPlayer;
  4407. }();
  4408. _window2.default.MediaElementPlayer = MediaElementPlayer;
  4409. _mejs2.default.MediaElementPlayer = MediaElementPlayer;
  4410. exports.default = MediaElementPlayer;
  4411. },{"17":17,"2":2,"25":25,"26":26,"27":27,"28":28,"3":3,"30":30,"5":5,"6":6,"7":7}],17:[function(_dereq_,module,exports){
  4412. 'use strict';
  4413. Object.defineProperty(exports, "__esModule", {
  4414. value: true
  4415. });
  4416. 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; }; }();
  4417. var _window = _dereq_(3);
  4418. var _window2 = _interopRequireDefault(_window);
  4419. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4420. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4421. var DefaultPlayer = function () {
  4422. function DefaultPlayer(player) {
  4423. _classCallCheck(this, DefaultPlayer);
  4424. this.media = player.media;
  4425. this.isVideo = player.isVideo;
  4426. this.classPrefix = player.options.classPrefix;
  4427. this.createIframeLayer = function () {
  4428. return player.createIframeLayer();
  4429. };
  4430. this.setPoster = function (url) {
  4431. return player.setPoster(url);
  4432. };
  4433. return this;
  4434. }
  4435. _createClass(DefaultPlayer, [{
  4436. key: 'play',
  4437. value: function play() {
  4438. this.media.play();
  4439. }
  4440. }, {
  4441. key: 'pause',
  4442. value: function pause() {
  4443. this.media.pause();
  4444. }
  4445. }, {
  4446. key: 'load',
  4447. value: function load() {
  4448. var t = this;
  4449. if (!t.isLoaded) {
  4450. t.media.load();
  4451. }
  4452. t.isLoaded = true;
  4453. }
  4454. }, {
  4455. key: 'setCurrentTime',
  4456. value: function setCurrentTime(time) {
  4457. this.media.setCurrentTime(time);
  4458. }
  4459. }, {
  4460. key: 'getCurrentTime',
  4461. value: function getCurrentTime() {
  4462. return this.media.currentTime;
  4463. }
  4464. }, {
  4465. key: 'getDuration',
  4466. value: function getDuration() {
  4467. return this.media.getDuration();
  4468. }
  4469. }, {
  4470. key: 'setVolume',
  4471. value: function setVolume(volume) {
  4472. this.media.setVolume(volume);
  4473. }
  4474. }, {
  4475. key: 'getVolume',
  4476. value: function getVolume() {
  4477. return this.media.getVolume();
  4478. }
  4479. }, {
  4480. key: 'setMuted',
  4481. value: function setMuted(value) {
  4482. this.media.setMuted(value);
  4483. }
  4484. }, {
  4485. key: 'setSrc',
  4486. value: function setSrc(src) {
  4487. var t = this,
  4488. layer = document.getElementById(t.media.id + '-iframe-overlay');
  4489. if (layer) {
  4490. layer.remove();
  4491. }
  4492. t.media.setSrc(src);
  4493. t.createIframeLayer();
  4494. if (t.media.renderer !== null && typeof t.media.renderer.getPosterUrl === 'function') {
  4495. t.setPoster(t.media.renderer.getPosterUrl());
  4496. }
  4497. }
  4498. }, {
  4499. key: 'getSrc',
  4500. value: function getSrc() {
  4501. return this.media.getSrc();
  4502. }
  4503. }, {
  4504. key: 'canPlayType',
  4505. value: function canPlayType(type) {
  4506. return this.media.canPlayType(type);
  4507. }
  4508. }, {
  4509. key: 'paused',
  4510. get: function get() {
  4511. return this.media.paused;
  4512. }
  4513. }, {
  4514. key: 'muted',
  4515. set: function set(muted) {
  4516. this.setMuted(muted);
  4517. },
  4518. get: function get() {
  4519. return this.media.muted;
  4520. }
  4521. }, {
  4522. key: 'ended',
  4523. get: function get() {
  4524. return this.media.ended;
  4525. }
  4526. }, {
  4527. key: 'readyState',
  4528. get: function get() {
  4529. return this.media.readyState;
  4530. }
  4531. }, {
  4532. key: 'currentTime',
  4533. set: function set(time) {
  4534. this.setCurrentTime(time);
  4535. },
  4536. get: function get() {
  4537. return this.getCurrentTime();
  4538. }
  4539. }, {
  4540. key: 'duration',
  4541. get: function get() {
  4542. return this.getDuration();
  4543. }
  4544. }, {
  4545. key: 'remainingTime',
  4546. get: function get() {
  4547. return this.getDuration() - this.currentTime();
  4548. }
  4549. }, {
  4550. key: 'volume',
  4551. set: function set(volume) {
  4552. this.setVolume(volume);
  4553. },
  4554. get: function get() {
  4555. return this.getVolume();
  4556. }
  4557. }, {
  4558. key: 'src',
  4559. set: function set(src) {
  4560. this.setSrc(src);
  4561. },
  4562. get: function get() {
  4563. return this.getSrc();
  4564. }
  4565. }]);
  4566. return DefaultPlayer;
  4567. }();
  4568. exports.default = DefaultPlayer;
  4569. _window2.default.DefaultPlayer = DefaultPlayer;
  4570. },{"3":3}],18:[function(_dereq_,module,exports){
  4571. 'use strict';
  4572. var _window = _dereq_(3);
  4573. var _window2 = _interopRequireDefault(_window);
  4574. var _mejs = _dereq_(7);
  4575. var _mejs2 = _interopRequireDefault(_mejs);
  4576. var _player = _dereq_(16);
  4577. var _player2 = _interopRequireDefault(_player);
  4578. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4579. if (typeof jQuery !== 'undefined') {
  4580. _mejs2.default.$ = _window2.default.jQuery = _window2.default.$ = jQuery;
  4581. } else if (typeof Zepto !== 'undefined') {
  4582. _mejs2.default.$ = _window2.default.Zepto = _window2.default.$ = Zepto;
  4583. } else if (typeof ender !== 'undefined') {
  4584. _mejs2.default.$ = _window2.default.ender = _window2.default.$ = ender;
  4585. }
  4586. (function ($) {
  4587. if (typeof $ !== 'undefined') {
  4588. $.fn.mediaelementplayer = function (options) {
  4589. if (options === false) {
  4590. this.each(function () {
  4591. var player = $(this).data('mediaelementplayer');
  4592. if (player) {
  4593. player.remove();
  4594. }
  4595. $(this).removeData('mediaelementplayer');
  4596. });
  4597. } else {
  4598. this.each(function () {
  4599. $(this).data('mediaelementplayer', new _player2.default(this, options));
  4600. });
  4601. }
  4602. return this;
  4603. };
  4604. $(document).ready(function () {
  4605. $('.' + _mejs2.default.MepDefaults.classPrefix + 'player').mediaelementplayer();
  4606. });
  4607. }
  4608. })(_mejs2.default.$);
  4609. },{"16":16,"3":3,"7":7}],19:[function(_dereq_,module,exports){
  4610. 'use strict';
  4611. 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; };
  4612. var _window = _dereq_(3);
  4613. var _window2 = _interopRequireDefault(_window);
  4614. var _mejs = _dereq_(7);
  4615. var _mejs2 = _interopRequireDefault(_mejs);
  4616. var _renderer = _dereq_(8);
  4617. var _general = _dereq_(27);
  4618. var _media = _dereq_(28);
  4619. var _constants = _dereq_(25);
  4620. var _dom = _dereq_(26);
  4621. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4622. var NativeDash = {
  4623. promise: null,
  4624. load: function load(settings) {
  4625. if (typeof dashjs !== 'undefined') {
  4626. NativeDash.promise = new Promise(function (resolve) {
  4627. resolve();
  4628. }).then(function () {
  4629. NativeDash._createPlayer(settings);
  4630. });
  4631. } else {
  4632. settings.options.path = typeof settings.options.path === 'string' ? settings.options.path : 'https://cdn.dashjs.org/latest/dash.all.min.js';
  4633. NativeDash.promise = NativeDash.promise || (0, _dom.loadScript)(settings.options.path);
  4634. NativeDash.promise.then(function () {
  4635. NativeDash._createPlayer(settings);
  4636. });
  4637. }
  4638. return NativeDash.promise;
  4639. },
  4640. _createPlayer: function _createPlayer(settings) {
  4641. var player = dashjs.MediaPlayer().create();
  4642. _window2.default['__ready__' + settings.id](player);
  4643. return player;
  4644. }
  4645. };
  4646. var DashNativeRenderer = {
  4647. name: 'native_dash',
  4648. options: {
  4649. prefix: 'native_dash',
  4650. dash: {
  4651. path: 'https://cdn.dashjs.org/latest/dash.all.min.js',
  4652. debug: false,
  4653. drm: {},
  4654. robustnessLevel: ''
  4655. }
  4656. },
  4657. canPlayType: function canPlayType(type) {
  4658. return _constants.HAS_MSE && ['application/dash+xml'].indexOf(type.toLowerCase()) > -1;
  4659. },
  4660. create: function create(mediaElement, options, mediaFiles) {
  4661. var originalNode = mediaElement.originalNode,
  4662. id = mediaElement.id + '_' + options.prefix,
  4663. autoplay = originalNode.autoplay,
  4664. children = originalNode.children;
  4665. var node = null,
  4666. dashPlayer = null;
  4667. originalNode.removeAttribute('type');
  4668. for (var i = 0, total = children.length; i < total; i++) {
  4669. children[i].removeAttribute('type');
  4670. }
  4671. node = originalNode.cloneNode(true);
  4672. options = Object.assign(options, mediaElement.options);
  4673. var props = _mejs2.default.html5media.properties,
  4674. events = _mejs2.default.html5media.events.concat(['click', 'mouseover', 'mouseout']).filter(function (e) {
  4675. return e !== 'error';
  4676. }),
  4677. attachNativeEvents = function attachNativeEvents(e) {
  4678. var event = (0, _general.createEvent)(e.type, mediaElement);
  4679. mediaElement.dispatchEvent(event);
  4680. },
  4681. assignGettersSetters = function assignGettersSetters(propName) {
  4682. var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1);
  4683. node['get' + capName] = function () {
  4684. return dashPlayer !== null ? node[propName] : null;
  4685. };
  4686. node['set' + capName] = function (value) {
  4687. if (_mejs2.default.html5media.readOnlyProperties.indexOf(propName) === -1) {
  4688. if (propName === 'src') {
  4689. var source = (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value.src ? value.src : value;
  4690. node[propName] = source;
  4691. if (dashPlayer !== null) {
  4692. dashPlayer.reset();
  4693. for (var _i = 0, _total = events.length; _i < _total; _i++) {
  4694. node.removeEventListener(events[_i], attachNativeEvents);
  4695. }
  4696. dashPlayer = NativeDash._createPlayer({
  4697. options: options.dash,
  4698. id: id
  4699. });
  4700. if (value && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && _typeof(value.drm) === 'object') {
  4701. dashPlayer.setProtectionData(value.drm);
  4702. if ((0, _general.isString)(options.dash.robustnessLevel) && options.dash.robustnessLevel) {
  4703. dashPlayer.getProtectionController().setRobustnessLevel(options.dash.robustnessLevel);
  4704. }
  4705. }
  4706. dashPlayer.attachSource(source);
  4707. if (autoplay) {
  4708. dashPlayer.play();
  4709. }
  4710. }
  4711. } else {
  4712. node[propName] = value;
  4713. }
  4714. }
  4715. };
  4716. };
  4717. for (var _i2 = 0, _total2 = props.length; _i2 < _total2; _i2++) {
  4718. assignGettersSetters(props[_i2]);
  4719. }
  4720. _window2.default['__ready__' + id] = function (_dashPlayer) {
  4721. mediaElement.dashPlayer = dashPlayer = _dashPlayer;
  4722. var dashEvents = dashjs.MediaPlayer.events,
  4723. assignEvents = function assignEvents(eventName) {
  4724. if (eventName === 'loadedmetadata') {
  4725. dashPlayer.getDebug().setLogToBrowserConsole(options.dash.debug);
  4726. dashPlayer.initialize();
  4727. dashPlayer.setScheduleWhilePaused(false);
  4728. dashPlayer.setFastSwitchEnabled(true);
  4729. dashPlayer.attachView(node);
  4730. dashPlayer.setAutoPlay(false);
  4731. if (_typeof(options.dash.drm) === 'object' && !_mejs2.default.Utils.isObjectEmpty(options.dash.drm)) {
  4732. dashPlayer.setProtectionData(options.dash.drm);
  4733. if ((0, _general.isString)(options.dash.robustnessLevel) && options.dash.robustnessLevel) {
  4734. dashPlayer.getProtectionController().setRobustnessLevel(options.dash.robustnessLevel);
  4735. }
  4736. }
  4737. dashPlayer.attachSource(node.getSrc());
  4738. }
  4739. node.addEventListener(eventName, attachNativeEvents);
  4740. };
  4741. for (var _i3 = 0, _total3 = events.length; _i3 < _total3; _i3++) {
  4742. assignEvents(events[_i3]);
  4743. }
  4744. var assignMdashEvents = function assignMdashEvents(e) {
  4745. if (e.type.toLowerCase() === 'error') {
  4746. mediaElement.generateError(e.message, node.src);
  4747. console.error(e);
  4748. } else {
  4749. var _event = (0, _general.createEvent)(e.type, mediaElement);
  4750. _event.data = e;
  4751. mediaElement.dispatchEvent(_event);
  4752. }
  4753. };
  4754. for (var eventType in dashEvents) {
  4755. if (dashEvents.hasOwnProperty(eventType)) {
  4756. dashPlayer.on(dashEvents[eventType], function (e) {
  4757. return assignMdashEvents(e);
  4758. });
  4759. }
  4760. }
  4761. };
  4762. if (mediaFiles && mediaFiles.length > 0) {
  4763. for (var _i4 = 0, _total4 = mediaFiles.length; _i4 < _total4; _i4++) {
  4764. if (_renderer.renderer.renderers[options.prefix].canPlayType(mediaFiles[_i4].type)) {
  4765. node.setAttribute('src', mediaFiles[_i4].src);
  4766. if (typeof mediaFiles[_i4].drm !== 'undefined') {
  4767. options.dash.drm = mediaFiles[_i4].drm;
  4768. }
  4769. break;
  4770. }
  4771. }
  4772. }
  4773. node.setAttribute('id', id);
  4774. originalNode.parentNode.insertBefore(node, originalNode);
  4775. originalNode.autoplay = false;
  4776. originalNode.style.display = 'none';
  4777. node.setSize = function (width, height) {
  4778. node.style.width = width + 'px';
  4779. node.style.height = height + 'px';
  4780. return node;
  4781. };
  4782. node.hide = function () {
  4783. node.pause();
  4784. node.style.display = 'none';
  4785. return node;
  4786. };
  4787. node.show = function () {
  4788. node.style.display = '';
  4789. return node;
  4790. };
  4791. node.destroy = function () {
  4792. if (dashPlayer !== null) {
  4793. dashPlayer.reset();
  4794. }
  4795. };
  4796. var event = (0, _general.createEvent)('rendererready', node);
  4797. mediaElement.dispatchEvent(event);
  4798. mediaElement.promises.push(NativeDash.load({
  4799. options: options.dash,
  4800. id: id
  4801. }));
  4802. return node;
  4803. }
  4804. };
  4805. _media.typeChecks.push(function (url) {
  4806. return ~url.toLowerCase().indexOf('.mpd') ? 'application/dash+xml' : null;
  4807. });
  4808. _renderer.renderer.add(DashNativeRenderer);
  4809. },{"25":25,"26":26,"27":27,"28":28,"3":3,"7":7,"8":8}],20:[function(_dereq_,module,exports){
  4810. 'use strict';
  4811. Object.defineProperty(exports, "__esModule", {
  4812. value: true
  4813. });
  4814. exports.PluginDetector = undefined;
  4815. 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; };
  4816. var _window = _dereq_(3);
  4817. var _window2 = _interopRequireDefault(_window);
  4818. var _document = _dereq_(2);
  4819. var _document2 = _interopRequireDefault(_document);
  4820. var _mejs = _dereq_(7);
  4821. var _mejs2 = _interopRequireDefault(_mejs);
  4822. var _i18n = _dereq_(5);
  4823. var _i18n2 = _interopRequireDefault(_i18n);
  4824. var _renderer = _dereq_(8);
  4825. var _general = _dereq_(27);
  4826. var _constants = _dereq_(25);
  4827. var _media = _dereq_(28);
  4828. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4829. var PluginDetector = exports.PluginDetector = {
  4830. plugins: [],
  4831. hasPluginVersion: function hasPluginVersion(plugin, v) {
  4832. var pv = PluginDetector.plugins[plugin];
  4833. v[1] = v[1] || 0;
  4834. v[2] = v[2] || 0;
  4835. 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];
  4836. },
  4837. addPlugin: function addPlugin(p, pluginName, mimeType, activeX, axDetect) {
  4838. PluginDetector.plugins[p] = PluginDetector.detectPlugin(pluginName, mimeType, activeX, axDetect);
  4839. },
  4840. detectPlugin: function detectPlugin(pluginName, mimeType, activeX, axDetect) {
  4841. var version = [0, 0, 0],
  4842. description = void 0,
  4843. ax = void 0;
  4844. if (_constants.NAV.plugins !== null && _constants.NAV.plugins !== undefined && _typeof(_constants.NAV.plugins[pluginName]) === 'object') {
  4845. description = _constants.NAV.plugins[pluginName].description;
  4846. if (description && !(typeof _constants.NAV.mimeTypes !== 'undefined' && _constants.NAV.mimeTypes[mimeType] && !_constants.NAV.mimeTypes[mimeType].enabledPlugin)) {
  4847. version = description.replace(pluginName, '').replace(/^\s+/, '').replace(/\sr/gi, '.').split('.');
  4848. for (var i = 0, total = version.length; i < total; i++) {
  4849. version[i] = parseInt(version[i].match(/\d+/), 10);
  4850. }
  4851. }
  4852. } else if (_window2.default.ActiveXObject !== undefined) {
  4853. try {
  4854. ax = new ActiveXObject(activeX);
  4855. if (ax) {
  4856. version = axDetect(ax);
  4857. }
  4858. } catch (e) {
  4859. }
  4860. }
  4861. return version;
  4862. }
  4863. };
  4864. PluginDetector.addPlugin('flash', 'Shockwave Flash', 'application/x-shockwave-flash', 'ShockwaveFlash.ShockwaveFlash', function (ax) {
  4865. var version = [],
  4866. d = ax.GetVariable("$version");
  4867. if (d) {
  4868. d = d.split(" ")[1].split(",");
  4869. version = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
  4870. }
  4871. return version;
  4872. });
  4873. var FlashMediaElementRenderer = {
  4874. create: function create(mediaElement, options, mediaFiles) {
  4875. var flash = {};
  4876. var isActive = false;
  4877. flash.options = options;
  4878. flash.id = mediaElement.id + '_' + flash.options.prefix;
  4879. flash.mediaElement = mediaElement;
  4880. flash.flashState = {};
  4881. flash.flashApi = null;
  4882. flash.flashApiStack = [];
  4883. var props = _mejs2.default.html5media.properties,
  4884. assignGettersSetters = function assignGettersSetters(propName) {
  4885. flash.flashState[propName] = null;
  4886. var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1);
  4887. flash['get' + capName] = function () {
  4888. if (flash.flashApi !== null) {
  4889. if (typeof flash.flashApi['get_' + propName] === 'function') {
  4890. var value = flash.flashApi['get_' + propName]();
  4891. if (propName === 'buffered') {
  4892. return {
  4893. start: function start() {
  4894. return 0;
  4895. },
  4896. end: function end() {
  4897. return value;
  4898. },
  4899. length: 1
  4900. };
  4901. }
  4902. return value;
  4903. } else {
  4904. return null;
  4905. }
  4906. } else {
  4907. return null;
  4908. }
  4909. };
  4910. flash['set' + capName] = function (value) {
  4911. if (propName === 'src') {
  4912. value = (0, _media.absolutizeUrl)(value);
  4913. }
  4914. if (flash.flashApi !== null && flash.flashApi['set_' + propName] !== undefined) {
  4915. try {
  4916. flash.flashApi['set_' + propName](value);
  4917. } catch (e) {
  4918. }
  4919. } else {
  4920. flash.flashApiStack.push({
  4921. type: 'set',
  4922. propName: propName,
  4923. value: value
  4924. });
  4925. }
  4926. };
  4927. };
  4928. for (var i = 0, total = props.length; i < total; i++) {
  4929. assignGettersSetters(props[i]);
  4930. }
  4931. var methods = _mejs2.default.html5media.methods,
  4932. assignMethods = function assignMethods(methodName) {
  4933. flash[methodName] = function () {
  4934. if (isActive) {
  4935. if (flash.flashApi !== null) {
  4936. if (flash.flashApi['fire_' + methodName]) {
  4937. try {
  4938. flash.flashApi['fire_' + methodName]();
  4939. } catch (e) {
  4940. }
  4941. } else {
  4942. }
  4943. } else {
  4944. flash.flashApiStack.push({
  4945. type: 'call',
  4946. methodName: methodName
  4947. });
  4948. }
  4949. }
  4950. };
  4951. };
  4952. methods.push('stop');
  4953. for (var _i = 0, _total = methods.length; _i < _total; _i++) {
  4954. assignMethods(methods[_i]);
  4955. }
  4956. var initEvents = ['rendererready'];
  4957. for (var _i2 = 0, _total2 = initEvents.length; _i2 < _total2; _i2++) {
  4958. var event = (0, _general.createEvent)(initEvents[_i2], flash);
  4959. mediaElement.dispatchEvent(event);
  4960. }
  4961. _window2.default['__ready__' + flash.id] = function () {
  4962. flash.flashReady = true;
  4963. flash.flashApi = _document2.default.getElementById('__' + flash.id);
  4964. if (flash.flashApiStack.length) {
  4965. for (var _i3 = 0, _total3 = flash.flashApiStack.length; _i3 < _total3; _i3++) {
  4966. var stackItem = flash.flashApiStack[_i3];
  4967. if (stackItem.type === 'set') {
  4968. var propName = stackItem.propName,
  4969. capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1);
  4970. flash['set' + capName](stackItem.value);
  4971. } else if (stackItem.type === 'call') {
  4972. flash[stackItem.methodName]();
  4973. }
  4974. }
  4975. }
  4976. };
  4977. _window2.default['__event__' + flash.id] = function (eventName, message) {
  4978. var event = (0, _general.createEvent)(eventName, flash);
  4979. if (message) {
  4980. try {
  4981. event.data = JSON.parse(message);
  4982. event.details.data = JSON.parse(message);
  4983. } catch (e) {
  4984. event.message = message;
  4985. }
  4986. }
  4987. flash.mediaElement.dispatchEvent(event);
  4988. };
  4989. flash.flashWrapper = _document2.default.createElement('div');
  4990. if (['always', 'sameDomain'].indexOf(flash.options.shimScriptAccess) === -1) {
  4991. flash.options.shimScriptAccess = 'sameDomain';
  4992. }
  4993. var autoplay = mediaElement.originalNode.autoplay,
  4994. flashVars = ['uid=' + flash.id, 'autoplay=' + autoplay, 'allowScriptAccess=' + flash.options.shimScriptAccess, 'preload=' + (mediaElement.originalNode.getAttribute('preload') || '')],
  4995. isVideo = mediaElement.originalNode !== null && mediaElement.originalNode.tagName.toLowerCase() === 'video',
  4996. flashHeight = isVideo ? mediaElement.originalNode.height : 1,
  4997. flashWidth = isVideo ? mediaElement.originalNode.width : 1;
  4998. if (mediaElement.originalNode.getAttribute('src')) {
  4999. flashVars.push('src=' + mediaElement.originalNode.getAttribute('src'));
  5000. }
  5001. if (flash.options.enablePseudoStreaming === true) {
  5002. flashVars.push('pseudostreamstart=' + flash.options.pseudoStreamingStartQueryParam);
  5003. flashVars.push('pseudostreamtype=' + flash.options.pseudoStreamingType);
  5004. }
  5005. if (flash.options.streamDelimiter) {
  5006. flashVars.push('streamdelimiter=' + encodeURIComponent(flash.options.streamDelimiter));
  5007. }
  5008. if (flash.options.proxyType) {
  5009. flashVars.push('proxytype=' + flash.options.proxyType);
  5010. }
  5011. mediaElement.appendChild(flash.flashWrapper);
  5012. mediaElement.originalNode.style.display = 'none';
  5013. var settings = [];
  5014. if (_constants.IS_IE || _constants.IS_EDGE) {
  5015. var specialIEContainer = _document2.default.createElement('div');
  5016. flash.flashWrapper.appendChild(specialIEContainer);
  5017. if (_constants.IS_EDGE) {
  5018. settings = ['type="application/x-shockwave-flash"', 'data="' + flash.options.pluginPath + flash.options.filename + '"', 'id="__' + flash.id + '"', 'width="' + flashWidth + '"', 'height="' + flashHeight + '\'"'];
  5019. } else {
  5020. 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 + '"'];
  5021. }
  5022. if (!isVideo) {
  5023. settings.push('style="clip: rect(0 0 0 0); position: absolute;"');
  5024. }
  5025. 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>';
  5026. } else {
  5027. 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('&') + '"'];
  5028. if (isVideo) {
  5029. settings.push('width="' + flashWidth + '"');
  5030. settings.push('height="' + flashHeight + '"');
  5031. } else {
  5032. settings.push('style="position: fixed; left: -9999em; top: -9999em;"');
  5033. }
  5034. flash.flashWrapper.innerHTML = '<embed ' + settings.join(' ') + '>';
  5035. }
  5036. flash.flashNode = flash.flashWrapper.lastChild;
  5037. flash.hide = function () {
  5038. isActive = false;
  5039. if (isVideo) {
  5040. flash.flashNode.style.display = 'none';
  5041. }
  5042. };
  5043. flash.show = function () {
  5044. isActive = true;
  5045. if (isVideo) {
  5046. flash.flashNode.style.display = '';
  5047. }
  5048. };
  5049. flash.setSize = function (width, height) {
  5050. flash.flashNode.style.width = width + 'px';
  5051. flash.flashNode.style.height = height + 'px';
  5052. if (flash.flashApi !== null && typeof flash.flashApi.fire_setSize === 'function') {
  5053. flash.flashApi.fire_setSize(width, height);
  5054. }
  5055. };
  5056. flash.destroy = function () {
  5057. flash.flashNode.remove();
  5058. };
  5059. if (mediaFiles && mediaFiles.length > 0) {
  5060. for (var _i4 = 0, _total4 = mediaFiles.length; _i4 < _total4; _i4++) {
  5061. if (_renderer.renderer.renderers[options.prefix].canPlayType(mediaFiles[_i4].type)) {
  5062. flash.setSrc(mediaFiles[_i4].src);
  5063. break;
  5064. }
  5065. }
  5066. }
  5067. return flash;
  5068. }
  5069. };
  5070. var hasFlash = PluginDetector.hasPluginVersion('flash', [10, 0, 0]);
  5071. if (hasFlash) {
  5072. _media.typeChecks.push(function (url) {
  5073. url = url.toLowerCase();
  5074. if (url.startsWith('rtmp')) {
  5075. if (~url.indexOf('.mp3')) {
  5076. return 'audio/rtmp';
  5077. } else {
  5078. return 'video/rtmp';
  5079. }
  5080. } else if (/\.og(a|g)/i.test(url)) {
  5081. return 'audio/ogg';
  5082. } else if (~url.indexOf('.m3u8')) {
  5083. return 'application/x-mpegURL';
  5084. } else if (~url.indexOf('.mpd')) {
  5085. return 'application/dash+xml';
  5086. } else if (~url.indexOf('.flv')) {
  5087. return 'video/flv';
  5088. } else {
  5089. return null;
  5090. }
  5091. });
  5092. var FlashMediaElementVideoRenderer = {
  5093. name: 'flash_video',
  5094. options: {
  5095. prefix: 'flash_video',
  5096. filename: 'mediaelement-flash-video.swf',
  5097. enablePseudoStreaming: false,
  5098. pseudoStreamingStartQueryParam: 'start',
  5099. pseudoStreamingType: 'byte',
  5100. proxyType: '',
  5101. streamDelimiter: ''
  5102. },
  5103. canPlayType: function canPlayType(type) {
  5104. return ~['video/mp4', 'video/rtmp', 'audio/rtmp', 'rtmp/mp4', 'audio/mp4', 'video/flv', 'video/x-flv'].indexOf(type.toLowerCase());
  5105. },
  5106. create: FlashMediaElementRenderer.create
  5107. };
  5108. _renderer.renderer.add(FlashMediaElementVideoRenderer);
  5109. var FlashMediaElementHlsVideoRenderer = {
  5110. name: 'flash_hls',
  5111. options: {
  5112. prefix: 'flash_hls',
  5113. filename: 'mediaelement-flash-video-hls.swf'
  5114. },
  5115. canPlayType: function canPlayType(type) {
  5116. return ~['application/x-mpegurl', 'application/vnd.apple.mpegurl', 'audio/mpegurl', 'audio/hls', 'video/hls'].indexOf(type.toLowerCase());
  5117. },
  5118. create: FlashMediaElementRenderer.create
  5119. };
  5120. _renderer.renderer.add(FlashMediaElementHlsVideoRenderer);
  5121. var FlashMediaElementMdashVideoRenderer = {
  5122. name: 'flash_dash',
  5123. options: {
  5124. prefix: 'flash_dash',
  5125. filename: 'mediaelement-flash-video-mdash.swf'
  5126. },
  5127. canPlayType: function canPlayType(type) {
  5128. return ~['application/dash+xml'].indexOf(type.toLowerCase());
  5129. },
  5130. create: FlashMediaElementRenderer.create
  5131. };
  5132. _renderer.renderer.add(FlashMediaElementMdashVideoRenderer);
  5133. var FlashMediaElementAudioRenderer = {
  5134. name: 'flash_audio',
  5135. options: {
  5136. prefix: 'flash_audio',
  5137. filename: 'mediaelement-flash-audio.swf'
  5138. },
  5139. canPlayType: function canPlayType(type) {
  5140. return ~['audio/mp3'].indexOf(type.toLowerCase());
  5141. },
  5142. create: FlashMediaElementRenderer.create
  5143. };
  5144. _renderer.renderer.add(FlashMediaElementAudioRenderer);
  5145. var FlashMediaElementAudioOggRenderer = {
  5146. name: 'flash_audio_ogg',
  5147. options: {
  5148. prefix: 'flash_audio_ogg',
  5149. filename: 'mediaelement-flash-audio-ogg.swf'
  5150. },
  5151. canPlayType: function canPlayType(type) {
  5152. return ~['audio/ogg', 'audio/oga', 'audio/ogv'].indexOf(type.toLowerCase());
  5153. },
  5154. create: FlashMediaElementRenderer.create
  5155. };
  5156. _renderer.renderer.add(FlashMediaElementAudioOggRenderer);
  5157. }
  5158. },{"2":2,"25":25,"27":27,"28":28,"3":3,"5":5,"7":7,"8":8}],21:[function(_dereq_,module,exports){
  5159. 'use strict';
  5160. 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; };
  5161. var _window = _dereq_(3);
  5162. var _window2 = _interopRequireDefault(_window);
  5163. var _mejs = _dereq_(7);
  5164. var _mejs2 = _interopRequireDefault(_mejs);
  5165. var _renderer = _dereq_(8);
  5166. var _general = _dereq_(27);
  5167. var _constants = _dereq_(25);
  5168. var _media = _dereq_(28);
  5169. var _dom = _dereq_(26);
  5170. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5171. var NativeFlv = {
  5172. promise: null,
  5173. load: function load(settings) {
  5174. if (typeof flvjs !== 'undefined') {
  5175. NativeFlv.promise = new Promise(function (resolve) {
  5176. resolve();
  5177. }).then(function () {
  5178. NativeFlv._createPlayer(settings);
  5179. });
  5180. } else {
  5181. settings.options.path = typeof settings.options.path === 'string' ? settings.options.path : 'https://cdn.jsdelivr.net/npm/flv.js@latest';
  5182. NativeFlv.promise = NativeFlv.promise || (0, _dom.loadScript)(settings.options.path);
  5183. NativeFlv.promise.then(function () {
  5184. NativeFlv._createPlayer(settings);
  5185. });
  5186. }
  5187. return NativeFlv.promise;
  5188. },
  5189. _createPlayer: function _createPlayer(settings) {
  5190. flvjs.LoggingControl.enableDebug = settings.options.debug;
  5191. flvjs.LoggingControl.enableVerbose = settings.options.debug;
  5192. var player = flvjs.createPlayer(settings.options, settings.configs);
  5193. _window2.default['__ready__' + settings.id](player);
  5194. return player;
  5195. }
  5196. };
  5197. var FlvNativeRenderer = {
  5198. name: 'native_flv',
  5199. options: {
  5200. prefix: 'native_flv',
  5201. flv: {
  5202. path: 'https://cdn.jsdelivr.net/npm/flv.js@latest',
  5203. cors: true,
  5204. debug: false
  5205. }
  5206. },
  5207. canPlayType: function canPlayType(type) {
  5208. return _constants.HAS_MSE && ['video/x-flv', 'video/flv'].indexOf(type.toLowerCase()) > -1;
  5209. },
  5210. create: function create(mediaElement, options, mediaFiles) {
  5211. var originalNode = mediaElement.originalNode,
  5212. id = mediaElement.id + '_' + options.prefix;
  5213. var node = null,
  5214. flvPlayer = null;
  5215. node = originalNode.cloneNode(true);
  5216. options = Object.assign(options, mediaElement.options);
  5217. var props = _mejs2.default.html5media.properties,
  5218. events = _mejs2.default.html5media.events.concat(['click', 'mouseover', 'mouseout']).filter(function (e) {
  5219. return e !== 'error';
  5220. }),
  5221. attachNativeEvents = function attachNativeEvents(e) {
  5222. var event = (0, _general.createEvent)(e.type, mediaElement);
  5223. mediaElement.dispatchEvent(event);
  5224. },
  5225. assignGettersSetters = function assignGettersSetters(propName) {
  5226. var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1);
  5227. node['get' + capName] = function () {
  5228. return flvPlayer !== null ? node[propName] : null;
  5229. };
  5230. node['set' + capName] = function (value) {
  5231. if (_mejs2.default.html5media.readOnlyProperties.indexOf(propName) === -1) {
  5232. if (propName === 'src') {
  5233. node[propName] = (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value.src ? value.src : value;
  5234. if (flvPlayer !== null) {
  5235. var _flvOptions = {};
  5236. _flvOptions.type = 'flv';
  5237. _flvOptions.url = value;
  5238. _flvOptions.cors = options.flv.cors;
  5239. _flvOptions.debug = options.flv.debug;
  5240. _flvOptions.path = options.flv.path;
  5241. var _flvConfigs = options.flv.configs;
  5242. flvPlayer.destroy();
  5243. for (var i = 0, total = events.length; i < total; i++) {
  5244. node.removeEventListener(events[i], attachNativeEvents);
  5245. }
  5246. flvPlayer = NativeFlv._createPlayer({
  5247. options: _flvOptions,
  5248. configs: _flvConfigs,
  5249. id: id
  5250. });
  5251. flvPlayer.attachMediaElement(node);
  5252. flvPlayer.load();
  5253. }
  5254. } else {
  5255. node[propName] = value;
  5256. }
  5257. }
  5258. };
  5259. };
  5260. for (var i = 0, total = props.length; i < total; i++) {
  5261. assignGettersSetters(props[i]);
  5262. }
  5263. _window2.default['__ready__' + id] = function (_flvPlayer) {
  5264. mediaElement.flvPlayer = flvPlayer = _flvPlayer;
  5265. var flvEvents = flvjs.Events,
  5266. assignEvents = function assignEvents(eventName) {
  5267. if (eventName === 'loadedmetadata') {
  5268. flvPlayer.unload();
  5269. flvPlayer.detachMediaElement();
  5270. flvPlayer.attachMediaElement(node);
  5271. flvPlayer.load();
  5272. }
  5273. node.addEventListener(eventName, attachNativeEvents);
  5274. };
  5275. for (var _i = 0, _total = events.length; _i < _total; _i++) {
  5276. assignEvents(events[_i]);
  5277. }
  5278. var assignFlvEvents = function assignFlvEvents(name, data) {
  5279. if (name === 'error') {
  5280. var message = data[0] + ': ' + data[1] + ' ' + data[2].msg;
  5281. mediaElement.generateError(message, node.src);
  5282. } else {
  5283. var _event = (0, _general.createEvent)(name, mediaElement);
  5284. _event.data = data;
  5285. mediaElement.dispatchEvent(_event);
  5286. }
  5287. };
  5288. var _loop = function _loop(eventType) {
  5289. if (flvEvents.hasOwnProperty(eventType)) {
  5290. flvPlayer.on(flvEvents[eventType], function () {
  5291. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  5292. args[_key] = arguments[_key];
  5293. }
  5294. return assignFlvEvents(flvEvents[eventType], args);
  5295. });
  5296. }
  5297. };
  5298. for (var eventType in flvEvents) {
  5299. _loop(eventType);
  5300. }
  5301. };
  5302. if (mediaFiles && mediaFiles.length > 0) {
  5303. for (var _i2 = 0, _total2 = mediaFiles.length; _i2 < _total2; _i2++) {
  5304. if (_renderer.renderer.renderers[options.prefix].canPlayType(mediaFiles[_i2].type)) {
  5305. node.setAttribute('src', mediaFiles[_i2].src);
  5306. break;
  5307. }
  5308. }
  5309. }
  5310. node.setAttribute('id', id);
  5311. originalNode.parentNode.insertBefore(node, originalNode);
  5312. originalNode.autoplay = false;
  5313. originalNode.style.display = 'none';
  5314. var flvOptions = {};
  5315. flvOptions.type = 'flv';
  5316. flvOptions.url = node.src;
  5317. flvOptions.cors = options.flv.cors;
  5318. flvOptions.debug = options.flv.debug;
  5319. flvOptions.path = options.flv.path;
  5320. var flvConfigs = options.flv.configs;
  5321. node.setSize = function (width, height) {
  5322. node.style.width = width + 'px';
  5323. node.style.height = height + 'px';
  5324. return node;
  5325. };
  5326. node.hide = function () {
  5327. if (flvPlayer !== null) {
  5328. flvPlayer.pause();
  5329. }
  5330. node.style.display = 'none';
  5331. return node;
  5332. };
  5333. node.show = function () {
  5334. node.style.display = '';
  5335. return node;
  5336. };
  5337. node.destroy = function () {
  5338. if (flvPlayer !== null) {
  5339. flvPlayer.destroy();
  5340. }
  5341. };
  5342. var event = (0, _general.createEvent)('rendererready', node);
  5343. mediaElement.dispatchEvent(event);
  5344. mediaElement.promises.push(NativeFlv.load({
  5345. options: flvOptions,
  5346. configs: flvConfigs,
  5347. id: id
  5348. }));
  5349. return node;
  5350. }
  5351. };
  5352. _media.typeChecks.push(function (url) {
  5353. return ~url.toLowerCase().indexOf('.flv') ? 'video/flv' : null;
  5354. });
  5355. _renderer.renderer.add(FlvNativeRenderer);
  5356. },{"25":25,"26":26,"27":27,"28":28,"3":3,"7":7,"8":8}],22:[function(_dereq_,module,exports){
  5357. 'use strict';
  5358. 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; };
  5359. var _window = _dereq_(3);
  5360. var _window2 = _interopRequireDefault(_window);
  5361. var _mejs = _dereq_(7);
  5362. var _mejs2 = _interopRequireDefault(_mejs);
  5363. var _renderer = _dereq_(8);
  5364. var _general = _dereq_(27);
  5365. var _constants = _dereq_(25);
  5366. var _media = _dereq_(28);
  5367. var _dom = _dereq_(26);
  5368. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5369. var NativeHls = {
  5370. promise: null,
  5371. load: function load(settings) {
  5372. if (typeof Hls !== 'undefined') {
  5373. NativeHls.promise = new Promise(function (resolve) {
  5374. resolve();
  5375. }).then(function () {
  5376. NativeHls._createPlayer(settings);
  5377. });
  5378. } else {
  5379. settings.options.path = typeof settings.options.path === 'string' ? settings.options.path : 'https://cdn.jsdelivr.net/npm/hls.js@latest';
  5380. NativeHls.promise = NativeHls.promise || (0, _dom.loadScript)(settings.options.path);
  5381. NativeHls.promise.then(function () {
  5382. NativeHls._createPlayer(settings);
  5383. });
  5384. }
  5385. return NativeHls.promise;
  5386. },
  5387. _createPlayer: function _createPlayer(settings) {
  5388. var player = new Hls(settings.options);
  5389. _window2.default['__ready__' + settings.id](player);
  5390. return player;
  5391. }
  5392. };
  5393. var HlsNativeRenderer = {
  5394. name: 'native_hls',
  5395. options: {
  5396. prefix: 'native_hls',
  5397. hls: {
  5398. path: 'https://cdn.jsdelivr.net/npm/hls.js@latest',
  5399. autoStartLoad: false,
  5400. debug: false
  5401. }
  5402. },
  5403. canPlayType: function canPlayType(type) {
  5404. return _constants.HAS_MSE && ['application/x-mpegurl', 'application/vnd.apple.mpegurl', 'audio/mpegurl', 'audio/hls', 'video/hls'].indexOf(type.toLowerCase()) > -1;
  5405. },
  5406. create: function create(mediaElement, options, mediaFiles) {
  5407. var originalNode = mediaElement.originalNode,
  5408. id = mediaElement.id + '_' + options.prefix,
  5409. preload = originalNode.getAttribute('preload'),
  5410. autoplay = originalNode.autoplay;
  5411. var hlsPlayer = null,
  5412. node = null,
  5413. index = 0,
  5414. total = mediaFiles.length;
  5415. node = originalNode.cloneNode(true);
  5416. options = Object.assign(options, mediaElement.options);
  5417. options.hls.autoStartLoad = preload && preload !== 'none' || autoplay;
  5418. var props = _mejs2.default.html5media.properties,
  5419. events = _mejs2.default.html5media.events.concat(['click', 'mouseover', 'mouseout']).filter(function (e) {
  5420. return e !== 'error';
  5421. }),
  5422. attachNativeEvents = function attachNativeEvents(e) {
  5423. var event = (0, _general.createEvent)(e.type, mediaElement);
  5424. mediaElement.dispatchEvent(event);
  5425. },
  5426. assignGettersSetters = function assignGettersSetters(propName) {
  5427. var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1);
  5428. node['get' + capName] = function () {
  5429. return hlsPlayer !== null ? node[propName] : null;
  5430. };
  5431. node['set' + capName] = function (value) {
  5432. if (_mejs2.default.html5media.readOnlyProperties.indexOf(propName) === -1) {
  5433. if (propName === 'src') {
  5434. node[propName] = (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value.src ? value.src : value;
  5435. if (hlsPlayer !== null) {
  5436. hlsPlayer.destroy();
  5437. for (var i = 0, _total = events.length; i < _total; i++) {
  5438. node.removeEventListener(events[i], attachNativeEvents);
  5439. }
  5440. hlsPlayer = NativeHls._createPlayer({
  5441. options: options.hls,
  5442. id: id
  5443. });
  5444. hlsPlayer.loadSource(value);
  5445. hlsPlayer.attachMedia(node);
  5446. }
  5447. } else {
  5448. node[propName] = value;
  5449. }
  5450. }
  5451. };
  5452. };
  5453. for (var i = 0, _total2 = props.length; i < _total2; i++) {
  5454. assignGettersSetters(props[i]);
  5455. }
  5456. _window2.default['__ready__' + id] = function (_hlsPlayer) {
  5457. mediaElement.hlsPlayer = hlsPlayer = _hlsPlayer;
  5458. var hlsEvents = Hls.Events,
  5459. assignEvents = function assignEvents(eventName) {
  5460. if (eventName === 'loadedmetadata') {
  5461. var url = mediaElement.originalNode.src;
  5462. hlsPlayer.detachMedia();
  5463. hlsPlayer.loadSource(url);
  5464. hlsPlayer.attachMedia(node);
  5465. }
  5466. node.addEventListener(eventName, attachNativeEvents);
  5467. };
  5468. for (var _i = 0, _total3 = events.length; _i < _total3; _i++) {
  5469. assignEvents(events[_i]);
  5470. }
  5471. var recoverDecodingErrorDate = void 0,
  5472. recoverSwapAudioCodecDate = void 0;
  5473. var assignHlsEvents = function assignHlsEvents(name, data) {
  5474. if (name === 'hlsError') {
  5475. console.warn(data);
  5476. data = data[1];
  5477. if (data.fatal) {
  5478. switch (data.type) {
  5479. case 'mediaError':
  5480. var now = new Date().getTime();
  5481. if (!recoverDecodingErrorDate || now - recoverDecodingErrorDate > 3000) {
  5482. recoverDecodingErrorDate = new Date().getTime();
  5483. hlsPlayer.recoverMediaError();
  5484. } else if (!recoverSwapAudioCodecDate || now - recoverSwapAudioCodecDate > 3000) {
  5485. recoverSwapAudioCodecDate = new Date().getTime();
  5486. console.warn('Attempting to swap Audio Codec and recover from media error');
  5487. hlsPlayer.swapAudioCodec();
  5488. hlsPlayer.recoverMediaError();
  5489. } else {
  5490. var message = 'Cannot recover, last media error recovery failed';
  5491. mediaElement.generateError(message, node.src);
  5492. console.error(message);
  5493. }
  5494. break;
  5495. case 'networkError':
  5496. if (data.details === 'manifestLoadError') {
  5497. if (index < total && mediaFiles[index + 1] !== undefined) {
  5498. node.setSrc(mediaFiles[index++].src);
  5499. node.load();
  5500. node.play();
  5501. } else {
  5502. var _message = 'Network error';
  5503. mediaElement.generateError(_message, mediaFiles);
  5504. console.error(_message);
  5505. }
  5506. } else {
  5507. var _message2 = 'Network error';
  5508. mediaElement.generateError(_message2, mediaFiles);
  5509. console.error(_message2);
  5510. }
  5511. break;
  5512. default:
  5513. hlsPlayer.destroy();
  5514. break;
  5515. }
  5516. }
  5517. } else {
  5518. var _event = (0, _general.createEvent)(name, mediaElement);
  5519. _event.data = data;
  5520. mediaElement.dispatchEvent(_event);
  5521. }
  5522. };
  5523. var _loop = function _loop(eventType) {
  5524. if (hlsEvents.hasOwnProperty(eventType)) {
  5525. hlsPlayer.on(hlsEvents[eventType], function () {
  5526. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  5527. args[_key] = arguments[_key];
  5528. }
  5529. return assignHlsEvents(hlsEvents[eventType], args);
  5530. });
  5531. }
  5532. };
  5533. for (var eventType in hlsEvents) {
  5534. _loop(eventType);
  5535. }
  5536. };
  5537. if (total > 0) {
  5538. for (; index < total; index++) {
  5539. if (_renderer.renderer.renderers[options.prefix].canPlayType(mediaFiles[index].type)) {
  5540. node.setAttribute('src', mediaFiles[index].src);
  5541. break;
  5542. }
  5543. }
  5544. }
  5545. if (preload !== 'auto' && !autoplay) {
  5546. node.addEventListener('play', function () {
  5547. if (hlsPlayer !== null) {
  5548. hlsPlayer.startLoad();
  5549. }
  5550. });
  5551. node.addEventListener('pause', function () {
  5552. if (hlsPlayer !== null) {
  5553. hlsPlayer.stopLoad();
  5554. }
  5555. });
  5556. }
  5557. node.setAttribute('id', id);
  5558. originalNode.parentNode.insertBefore(node, originalNode);
  5559. originalNode.autoplay = false;
  5560. originalNode.style.display = 'none';
  5561. node.setSize = function (width, height) {
  5562. node.style.width = width + 'px';
  5563. node.style.height = height + 'px';
  5564. return node;
  5565. };
  5566. node.hide = function () {
  5567. node.pause();
  5568. node.style.display = 'none';
  5569. return node;
  5570. };
  5571. node.show = function () {
  5572. node.style.display = '';
  5573. return node;
  5574. };
  5575. node.destroy = function () {
  5576. if (hlsPlayer !== null) {
  5577. hlsPlayer.stopLoad();
  5578. hlsPlayer.destroy();
  5579. }
  5580. };
  5581. var event = (0, _general.createEvent)('rendererready', node);
  5582. mediaElement.dispatchEvent(event);
  5583. mediaElement.promises.push(NativeHls.load({
  5584. options: options.hls,
  5585. id: id
  5586. }));
  5587. return node;
  5588. }
  5589. };
  5590. _media.typeChecks.push(function (url) {
  5591. return ~url.toLowerCase().indexOf('.m3u8') ? 'application/x-mpegURL' : null;
  5592. });
  5593. _renderer.renderer.add(HlsNativeRenderer);
  5594. },{"25":25,"26":26,"27":27,"28":28,"3":3,"7":7,"8":8}],23:[function(_dereq_,module,exports){
  5595. 'use strict';
  5596. var _window = _dereq_(3);
  5597. var _window2 = _interopRequireDefault(_window);
  5598. var _document = _dereq_(2);
  5599. var _document2 = _interopRequireDefault(_document);
  5600. var _mejs = _dereq_(7);
  5601. var _mejs2 = _interopRequireDefault(_mejs);
  5602. var _renderer = _dereq_(8);
  5603. var _general = _dereq_(27);
  5604. var _constants = _dereq_(25);
  5605. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5606. var HtmlMediaElement = {
  5607. name: 'html5',
  5608. options: {
  5609. prefix: 'html5'
  5610. },
  5611. canPlayType: function canPlayType(type) {
  5612. var mediaElement = _document2.default.createElement('video');
  5613. 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) {
  5614. return 'yes';
  5615. } else if (mediaElement.canPlayType) {
  5616. return mediaElement.canPlayType(type.toLowerCase()).replace(/no/, '');
  5617. } else {
  5618. return '';
  5619. }
  5620. },
  5621. create: function create(mediaElement, options, mediaFiles) {
  5622. var id = mediaElement.id + '_' + options.prefix;
  5623. var isActive = false;
  5624. var node = null;
  5625. if (mediaElement.originalNode === undefined || mediaElement.originalNode === null) {
  5626. node = _document2.default.createElement('audio');
  5627. mediaElement.appendChild(node);
  5628. } else {
  5629. node = mediaElement.originalNode;
  5630. }
  5631. node.setAttribute('id', id);
  5632. var props = _mejs2.default.html5media.properties,
  5633. assignGettersSetters = function assignGettersSetters(propName) {
  5634. var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1);
  5635. node['get' + capName] = function () {
  5636. return node[propName];
  5637. };
  5638. node['set' + capName] = function (value) {
  5639. if (_mejs2.default.html5media.readOnlyProperties.indexOf(propName) === -1) {
  5640. node[propName] = value;
  5641. }
  5642. };
  5643. };
  5644. for (var i = 0, _total = props.length; i < _total; i++) {
  5645. assignGettersSetters(props[i]);
  5646. }
  5647. var events = _mejs2.default.html5media.events.concat(['click', 'mouseover', 'mouseout']).filter(function (e) {
  5648. return e !== 'error';
  5649. }),
  5650. assignEvents = function assignEvents(eventName) {
  5651. node.addEventListener(eventName, function (e) {
  5652. if (isActive) {
  5653. var _event = (0, _general.createEvent)(e.type, e.target);
  5654. mediaElement.dispatchEvent(_event);
  5655. }
  5656. });
  5657. };
  5658. for (var _i = 0, _total2 = events.length; _i < _total2; _i++) {
  5659. assignEvents(events[_i]);
  5660. }
  5661. node.setSize = function (width, height) {
  5662. node.style.width = width + 'px';
  5663. node.style.height = height + 'px';
  5664. return node;
  5665. };
  5666. node.hide = function () {
  5667. isActive = false;
  5668. node.style.display = 'none';
  5669. return node;
  5670. };
  5671. node.show = function () {
  5672. isActive = true;
  5673. node.style.display = '';
  5674. return node;
  5675. };
  5676. var index = 0,
  5677. total = mediaFiles.length;
  5678. if (total > 0) {
  5679. for (; index < total; index++) {
  5680. if (_renderer.renderer.renderers[options.prefix].canPlayType(mediaFiles[index].type)) {
  5681. node.setAttribute('src', mediaFiles[index].src);
  5682. break;
  5683. }
  5684. }
  5685. }
  5686. node.addEventListener('error', function (e) {
  5687. if (e.target.error.code === 4 && isActive) {
  5688. if (index < total && mediaFiles[index + 1] !== undefined) {
  5689. node.src = mediaFiles[index++].src;
  5690. node.load();
  5691. node.play();
  5692. } else {
  5693. mediaElement.generateError('Media error: Format(s) not supported or source(s) not found', mediaFiles);
  5694. }
  5695. }
  5696. });
  5697. var event = (0, _general.createEvent)('rendererready', node);
  5698. mediaElement.dispatchEvent(event);
  5699. return node;
  5700. }
  5701. };
  5702. _window2.default.HtmlMediaElement = _mejs2.default.HtmlMediaElement = HtmlMediaElement;
  5703. _renderer.renderer.add(HtmlMediaElement);
  5704. },{"2":2,"25":25,"27":27,"3":3,"7":7,"8":8}],24:[function(_dereq_,module,exports){
  5705. 'use strict';
  5706. var _window = _dereq_(3);
  5707. var _window2 = _interopRequireDefault(_window);
  5708. var _document = _dereq_(2);
  5709. var _document2 = _interopRequireDefault(_document);
  5710. var _mejs = _dereq_(7);
  5711. var _mejs2 = _interopRequireDefault(_mejs);
  5712. var _renderer = _dereq_(8);
  5713. var _general = _dereq_(27);
  5714. var _media = _dereq_(28);
  5715. var _dom = _dereq_(26);
  5716. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5717. var YouTubeApi = {
  5718. isIframeStarted: false,
  5719. isIframeLoaded: false,
  5720. iframeQueue: [],
  5721. enqueueIframe: function enqueueIframe(settings) {
  5722. YouTubeApi.isLoaded = typeof YT !== 'undefined' && YT.loaded;
  5723. if (YouTubeApi.isLoaded) {
  5724. YouTubeApi.createIframe(settings);
  5725. } else {
  5726. YouTubeApi.loadIframeApi();
  5727. YouTubeApi.iframeQueue.push(settings);
  5728. }
  5729. },
  5730. loadIframeApi: function loadIframeApi() {
  5731. if (!YouTubeApi.isIframeStarted) {
  5732. (0, _dom.loadScript)('https://www.youtube.com/player_api');
  5733. YouTubeApi.isIframeStarted = true;
  5734. }
  5735. },
  5736. iFrameReady: function iFrameReady() {
  5737. YouTubeApi.isLoaded = true;
  5738. YouTubeApi.isIframeLoaded = true;
  5739. while (YouTubeApi.iframeQueue.length > 0) {
  5740. var settings = YouTubeApi.iframeQueue.pop();
  5741. YouTubeApi.createIframe(settings);
  5742. }
  5743. },
  5744. createIframe: function createIframe(settings) {
  5745. return new YT.Player(settings.containerId, settings);
  5746. },
  5747. getYouTubeId: function getYouTubeId(url) {
  5748. var youTubeId = '';
  5749. if (url.indexOf('?') > 0) {
  5750. youTubeId = YouTubeApi.getYouTubeIdFromParam(url);
  5751. if (youTubeId === '') {
  5752. youTubeId = YouTubeApi.getYouTubeIdFromUrl(url);
  5753. }
  5754. } else {
  5755. youTubeId = YouTubeApi.getYouTubeIdFromUrl(url);
  5756. }
  5757. var id = youTubeId.substring(youTubeId.lastIndexOf('/') + 1);
  5758. youTubeId = id.split('?');
  5759. return youTubeId[0];
  5760. },
  5761. getYouTubeIdFromParam: function getYouTubeIdFromParam(url) {
  5762. if (url === undefined || url === null || !url.trim().length) {
  5763. return null;
  5764. }
  5765. var parts = url.split('?'),
  5766. parameters = parts[1].split('&');
  5767. var youTubeId = '';
  5768. for (var i = 0, total = parameters.length; i < total; i++) {
  5769. var paramParts = parameters[i].split('=');
  5770. if (paramParts[0] === 'v') {
  5771. youTubeId = paramParts[1];
  5772. break;
  5773. }
  5774. }
  5775. return youTubeId;
  5776. },
  5777. getYouTubeIdFromUrl: function getYouTubeIdFromUrl(url) {
  5778. if (url === undefined || url === null || !url.trim().length) {
  5779. return null;
  5780. }
  5781. var parts = url.split('?');
  5782. url = parts[0];
  5783. return url.substring(url.lastIndexOf('/') + 1);
  5784. },
  5785. getYouTubeNoCookieUrl: function getYouTubeNoCookieUrl(url) {
  5786. if (url === undefined || url === null || !url.trim().length || url.indexOf('//www.youtube') === -1) {
  5787. return url;
  5788. }
  5789. var parts = url.split('/');
  5790. parts[2] = parts[2].replace('.com', '-nocookie.com');
  5791. return parts.join('/');
  5792. }
  5793. };
  5794. var YouTubeIframeRenderer = {
  5795. name: 'youtube_iframe',
  5796. options: {
  5797. prefix: 'youtube_iframe',
  5798. youtube: {
  5799. autoplay: 0,
  5800. controls: 0,
  5801. disablekb: 1,
  5802. end: 0,
  5803. loop: 0,
  5804. modestbranding: 0,
  5805. playsinline: 0,
  5806. rel: 0,
  5807. showinfo: 0,
  5808. start: 0,
  5809. iv_load_policy: 3,
  5810. nocookie: false,
  5811. imageQuality: null
  5812. }
  5813. },
  5814. canPlayType: function canPlayType(type) {
  5815. return ~['video/youtube', 'video/x-youtube'].indexOf(type.toLowerCase());
  5816. },
  5817. create: function create(mediaElement, options, mediaFiles) {
  5818. var youtube = {},
  5819. apiStack = [],
  5820. readyState = 4;
  5821. var youTubeApi = null,
  5822. paused = true,
  5823. ended = false,
  5824. youTubeIframe = null,
  5825. volume = 1;
  5826. youtube.options = options;
  5827. youtube.id = mediaElement.id + '_' + options.prefix;
  5828. youtube.mediaElement = mediaElement;
  5829. var props = _mejs2.default.html5media.properties,
  5830. assignGettersSetters = function assignGettersSetters(propName) {
  5831. var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1);
  5832. youtube['get' + capName] = function () {
  5833. if (youTubeApi !== null) {
  5834. var value = null;
  5835. switch (propName) {
  5836. case 'currentTime':
  5837. return youTubeApi.getCurrentTime();
  5838. case 'duration':
  5839. return youTubeApi.getDuration();
  5840. case 'volume':
  5841. volume = youTubeApi.getVolume() / 100;
  5842. return volume;
  5843. case 'paused':
  5844. return paused;
  5845. case 'ended':
  5846. return ended;
  5847. case 'muted':
  5848. return youTubeApi.isMuted();
  5849. case 'buffered':
  5850. var percentLoaded = youTubeApi.getVideoLoadedFraction(),
  5851. duration = youTubeApi.getDuration();
  5852. return {
  5853. start: function start() {
  5854. return 0;
  5855. },
  5856. end: function end() {
  5857. return percentLoaded * duration;
  5858. },
  5859. length: 1
  5860. };
  5861. case 'src':
  5862. return youTubeApi.getVideoUrl();
  5863. case 'readyState':
  5864. return readyState;
  5865. }
  5866. return value;
  5867. } else {
  5868. return null;
  5869. }
  5870. };
  5871. youtube['set' + capName] = function (value) {
  5872. if (youTubeApi !== null) {
  5873. switch (propName) {
  5874. case 'src':
  5875. var url = typeof value === 'string' ? value : value[0].src,
  5876. _videoId = YouTubeApi.getYouTubeId(url);
  5877. if (mediaElement.originalNode.autoplay) {
  5878. youTubeApi.loadVideoById(_videoId);
  5879. } else {
  5880. youTubeApi.cueVideoById(_videoId);
  5881. }
  5882. break;
  5883. case 'currentTime':
  5884. youTubeApi.seekTo(value);
  5885. break;
  5886. case 'muted':
  5887. if (value) {
  5888. youTubeApi.mute();
  5889. } else {
  5890. youTubeApi.unMute();
  5891. }
  5892. setTimeout(function () {
  5893. var event = (0, _general.createEvent)('volumechange', youtube);
  5894. mediaElement.dispatchEvent(event);
  5895. }, 50);
  5896. break;
  5897. case 'volume':
  5898. volume = value;
  5899. youTubeApi.setVolume(value * 100);
  5900. setTimeout(function () {
  5901. var event = (0, _general.createEvent)('volumechange', youtube);
  5902. mediaElement.dispatchEvent(event);
  5903. }, 50);
  5904. break;
  5905. case 'readyState':
  5906. var event = (0, _general.createEvent)('canplay', youtube);
  5907. mediaElement.dispatchEvent(event);
  5908. break;
  5909. default:
  5910. break;
  5911. }
  5912. } else {
  5913. apiStack.push({ type: 'set', propName: propName, value: value });
  5914. }
  5915. };
  5916. };
  5917. for (var i = 0, total = props.length; i < total; i++) {
  5918. assignGettersSetters(props[i]);
  5919. }
  5920. var methods = _mejs2.default.html5media.methods,
  5921. assignMethods = function assignMethods(methodName) {
  5922. youtube[methodName] = function () {
  5923. if (youTubeApi !== null) {
  5924. switch (methodName) {
  5925. case 'play':
  5926. paused = false;
  5927. return youTubeApi.playVideo();
  5928. case 'pause':
  5929. paused = true;
  5930. return youTubeApi.pauseVideo();
  5931. case 'load':
  5932. return null;
  5933. }
  5934. } else {
  5935. apiStack.push({ type: 'call', methodName: methodName });
  5936. }
  5937. };
  5938. };
  5939. for (var _i = 0, _total = methods.length; _i < _total; _i++) {
  5940. assignMethods(methods[_i]);
  5941. }
  5942. var errorHandler = function errorHandler(error) {
  5943. var message = '';
  5944. switch (error.data) {
  5945. case 2:
  5946. 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.';
  5947. break;
  5948. case 5:
  5949. message = 'The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.';
  5950. break;
  5951. case 100:
  5952. message = 'The video requested was not found. Either video has been removed or has been marked as private.';
  5953. break;
  5954. case 101:
  5955. case 105:
  5956. message = 'The owner of the requested video does not allow it to be played in embedded players.';
  5957. break;
  5958. default:
  5959. message = 'Unknown error.';
  5960. break;
  5961. }
  5962. mediaElement.generateError('Code ' + error.data + ': ' + message, mediaFiles);
  5963. };
  5964. var youtubeContainer = _document2.default.createElement('div');
  5965. youtubeContainer.id = youtube.id;
  5966. if (youtube.options.youtube.nocookie) {
  5967. mediaElement.originalNode.src = YouTubeApi.getYouTubeNoCookieUrl(mediaFiles[0].src);
  5968. }
  5969. mediaElement.originalNode.parentNode.insertBefore(youtubeContainer, mediaElement.originalNode);
  5970. mediaElement.originalNode.style.display = 'none';
  5971. var isAudio = mediaElement.originalNode.tagName.toLowerCase() === 'audio',
  5972. height = isAudio ? '1' : mediaElement.originalNode.height,
  5973. width = isAudio ? '1' : mediaElement.originalNode.width,
  5974. videoId = YouTubeApi.getYouTubeId(mediaFiles[0].src),
  5975. youtubeSettings = {
  5976. id: youtube.id,
  5977. containerId: youtubeContainer.id,
  5978. videoId: videoId,
  5979. height: height,
  5980. width: width,
  5981. playerVars: Object.assign({
  5982. controls: 0,
  5983. rel: 0,
  5984. disablekb: 1,
  5985. showinfo: 0,
  5986. modestbranding: 0,
  5987. html5: 1,
  5988. iv_load_policy: 3
  5989. }, youtube.options.youtube),
  5990. origin: _window2.default.location.host,
  5991. events: {
  5992. onReady: function onReady(e) {
  5993. mediaElement.youTubeApi = youTubeApi = e.target;
  5994. mediaElement.youTubeState = {
  5995. paused: true,
  5996. ended: false
  5997. };
  5998. if (apiStack.length) {
  5999. for (var _i2 = 0, _total2 = apiStack.length; _i2 < _total2; _i2++) {
  6000. var stackItem = apiStack[_i2];
  6001. if (stackItem.type === 'set') {
  6002. var propName = stackItem.propName,
  6003. capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1);
  6004. youtube['set' + capName](stackItem.value);
  6005. } else if (stackItem.type === 'call') {
  6006. youtube[stackItem.methodName]();
  6007. }
  6008. }
  6009. }
  6010. youTubeIframe = youTubeApi.getIframe();
  6011. if (mediaElement.originalNode.muted) {
  6012. youTubeApi.mute();
  6013. }
  6014. var events = ['mouseover', 'mouseout'],
  6015. assignEvents = function assignEvents(e) {
  6016. var newEvent = (0, _general.createEvent)(e.type, youtube);
  6017. mediaElement.dispatchEvent(newEvent);
  6018. };
  6019. for (var _i3 = 0, _total3 = events.length; _i3 < _total3; _i3++) {
  6020. youTubeIframe.addEventListener(events[_i3], assignEvents, false);
  6021. }
  6022. var initEvents = ['rendererready', 'loadedmetadata', 'loadeddata', 'canplay'];
  6023. for (var _i4 = 0, _total4 = initEvents.length; _i4 < _total4; _i4++) {
  6024. var event = (0, _general.createEvent)(initEvents[_i4], youtube);
  6025. mediaElement.dispatchEvent(event);
  6026. }
  6027. },
  6028. onStateChange: function onStateChange(e) {
  6029. var events = [];
  6030. switch (e.data) {
  6031. case -1:
  6032. events = ['loadedmetadata'];
  6033. paused = true;
  6034. ended = false;
  6035. break;
  6036. case 0:
  6037. events = ['ended'];
  6038. paused = false;
  6039. ended = !youtube.options.youtube.loop;
  6040. if (!youtube.options.youtube.loop) {
  6041. youtube.stopInterval();
  6042. }
  6043. break;
  6044. case 1:
  6045. events = ['play', 'playing'];
  6046. paused = false;
  6047. ended = false;
  6048. youtube.startInterval();
  6049. break;
  6050. case 2:
  6051. events = ['pause'];
  6052. paused = true;
  6053. ended = false;
  6054. youtube.stopInterval();
  6055. break;
  6056. case 3:
  6057. events = ['progress'];
  6058. ended = false;
  6059. break;
  6060. case 5:
  6061. events = ['loadeddata', 'loadedmetadata', 'canplay'];
  6062. paused = true;
  6063. ended = false;
  6064. break;
  6065. }
  6066. for (var _i5 = 0, _total5 = events.length; _i5 < _total5; _i5++) {
  6067. var event = (0, _general.createEvent)(events[_i5], youtube);
  6068. mediaElement.dispatchEvent(event);
  6069. }
  6070. },
  6071. onError: function onError(e) {
  6072. return errorHandler(e);
  6073. }
  6074. }
  6075. };
  6076. if (isAudio || mediaElement.originalNode.hasAttribute('playsinline')) {
  6077. youtubeSettings.playerVars.playsinline = 1;
  6078. }
  6079. if (mediaElement.originalNode.controls) {
  6080. youtubeSettings.playerVars.controls = 1;
  6081. }
  6082. if (mediaElement.originalNode.autoplay) {
  6083. youtubeSettings.playerVars.autoplay = 1;
  6084. }
  6085. if (mediaElement.originalNode.loop) {
  6086. youtubeSettings.playerVars.loop = 1;
  6087. }
  6088. 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) {
  6089. youtubeSettings.playerVars.playlist = YouTubeApi.getYouTubeId(mediaElement.originalNode.src);
  6090. }
  6091. YouTubeApi.enqueueIframe(youtubeSettings);
  6092. youtube.onEvent = function (eventName, player, _youTubeState) {
  6093. if (_youTubeState !== null && _youTubeState !== undefined) {
  6094. mediaElement.youTubeState = _youTubeState;
  6095. }
  6096. };
  6097. youtube.setSize = function (width, height) {
  6098. if (youTubeApi !== null) {
  6099. youTubeApi.setSize(width, height);
  6100. }
  6101. };
  6102. youtube.hide = function () {
  6103. youtube.stopInterval();
  6104. youtube.pause();
  6105. if (youTubeIframe) {
  6106. youTubeIframe.style.display = 'none';
  6107. }
  6108. };
  6109. youtube.show = function () {
  6110. if (youTubeIframe) {
  6111. youTubeIframe.style.display = '';
  6112. }
  6113. };
  6114. youtube.destroy = function () {
  6115. youTubeApi.destroy();
  6116. };
  6117. youtube.interval = null;
  6118. youtube.startInterval = function () {
  6119. youtube.interval = setInterval(function () {
  6120. var event = (0, _general.createEvent)('timeupdate', youtube);
  6121. mediaElement.dispatchEvent(event);
  6122. }, 250);
  6123. };
  6124. youtube.stopInterval = function () {
  6125. if (youtube.interval) {
  6126. clearInterval(youtube.interval);
  6127. }
  6128. };
  6129. youtube.getPosterUrl = function () {
  6130. var quality = options.youtube.imageQuality,
  6131. resolutions = ['default', 'hqdefault', 'mqdefault', 'sddefault', 'maxresdefault'],
  6132. id = YouTubeApi.getYouTubeId(mediaElement.originalNode.src);
  6133. return quality && resolutions.indexOf(quality) > -1 && id ? 'https://img.youtube.com/vi/' + id + '/' + quality + '.jpg' : '';
  6134. };
  6135. return youtube;
  6136. }
  6137. };
  6138. _window2.default.onYouTubePlayerAPIReady = function () {
  6139. YouTubeApi.iFrameReady();
  6140. };
  6141. _media.typeChecks.push(function (url) {
  6142. return (/\/\/(www\.youtube|youtu\.?be)/i.test(url) ? 'video/x-youtube' : null
  6143. );
  6144. });
  6145. _renderer.renderer.add(YouTubeIframeRenderer);
  6146. },{"2":2,"26":26,"27":27,"28":28,"3":3,"7":7,"8":8}],25:[function(_dereq_,module,exports){
  6147. 'use strict';
  6148. Object.defineProperty(exports, "__esModule", {
  6149. value: true
  6150. });
  6151. 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;
  6152. var _window = _dereq_(3);
  6153. var _window2 = _interopRequireDefault(_window);
  6154. var _document = _dereq_(2);
  6155. var _document2 = _interopRequireDefault(_document);
  6156. var _mejs = _dereq_(7);
  6157. var _mejs2 = _interopRequireDefault(_mejs);
  6158. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6159. var NAV = exports.NAV = _window2.default.navigator;
  6160. var UA = exports.UA = NAV.userAgent.toLowerCase();
  6161. var IS_IPAD = exports.IS_IPAD = /ipad/i.test(UA) && !_window2.default.MSStream;
  6162. var IS_IPHONE = exports.IS_IPHONE = /iphone/i.test(UA) && !_window2.default.MSStream;
  6163. var IS_IPOD = exports.IS_IPOD = /ipod/i.test(UA) && !_window2.default.MSStream;
  6164. var IS_IOS = exports.IS_IOS = /ipad|iphone|ipod/i.test(UA) && !_window2.default.MSStream;
  6165. var IS_ANDROID = exports.IS_ANDROID = /android/i.test(UA);
  6166. var IS_IE = exports.IS_IE = /(trident|microsoft)/i.test(NAV.appName);
  6167. var IS_EDGE = exports.IS_EDGE = 'msLaunchUri' in NAV && !('documentMode' in _document2.default);
  6168. var IS_CHROME = exports.IS_CHROME = /chrome/i.test(UA);
  6169. var IS_FIREFOX = exports.IS_FIREFOX = /firefox/i.test(UA);
  6170. var IS_SAFARI = exports.IS_SAFARI = /safari/i.test(UA) && !IS_CHROME;
  6171. var IS_STOCK_ANDROID = exports.IS_STOCK_ANDROID = /^mozilla\/\d+\.\d+\s\(linux;\su;/i.test(UA);
  6172. var HAS_MSE = exports.HAS_MSE = 'MediaSource' in _window2.default;
  6173. var SUPPORT_POINTER_EVENTS = exports.SUPPORT_POINTER_EVENTS = function () {
  6174. var element = _document2.default.createElement('x'),
  6175. documentElement = _document2.default.documentElement,
  6176. getComputedStyle = _window2.default.getComputedStyle;
  6177. if (!('pointerEvents' in element.style)) {
  6178. return false;
  6179. }
  6180. element.style.pointerEvents = 'auto';
  6181. element.style.pointerEvents = 'x';
  6182. documentElement.appendChild(element);
  6183. var supports = getComputedStyle && (getComputedStyle(element, '') || {}).pointerEvents === 'auto';
  6184. element.remove();
  6185. return !!supports;
  6186. }();
  6187. var SUPPORT_PASSIVE_EVENT = exports.SUPPORT_PASSIVE_EVENT = function () {
  6188. var supportsPassive = false;
  6189. try {
  6190. var opts = Object.defineProperty({}, 'passive', {
  6191. get: function get() {
  6192. supportsPassive = true;
  6193. }
  6194. });
  6195. _window2.default.addEventListener('test', null, opts);
  6196. } catch (e) {}
  6197. return supportsPassive;
  6198. }();
  6199. var html5Elements = ['source', 'track', 'audio', 'video'];
  6200. var video = void 0;
  6201. for (var i = 0, total = html5Elements.length; i < total; i++) {
  6202. video = _document2.default.createElement(html5Elements[i]);
  6203. }
  6204. var SUPPORTS_NATIVE_HLS = exports.SUPPORTS_NATIVE_HLS = IS_SAFARI || IS_ANDROID && (IS_CHROME || IS_STOCK_ANDROID) || IS_IE && /edge/i.test(UA);
  6205. var hasiOSFullScreen = video.webkitEnterFullscreen !== undefined;
  6206. var hasNativeFullscreen = video.requestFullscreen !== undefined;
  6207. if (hasiOSFullScreen && /mac os x 10_5/i.test(UA)) {
  6208. hasNativeFullscreen = false;
  6209. hasiOSFullScreen = false;
  6210. }
  6211. var hasWebkitNativeFullScreen = video.webkitRequestFullScreen !== undefined;
  6212. var hasMozNativeFullScreen = video.mozRequestFullScreen !== undefined;
  6213. var hasMsNativeFullScreen = video.msRequestFullscreen !== undefined;
  6214. var hasTrueNativeFullScreen = hasWebkitNativeFullScreen || hasMozNativeFullScreen || hasMsNativeFullScreen;
  6215. var nativeFullScreenEnabled = hasTrueNativeFullScreen;
  6216. var fullScreenEventName = '';
  6217. var isFullScreen = void 0,
  6218. requestFullScreen = void 0,
  6219. cancelFullScreen = void 0;
  6220. if (hasMozNativeFullScreen) {
  6221. nativeFullScreenEnabled = _document2.default.mozFullScreenEnabled;
  6222. } else if (hasMsNativeFullScreen) {
  6223. nativeFullScreenEnabled = _document2.default.msFullscreenEnabled;
  6224. }
  6225. if (IS_CHROME) {
  6226. hasiOSFullScreen = false;
  6227. }
  6228. if (hasTrueNativeFullScreen) {
  6229. if (hasWebkitNativeFullScreen) {
  6230. fullScreenEventName = 'webkitfullscreenchange';
  6231. } else if (hasMozNativeFullScreen) {
  6232. fullScreenEventName = 'mozfullscreenchange';
  6233. } else if (hasMsNativeFullScreen) {
  6234. fullScreenEventName = 'MSFullscreenChange';
  6235. }
  6236. exports.isFullScreen = isFullScreen = function isFullScreen() {
  6237. if (hasMozNativeFullScreen) {
  6238. return _document2.default.mozFullScreen;
  6239. } else if (hasWebkitNativeFullScreen) {
  6240. return _document2.default.webkitIsFullScreen;
  6241. } else if (hasMsNativeFullScreen) {
  6242. return _document2.default.msFullscreenElement !== null;
  6243. }
  6244. };
  6245. exports.requestFullScreen = requestFullScreen = function requestFullScreen(el) {
  6246. if (hasWebkitNativeFullScreen) {
  6247. el.webkitRequestFullScreen();
  6248. } else if (hasMozNativeFullScreen) {
  6249. el.mozRequestFullScreen();
  6250. } else if (hasMsNativeFullScreen) {
  6251. el.msRequestFullscreen();
  6252. }
  6253. };
  6254. exports.cancelFullScreen = cancelFullScreen = function cancelFullScreen() {
  6255. if (hasWebkitNativeFullScreen) {
  6256. _document2.default.webkitCancelFullScreen();
  6257. } else if (hasMozNativeFullScreen) {
  6258. _document2.default.mozCancelFullScreen();
  6259. } else if (hasMsNativeFullScreen) {
  6260. _document2.default.msExitFullscreen();
  6261. }
  6262. };
  6263. }
  6264. var HAS_NATIVE_FULLSCREEN = exports.HAS_NATIVE_FULLSCREEN = hasNativeFullscreen;
  6265. var HAS_WEBKIT_NATIVE_FULLSCREEN = exports.HAS_WEBKIT_NATIVE_FULLSCREEN = hasWebkitNativeFullScreen;
  6266. var HAS_MOZ_NATIVE_FULLSCREEN = exports.HAS_MOZ_NATIVE_FULLSCREEN = hasMozNativeFullScreen;
  6267. var HAS_MS_NATIVE_FULLSCREEN = exports.HAS_MS_NATIVE_FULLSCREEN = hasMsNativeFullScreen;
  6268. var HAS_IOS_FULLSCREEN = exports.HAS_IOS_FULLSCREEN = hasiOSFullScreen;
  6269. var HAS_TRUE_NATIVE_FULLSCREEN = exports.HAS_TRUE_NATIVE_FULLSCREEN = hasTrueNativeFullScreen;
  6270. var HAS_NATIVE_FULLSCREEN_ENABLED = exports.HAS_NATIVE_FULLSCREEN_ENABLED = nativeFullScreenEnabled;
  6271. var FULLSCREEN_EVENT_NAME = exports.FULLSCREEN_EVENT_NAME = fullScreenEventName;
  6272. exports.isFullScreen = isFullScreen;
  6273. exports.requestFullScreen = requestFullScreen;
  6274. exports.cancelFullScreen = cancelFullScreen;
  6275. _mejs2.default.Features = _mejs2.default.Features || {};
  6276. _mejs2.default.Features.isiPad = IS_IPAD;
  6277. _mejs2.default.Features.isiPod = IS_IPOD;
  6278. _mejs2.default.Features.isiPhone = IS_IPHONE;
  6279. _mejs2.default.Features.isiOS = _mejs2.default.Features.isiPhone || _mejs2.default.Features.isiPad;
  6280. _mejs2.default.Features.isAndroid = IS_ANDROID;
  6281. _mejs2.default.Features.isIE = IS_IE;
  6282. _mejs2.default.Features.isEdge = IS_EDGE;
  6283. _mejs2.default.Features.isChrome = IS_CHROME;
  6284. _mejs2.default.Features.isFirefox = IS_FIREFOX;
  6285. _mejs2.default.Features.isSafari = IS_SAFARI;
  6286. _mejs2.default.Features.isStockAndroid = IS_STOCK_ANDROID;
  6287. _mejs2.default.Features.hasMSE = HAS_MSE;
  6288. _mejs2.default.Features.supportsNativeHLS = SUPPORTS_NATIVE_HLS;
  6289. _mejs2.default.Features.supportsPointerEvents = SUPPORT_POINTER_EVENTS;
  6290. _mejs2.default.Features.supportsPassiveEvent = SUPPORT_PASSIVE_EVENT;
  6291. _mejs2.default.Features.hasiOSFullScreen = HAS_IOS_FULLSCREEN;
  6292. _mejs2.default.Features.hasNativeFullscreen = HAS_NATIVE_FULLSCREEN;
  6293. _mejs2.default.Features.hasWebkitNativeFullScreen = HAS_WEBKIT_NATIVE_FULLSCREEN;
  6294. _mejs2.default.Features.hasMozNativeFullScreen = HAS_MOZ_NATIVE_FULLSCREEN;
  6295. _mejs2.default.Features.hasMsNativeFullScreen = HAS_MS_NATIVE_FULLSCREEN;
  6296. _mejs2.default.Features.hasTrueNativeFullScreen = HAS_TRUE_NATIVE_FULLSCREEN;
  6297. _mejs2.default.Features.nativeFullScreenEnabled = HAS_NATIVE_FULLSCREEN_ENABLED;
  6298. _mejs2.default.Features.fullScreenEventName = FULLSCREEN_EVENT_NAME;
  6299. _mejs2.default.Features.isFullScreen = isFullScreen;
  6300. _mejs2.default.Features.requestFullScreen = requestFullScreen;
  6301. _mejs2.default.Features.cancelFullScreen = cancelFullScreen;
  6302. },{"2":2,"3":3,"7":7}],26:[function(_dereq_,module,exports){
  6303. 'use strict';
  6304. Object.defineProperty(exports, "__esModule", {
  6305. value: true
  6306. });
  6307. exports.removeClass = exports.addClass = exports.hasClass = undefined;
  6308. exports.loadScript = loadScript;
  6309. exports.offset = offset;
  6310. exports.toggleClass = toggleClass;
  6311. exports.fadeOut = fadeOut;
  6312. exports.fadeIn = fadeIn;
  6313. exports.siblings = siblings;
  6314. exports.visible = visible;
  6315. exports.ajax = ajax;
  6316. var _window = _dereq_(3);
  6317. var _window2 = _interopRequireDefault(_window);
  6318. var _document = _dereq_(2);
  6319. var _document2 = _interopRequireDefault(_document);
  6320. var _mejs = _dereq_(7);
  6321. var _mejs2 = _interopRequireDefault(_mejs);
  6322. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6323. function loadScript(url) {
  6324. return new Promise(function (resolve, reject) {
  6325. var script = _document2.default.createElement('script');
  6326. script.src = url;
  6327. script.async = true;
  6328. script.onload = function () {
  6329. script.remove();
  6330. resolve();
  6331. };
  6332. script.onerror = function () {
  6333. script.remove();
  6334. reject();
  6335. };
  6336. _document2.default.head.appendChild(script);
  6337. });
  6338. }
  6339. function offset(el) {
  6340. var rect = el.getBoundingClientRect(),
  6341. scrollLeft = _window2.default.pageXOffset || _document2.default.documentElement.scrollLeft,
  6342. scrollTop = _window2.default.pageYOffset || _document2.default.documentElement.scrollTop;
  6343. return { top: rect.top + scrollTop, left: rect.left + scrollLeft };
  6344. }
  6345. var hasClassMethod = void 0,
  6346. addClassMethod = void 0,
  6347. removeClassMethod = void 0;
  6348. if ('classList' in _document2.default.documentElement) {
  6349. hasClassMethod = function hasClassMethod(el, className) {
  6350. return el.classList !== undefined && el.classList.contains(className);
  6351. };
  6352. addClassMethod = function addClassMethod(el, className) {
  6353. return el.classList.add(className);
  6354. };
  6355. removeClassMethod = function removeClassMethod(el, className) {
  6356. return el.classList.remove(className);
  6357. };
  6358. } else {
  6359. hasClassMethod = function hasClassMethod(el, className) {
  6360. return new RegExp('\\b' + className + '\\b').test(el.className);
  6361. };
  6362. addClassMethod = function addClassMethod(el, className) {
  6363. if (!hasClass(el, className)) {
  6364. el.className += ' ' + className;
  6365. }
  6366. };
  6367. removeClassMethod = function removeClassMethod(el, className) {
  6368. el.className = el.className.replace(new RegExp('\\b' + className + '\\b', 'g'), '');
  6369. };
  6370. }
  6371. var hasClass = exports.hasClass = hasClassMethod;
  6372. var addClass = exports.addClass = addClassMethod;
  6373. var removeClass = exports.removeClass = removeClassMethod;
  6374. function toggleClass(el, className) {
  6375. hasClass(el, className) ? removeClass(el, className) : addClass(el, className);
  6376. }
  6377. function fadeOut(el) {
  6378. var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 400;
  6379. var callback = arguments[2];
  6380. if (!el.style.opacity) {
  6381. el.style.opacity = 1;
  6382. }
  6383. var start = null;
  6384. _window2.default.requestAnimationFrame(function animate(timestamp) {
  6385. start = start || timestamp;
  6386. var progress = timestamp - start;
  6387. var opacity = parseFloat(1 - progress / duration, 2);
  6388. el.style.opacity = opacity < 0 ? 0 : opacity;
  6389. if (progress > duration) {
  6390. if (callback && typeof callback === 'function') {
  6391. callback();
  6392. }
  6393. } else {
  6394. _window2.default.requestAnimationFrame(animate);
  6395. }
  6396. });
  6397. }
  6398. function fadeIn(el) {
  6399. var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 400;
  6400. var callback = arguments[2];
  6401. if (!el.style.opacity) {
  6402. el.style.opacity = 0;
  6403. }
  6404. var start = null;
  6405. _window2.default.requestAnimationFrame(function animate(timestamp) {
  6406. start = start || timestamp;
  6407. var progress = timestamp - start;
  6408. var opacity = parseFloat(progress / duration, 2);
  6409. el.style.opacity = opacity > 1 ? 1 : opacity;
  6410. if (progress > duration) {
  6411. if (callback && typeof callback === 'function') {
  6412. callback();
  6413. }
  6414. } else {
  6415. _window2.default.requestAnimationFrame(animate);
  6416. }
  6417. });
  6418. }
  6419. function siblings(el, filter) {
  6420. var siblings = [];
  6421. el = el.parentNode.firstChild;
  6422. do {
  6423. if (!filter || filter(el)) {
  6424. siblings.push(el);
  6425. }
  6426. } while (el = el.nextSibling);
  6427. return siblings;
  6428. }
  6429. function visible(elem) {
  6430. if (elem.getClientRects !== undefined && elem.getClientRects === 'function') {
  6431. return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
  6432. }
  6433. return !!(elem.offsetWidth || elem.offsetHeight);
  6434. }
  6435. function ajax(url, dataType, success, error) {
  6436. var xhr = _window2.default.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
  6437. var type = 'application/x-www-form-urlencoded; charset=UTF-8',
  6438. completed = false,
  6439. accept = '*/'.concat('*');
  6440. switch (dataType) {
  6441. case 'text':
  6442. type = 'text/plain';
  6443. break;
  6444. case 'json':
  6445. type = 'application/json, text/javascript';
  6446. break;
  6447. case 'html':
  6448. type = 'text/html';
  6449. break;
  6450. case 'xml':
  6451. type = 'application/xml, text/xml';
  6452. break;
  6453. }
  6454. if (type !== 'application/x-www-form-urlencoded') {
  6455. accept = type + ', */*; q=0.01';
  6456. }
  6457. if (xhr) {
  6458. xhr.open('GET', url, true);
  6459. xhr.setRequestHeader('Accept', accept);
  6460. xhr.onreadystatechange = function () {
  6461. if (completed) {
  6462. return;
  6463. }
  6464. if (xhr.readyState === 4) {
  6465. if (xhr.status === 200) {
  6466. completed = true;
  6467. var data = void 0;
  6468. switch (dataType) {
  6469. case 'json':
  6470. data = JSON.parse(xhr.responseText);
  6471. break;
  6472. case 'xml':
  6473. data = xhr.responseXML;
  6474. break;
  6475. default:
  6476. data = xhr.responseText;
  6477. break;
  6478. }
  6479. success(data);
  6480. } else if (typeof error === 'function') {
  6481. error(xhr.status);
  6482. }
  6483. }
  6484. };
  6485. xhr.send();
  6486. }
  6487. }
  6488. _mejs2.default.Utils = _mejs2.default.Utils || {};
  6489. _mejs2.default.Utils.offset = offset;
  6490. _mejs2.default.Utils.hasClass = hasClass;
  6491. _mejs2.default.Utils.addClass = addClass;
  6492. _mejs2.default.Utils.removeClass = removeClass;
  6493. _mejs2.default.Utils.toggleClass = toggleClass;
  6494. _mejs2.default.Utils.fadeIn = fadeIn;
  6495. _mejs2.default.Utils.fadeOut = fadeOut;
  6496. _mejs2.default.Utils.siblings = siblings;
  6497. _mejs2.default.Utils.visible = visible;
  6498. _mejs2.default.Utils.ajax = ajax;
  6499. _mejs2.default.Utils.loadScript = loadScript;
  6500. },{"2":2,"3":3,"7":7}],27:[function(_dereq_,module,exports){
  6501. 'use strict';
  6502. Object.defineProperty(exports, "__esModule", {
  6503. value: true
  6504. });
  6505. exports.escapeHTML = escapeHTML;
  6506. exports.debounce = debounce;
  6507. exports.isObjectEmpty = isObjectEmpty;
  6508. exports.splitEvents = splitEvents;
  6509. exports.createEvent = createEvent;
  6510. exports.isNodeAfter = isNodeAfter;
  6511. exports.isString = isString;
  6512. var _mejs = _dereq_(7);
  6513. var _mejs2 = _interopRequireDefault(_mejs);
  6514. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6515. function escapeHTML(input) {
  6516. if (typeof input !== 'string') {
  6517. throw new Error('Argument passed must be a string');
  6518. }
  6519. var map = {
  6520. '&': '&amp;',
  6521. '<': '&lt;',
  6522. '>': '&gt;',
  6523. '"': '&quot;'
  6524. };
  6525. return input.replace(/[&<>"]/g, function (c) {
  6526. return map[c];
  6527. });
  6528. }
  6529. function debounce(func, wait) {
  6530. var _this = this,
  6531. _arguments = arguments;
  6532. var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  6533. if (typeof func !== 'function') {
  6534. throw new Error('First argument must be a function');
  6535. }
  6536. if (typeof wait !== 'number') {
  6537. throw new Error('Second argument must be a numeric value');
  6538. }
  6539. var timeout = void 0;
  6540. return function () {
  6541. var context = _this,
  6542. args = _arguments;
  6543. var later = function later() {
  6544. timeout = null;
  6545. if (!immediate) {
  6546. func.apply(context, args);
  6547. }
  6548. };
  6549. var callNow = immediate && !timeout;
  6550. clearTimeout(timeout);
  6551. timeout = setTimeout(later, wait);
  6552. if (callNow) {
  6553. func.apply(context, args);
  6554. }
  6555. };
  6556. }
  6557. function isObjectEmpty(instance) {
  6558. return Object.getOwnPropertyNames(instance).length <= 0;
  6559. }
  6560. function splitEvents(events, id) {
  6561. var rwindow = /^((after|before)print|(before)?unload|hashchange|message|o(ff|n)line|page(hide|show)|popstate|resize|storage)\b/;
  6562. var ret = { d: [], w: [] };
  6563. (events || '').split(' ').forEach(function (v) {
  6564. var eventName = '' + v + (id ? '.' + id : '');
  6565. if (eventName.startsWith('.')) {
  6566. ret.d.push(eventName);
  6567. ret.w.push(eventName);
  6568. } else {
  6569. ret[rwindow.test(v) ? 'w' : 'd'].push(eventName);
  6570. }
  6571. });
  6572. ret.d = ret.d.join(' ');
  6573. ret.w = ret.w.join(' ');
  6574. return ret;
  6575. }
  6576. function createEvent(eventName, target) {
  6577. if (typeof eventName !== 'string') {
  6578. throw new Error('Event name must be a string');
  6579. }
  6580. var eventFrags = eventName.match(/([a-z]+\.([a-z]+))/i),
  6581. detail = {
  6582. target: target
  6583. };
  6584. if (eventFrags !== null) {
  6585. eventName = eventFrags[1];
  6586. detail.namespace = eventFrags[2];
  6587. }
  6588. return new window.CustomEvent(eventName, {
  6589. detail: detail
  6590. });
  6591. }
  6592. function isNodeAfter(sourceNode, targetNode) {
  6593. return !!(sourceNode && targetNode && sourceNode.compareDocumentPosition(targetNode) & 2);
  6594. }
  6595. function isString(value) {
  6596. return typeof value === 'string';
  6597. }
  6598. _mejs2.default.Utils = _mejs2.default.Utils || {};
  6599. _mejs2.default.Utils.escapeHTML = escapeHTML;
  6600. _mejs2.default.Utils.debounce = debounce;
  6601. _mejs2.default.Utils.isObjectEmpty = isObjectEmpty;
  6602. _mejs2.default.Utils.splitEvents = splitEvents;
  6603. _mejs2.default.Utils.createEvent = createEvent;
  6604. _mejs2.default.Utils.isNodeAfter = isNodeAfter;
  6605. _mejs2.default.Utils.isString = isString;
  6606. },{"7":7}],28:[function(_dereq_,module,exports){
  6607. 'use strict';
  6608. Object.defineProperty(exports, "__esModule", {
  6609. value: true
  6610. });
  6611. exports.typeChecks = undefined;
  6612. exports.absolutizeUrl = absolutizeUrl;
  6613. exports.formatType = formatType;
  6614. exports.getMimeFromType = getMimeFromType;
  6615. exports.getTypeFromFile = getTypeFromFile;
  6616. exports.getExtension = getExtension;
  6617. exports.normalizeExtension = normalizeExtension;
  6618. var _mejs = _dereq_(7);
  6619. var _mejs2 = _interopRequireDefault(_mejs);
  6620. var _general = _dereq_(27);
  6621. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6622. var typeChecks = exports.typeChecks = [];
  6623. function absolutizeUrl(url) {
  6624. if (typeof url !== 'string') {
  6625. throw new Error('`url` argument must be a string');
  6626. }
  6627. var el = document.createElement('div');
  6628. el.innerHTML = '<a href="' + (0, _general.escapeHTML)(url) + '">x</a>';
  6629. return el.firstChild.href;
  6630. }
  6631. function formatType(url) {
  6632. var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  6633. return url && !type ? getTypeFromFile(url) : type;
  6634. }
  6635. function getMimeFromType(type) {
  6636. if (typeof type !== 'string') {
  6637. throw new Error('`type` argument must be a string');
  6638. }
  6639. return type && type.indexOf(';') > -1 ? type.substr(0, type.indexOf(';')) : type;
  6640. }
  6641. function getTypeFromFile(url) {
  6642. if (typeof url !== 'string') {
  6643. throw new Error('`url` argument must be a string');
  6644. }
  6645. for (var i = 0, total = typeChecks.length; i < total; i++) {
  6646. var type = typeChecks[i](url);
  6647. if (type) {
  6648. return type;
  6649. }
  6650. }
  6651. var ext = getExtension(url),
  6652. normalizedExt = normalizeExtension(ext);
  6653. var mime = 'video/mp4';
  6654. if (normalizedExt) {
  6655. if (~['mp4', 'm4v', 'ogg', 'ogv', 'webm', 'flv', 'mpeg', 'mov'].indexOf(normalizedExt)) {
  6656. mime = 'video/' + normalizedExt;
  6657. } else if (~['mp3', 'oga', 'wav', 'mid', 'midi'].indexOf(normalizedExt)) {
  6658. mime = 'audio/' + normalizedExt;
  6659. }
  6660. }
  6661. return mime;
  6662. }
  6663. function getExtension(url) {
  6664. if (typeof url !== 'string') {
  6665. throw new Error('`url` argument must be a string');
  6666. }
  6667. var baseUrl = url.split('?')[0],
  6668. baseName = baseUrl.split('\\').pop().split('/').pop();
  6669. return ~baseName.indexOf('.') ? baseName.substring(baseName.lastIndexOf('.') + 1) : '';
  6670. }
  6671. function normalizeExtension(extension) {
  6672. if (typeof extension !== 'string') {
  6673. throw new Error('`extension` argument must be a string');
  6674. }
  6675. switch (extension) {
  6676. case 'mp4':
  6677. case 'm4v':
  6678. return 'mp4';
  6679. case 'webm':
  6680. case 'webma':
  6681. case 'webmv':
  6682. return 'webm';
  6683. case 'ogg':
  6684. case 'oga':
  6685. case 'ogv':
  6686. return 'ogg';
  6687. default:
  6688. return extension;
  6689. }
  6690. }
  6691. _mejs2.default.Utils = _mejs2.default.Utils || {};
  6692. _mejs2.default.Utils.typeChecks = typeChecks;
  6693. _mejs2.default.Utils.absolutizeUrl = absolutizeUrl;
  6694. _mejs2.default.Utils.formatType = formatType;
  6695. _mejs2.default.Utils.getMimeFromType = getMimeFromType;
  6696. _mejs2.default.Utils.getTypeFromFile = getTypeFromFile;
  6697. _mejs2.default.Utils.getExtension = getExtension;
  6698. _mejs2.default.Utils.normalizeExtension = normalizeExtension;
  6699. },{"27":27,"7":7}],29:[function(_dereq_,module,exports){
  6700. 'use strict';
  6701. var _document = _dereq_(2);
  6702. var _document2 = _interopRequireDefault(_document);
  6703. var _promisePolyfill = _dereq_(4);
  6704. var _promisePolyfill2 = _interopRequireDefault(_promisePolyfill);
  6705. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6706. (function (arr) {
  6707. arr.forEach(function (item) {
  6708. if (item.hasOwnProperty('remove')) {
  6709. return;
  6710. }
  6711. Object.defineProperty(item, 'remove', {
  6712. configurable: true,
  6713. enumerable: true,
  6714. writable: true,
  6715. value: function remove() {
  6716. this.parentNode.removeChild(this);
  6717. }
  6718. });
  6719. });
  6720. })([Element.prototype, CharacterData.prototype, DocumentType.prototype]);
  6721. (function () {
  6722. if (typeof window.CustomEvent === 'function') {
  6723. return false;
  6724. }
  6725. function CustomEvent(event, params) {
  6726. params = params || { bubbles: false, cancelable: false, detail: undefined };
  6727. var evt = _document2.default.createEvent('CustomEvent');
  6728. evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
  6729. return evt;
  6730. }
  6731. CustomEvent.prototype = window.Event.prototype;
  6732. window.CustomEvent = CustomEvent;
  6733. })();
  6734. if (typeof Object.assign !== 'function') {
  6735. Object.assign = function (target) {
  6736. if (target === null || target === undefined) {
  6737. throw new TypeError('Cannot convert undefined or null to object');
  6738. }
  6739. var to = Object(target);
  6740. for (var index = 1, total = arguments.length; index < total; index++) {
  6741. var nextSource = arguments[index];
  6742. if (nextSource !== null) {
  6743. for (var nextKey in nextSource) {
  6744. if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
  6745. to[nextKey] = nextSource[nextKey];
  6746. }
  6747. }
  6748. }
  6749. }
  6750. return to;
  6751. };
  6752. }
  6753. if (!String.prototype.startsWith) {
  6754. String.prototype.startsWith = function (searchString, position) {
  6755. position = position || 0;
  6756. return this.substr(position, searchString.length) === searchString;
  6757. };
  6758. }
  6759. if (!Element.prototype.matches) {
  6760. Element.prototype.matches = Element.prototype.matchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.msMatchesSelector || Element.prototype.oMatchesSelector || Element.prototype.webkitMatchesSelector || function (s) {
  6761. var matches = (this.document || this.ownerDocument).querySelectorAll(s),
  6762. i = matches.length - 1;
  6763. while (--i >= 0 && matches.item(i) !== this) {}
  6764. return i > -1;
  6765. };
  6766. }
  6767. if (window.Element && !Element.prototype.closest) {
  6768. Element.prototype.closest = function (s) {
  6769. var matches = (this.document || this.ownerDocument).querySelectorAll(s),
  6770. i = void 0,
  6771. el = this;
  6772. do {
  6773. i = matches.length;
  6774. while (--i >= 0 && matches.item(i) !== el) {}
  6775. } while (i < 0 && (el = el.parentElement));
  6776. return el;
  6777. };
  6778. }
  6779. (function () {
  6780. var lastTime = 0;
  6781. var vendors = ['ms', 'moz', 'webkit', 'o'];
  6782. for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
  6783. window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
  6784. window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame'];
  6785. }
  6786. if (!window.requestAnimationFrame) window.requestAnimationFrame = function (callback) {
  6787. var currTime = new Date().getTime();
  6788. var timeToCall = Math.max(0, 16 - (currTime - lastTime));
  6789. var id = window.setTimeout(function () {
  6790. callback(currTime + timeToCall);
  6791. }, timeToCall);
  6792. lastTime = currTime + timeToCall;
  6793. return id;
  6794. };
  6795. if (!window.cancelAnimationFrame) window.cancelAnimationFrame = function (id) {
  6796. clearTimeout(id);
  6797. };
  6798. })();
  6799. if (/firefox/i.test(navigator.userAgent)) {
  6800. var getComputedStyle = window.getComputedStyle;
  6801. window.getComputedStyle = function (el, pseudoEl) {
  6802. var t = getComputedStyle(el, pseudoEl);
  6803. return t === null ? { getPropertyValue: function getPropertyValue() {} } : t;
  6804. };
  6805. }
  6806. if (!window.Promise) {
  6807. window.Promise = _promisePolyfill2.default;
  6808. }
  6809. (function (constructor) {
  6810. if (constructor && constructor.prototype && constructor.prototype.children === null) {
  6811. Object.defineProperty(constructor.prototype, 'children', {
  6812. get: function get() {
  6813. var i = 0,
  6814. node = void 0,
  6815. nodes = this.childNodes,
  6816. children = [];
  6817. while (node = nodes[i++]) {
  6818. if (node.nodeType === 1) {
  6819. children.push(node);
  6820. }
  6821. }
  6822. return children;
  6823. }
  6824. });
  6825. }
  6826. })(window.Node || window.Element);
  6827. },{"2":2,"4":4}],30:[function(_dereq_,module,exports){
  6828. 'use strict';
  6829. Object.defineProperty(exports, "__esModule", {
  6830. value: true
  6831. });
  6832. exports.isDropFrame = isDropFrame;
  6833. exports.secondsToTimeCode = secondsToTimeCode;
  6834. exports.timeCodeToSeconds = timeCodeToSeconds;
  6835. exports.calculateTimeFormat = calculateTimeFormat;
  6836. exports.convertSMPTEtoSeconds = convertSMPTEtoSeconds;
  6837. var _mejs = _dereq_(7);
  6838. var _mejs2 = _interopRequireDefault(_mejs);
  6839. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6840. function isDropFrame() {
  6841. var fps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 25;
  6842. return !(fps % 1 === 0);
  6843. }
  6844. function secondsToTimeCode(time) {
  6845. var forceHours = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  6846. var showFrameCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  6847. var fps = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 25;
  6848. var secondsDecimalLength = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
  6849. var timeFormat = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'hh:mm:ss';
  6850. time = !time || typeof time !== 'number' || time < 0 ? 0 : time;
  6851. var dropFrames = Math.round(fps * 0.066666),
  6852. timeBase = Math.round(fps),
  6853. framesPer24Hours = Math.round(fps * 3600) * 24,
  6854. framesPer10Minutes = Math.round(fps * 600),
  6855. frameSep = isDropFrame(fps) ? ';' : ':',
  6856. hours = void 0,
  6857. minutes = void 0,
  6858. seconds = void 0,
  6859. frames = void 0,
  6860. f = Math.round(time * fps);
  6861. if (isDropFrame(fps)) {
  6862. if (f < 0) {
  6863. f = framesPer24Hours + f;
  6864. }
  6865. f = f % framesPer24Hours;
  6866. var d = Math.floor(f / framesPer10Minutes);
  6867. var m = f % framesPer10Minutes;
  6868. f = f + dropFrames * 9 * d;
  6869. if (m > dropFrames) {
  6870. f = f + dropFrames * Math.floor((m - dropFrames) / Math.round(timeBase * 60 - dropFrames));
  6871. }
  6872. var timeBaseDivision = Math.floor(f / timeBase);
  6873. hours = Math.floor(Math.floor(timeBaseDivision / 60) / 60);
  6874. minutes = Math.floor(timeBaseDivision / 60) % 60;
  6875. if (showFrameCount) {
  6876. seconds = timeBaseDivision % 60;
  6877. } else {
  6878. seconds = Math.floor(f / timeBase % 60).toFixed(secondsDecimalLength);
  6879. }
  6880. } else {
  6881. hours = Math.floor(time / 3600) % 24;
  6882. minutes = Math.floor(time / 60) % 60;
  6883. if (showFrameCount) {
  6884. seconds = Math.floor(time % 60);
  6885. } else {
  6886. seconds = Math.floor(time % 60).toFixed(secondsDecimalLength);
  6887. }
  6888. }
  6889. hours = hours <= 0 ? 0 : hours;
  6890. minutes = minutes <= 0 ? 0 : minutes;
  6891. seconds = seconds <= 0 ? 0 : seconds;
  6892. seconds = seconds === 60 ? 0 : seconds;
  6893. minutes = minutes === 60 ? 0 : minutes;
  6894. var timeFormatFrags = timeFormat.split(':');
  6895. var timeFormatSettings = {};
  6896. for (var i = 0, total = timeFormatFrags.length; i < total; ++i) {
  6897. var unique = '';
  6898. for (var j = 0, t = timeFormatFrags[i].length; j < t; j++) {
  6899. if (unique.indexOf(timeFormatFrags[i][j]) < 0) {
  6900. unique += timeFormatFrags[i][j];
  6901. }
  6902. }
  6903. if (~['f', 's', 'm', 'h'].indexOf(unique)) {
  6904. timeFormatSettings[unique] = timeFormatFrags[i].length;
  6905. }
  6906. }
  6907. var result = forceHours || hours > 0 ? (hours < 10 && timeFormatSettings.h > 1 ? '0' + hours : hours) + ':' : '';
  6908. result += (minutes < 10 && timeFormatSettings.m > 1 ? '0' + minutes : minutes) + ':';
  6909. result += '' + (seconds < 10 && timeFormatSettings.s > 1 ? '0' + seconds : seconds);
  6910. if (showFrameCount) {
  6911. frames = (f % timeBase).toFixed(0);
  6912. frames = frames <= 0 ? 0 : frames;
  6913. result += frames < 10 && timeFormatSettings.f ? frameSep + '0' + frames : '' + frameSep + frames;
  6914. }
  6915. return result;
  6916. }
  6917. function timeCodeToSeconds(time) {
  6918. var fps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 25;
  6919. if (typeof time !== 'string') {
  6920. throw new TypeError('Time must be a string');
  6921. }
  6922. if (time.indexOf(';') > 0) {
  6923. time = time.replace(';', ':');
  6924. }
  6925. if (!/\d{2}(\:\d{2}){0,3}/i.test(time)) {
  6926. throw new TypeError('Time code must have the format `00:00:00`');
  6927. }
  6928. var parts = time.split(':');
  6929. var output = void 0,
  6930. hours = 0,
  6931. minutes = 0,
  6932. seconds = 0,
  6933. frames = 0,
  6934. totalMinutes = 0,
  6935. dropFrames = Math.round(fps * 0.066666),
  6936. timeBase = Math.round(fps),
  6937. hFrames = timeBase * 3600,
  6938. mFrames = timeBase * 60;
  6939. switch (parts.length) {
  6940. default:
  6941. case 1:
  6942. seconds = parseInt(parts[0], 10);
  6943. break;
  6944. case 2:
  6945. minutes = parseInt(parts[0], 10);
  6946. seconds = parseInt(parts[1], 10);
  6947. break;
  6948. case 3:
  6949. hours = parseInt(parts[0], 10);
  6950. minutes = parseInt(parts[1], 10);
  6951. seconds = parseInt(parts[2], 10);
  6952. break;
  6953. case 4:
  6954. hours = parseInt(parts[0], 10);
  6955. minutes = parseInt(parts[1], 10);
  6956. seconds = parseInt(parts[2], 10);
  6957. frames = parseInt(parts[3], 10);
  6958. break;
  6959. }
  6960. if (isDropFrame(fps)) {
  6961. totalMinutes = 60 * hours + minutes;
  6962. output = hFrames * hours + mFrames * minutes + timeBase * seconds + frames - dropFrames * (totalMinutes - Math.floor(totalMinutes / 10));
  6963. } else {
  6964. output = (hFrames * hours + mFrames * minutes + fps * seconds + frames) / fps;
  6965. }
  6966. return parseFloat(output.toFixed(3));
  6967. }
  6968. function calculateTimeFormat(time, options) {
  6969. var fps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 25;
  6970. time = !time || typeof time !== 'number' || time < 0 ? 0 : time;
  6971. var hours = Math.floor(time / 3600) % 24,
  6972. minutes = Math.floor(time / 60) % 60,
  6973. seconds = Math.floor(time % 60),
  6974. frames = Math.floor((time % 1 * fps).toFixed(3)),
  6975. lis = [[frames, 'f'], [seconds, 's'], [minutes, 'm'], [hours, 'h']];
  6976. var format = options.timeFormat,
  6977. firstTwoPlaces = format[1] === format[0],
  6978. separatorIndex = firstTwoPlaces ? 2 : 1,
  6979. separator = format.length < separatorIndex ? format[separatorIndex] : ':',
  6980. firstChar = format[0],
  6981. required = false;
  6982. for (var i = 0, len = lis.length; i < len; i++) {
  6983. if (~format.indexOf(lis[i][1])) {
  6984. required = true;
  6985. } else if (required) {
  6986. var hasNextValue = false;
  6987. for (var j = i; j < len; j++) {
  6988. if (lis[j][0] > 0) {
  6989. hasNextValue = true;
  6990. break;
  6991. }
  6992. }
  6993. if (!hasNextValue) {
  6994. break;
  6995. }
  6996. if (!firstTwoPlaces) {
  6997. format = firstChar + format;
  6998. }
  6999. format = lis[i][1] + separator + format;
  7000. if (firstTwoPlaces) {
  7001. format = lis[i][1] + format;
  7002. }
  7003. firstChar = lis[i][1];
  7004. }
  7005. }
  7006. options.timeFormat = format;
  7007. }
  7008. function convertSMPTEtoSeconds(SMPTE) {
  7009. if (typeof SMPTE !== 'string') {
  7010. throw new TypeError('Argument must be a string value');
  7011. }
  7012. SMPTE = SMPTE.replace(',', '.');
  7013. var decimalLen = ~SMPTE.indexOf('.') ? SMPTE.split('.')[1].length : 0;
  7014. var secs = 0,
  7015. multiplier = 1;
  7016. SMPTE = SMPTE.split(':').reverse();
  7017. for (var i = 0, total = SMPTE.length; i < total; i++) {
  7018. multiplier = 1;
  7019. if (i > 0) {
  7020. multiplier = Math.pow(60, i);
  7021. }
  7022. secs += Number(SMPTE[i]) * multiplier;
  7023. }
  7024. return Number(secs.toFixed(decimalLen));
  7025. }
  7026. _mejs2.default.Utils = _mejs2.default.Utils || {};
  7027. _mejs2.default.Utils.secondsToTimeCode = secondsToTimeCode;
  7028. _mejs2.default.Utils.timeCodeToSeconds = timeCodeToSeconds;
  7029. _mejs2.default.Utils.calculateTimeFormat = calculateTimeFormat;
  7030. _mejs2.default.Utils.convertSMPTEtoSeconds = convertSMPTEtoSeconds;
  7031. },{"7":7}]},{},[29,6,5,15,23,20,19,21,22,24,16,18,17,9,10,11,12,13,14]);