12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106 |
- document.createElement('video');
- document.createElement('audio');
- document.createElement('track');
- var vjs = function(id, options, ready){
- var tag;
-
-
- if (typeof id === 'string') {
-
- if (id.indexOf('#') === 0) {
- id = id.slice(1);
- }
-
- if (vjs.players[id]) {
- return vjs.players[id];
-
- } else {
- tag = vjs.el(id);
- }
-
- } else {
- tag = id;
- }
-
- if (!tag || !tag.nodeName) {
- throw new TypeError('The element or ID supplied is not valid. (videojs)');
- }
-
-
- return tag['player'] || new vjs.Player(tag, options, ready);
- };
- var videojs = vjs;
- window.videojs = window.vjs = vjs;
- vjs.CDN_VERSION = '4.3';
- vjs.ACCESS_PROTOCOL = ('https:' == document.location.protocol ? 'https://' : 'http://');
- vjs.options = {
-
- 'techOrder': ['html5','flash'],
-
- 'html5': {},
- 'flash': {},
-
- 'width': 300,
- 'height': 150,
-
- 'defaultVolume': 0.00,
-
- 'children': {
- 'mediaLoader': {},
- 'posterImage': {},
- 'textTrackDisplay': {},
- 'loadingSpinner': {},
- 'bigPlayButton': {},
- 'controlBar': {}
- },
-
- 'notSupportedMessage': 'Sorry, no compatible source and playback ' +
- 'technology were found for this video. Try using another browser ' +
- 'like <a href="http://bit.ly/ccMUEC">Chrome</a> or download the ' +
- 'latest <a href="http://adobe.ly/mwfN1">Adobe Flash Player</a>.'
- };
- if (vjs.CDN_VERSION !== 'GENERATED'+'_CDN_VSN') {
- videojs.options['flash']['swf'] = vjs.ACCESS_PROTOCOL + 'vjs.zencdn.net/'+vjs.CDN_VERSION+'/video-js.swf';
- }
- vjs.players = {};
- vjs.CoreObject = vjs['CoreObject'] = function(){};
- vjs.CoreObject.extend = function(props){
- var init, subObj;
- props = props || {};
-
-
-
- init = props['init'] || props.init || this.prototype['init'] || this.prototype.init || function(){};
-
-
-
-
-
-
-
-
-
- subObj = function(){
- init.apply(this, arguments);
- };
-
- subObj.prototype = vjs.obj.create(this.prototype);
-
-
- subObj.prototype.constructor = subObj;
-
- subObj.extend = vjs.CoreObject.extend;
-
- subObj.create = vjs.CoreObject.create;
-
- for (var name in props) {
- if (props.hasOwnProperty(name)) {
- subObj.prototype[name] = props[name];
- }
- }
- return subObj;
- };
- vjs.CoreObject.create = function(){
-
- var inst = vjs.obj.create(this.prototype);
-
- this.apply(inst, arguments);
-
- return inst;
- };
- vjs.on = function(elem, type, fn){
- var data = vjs.getData(elem);
-
- if (!data.handlers) data.handlers = {};
- if (!data.handlers[type]) data.handlers[type] = [];
- if (!fn.guid) fn.guid = vjs.guid++;
- data.handlers[type].push(fn);
- if (!data.dispatcher) {
- data.disabled = false;
- data.dispatcher = function (event){
- if (data.disabled) return;
- event = vjs.fixEvent(event);
- var handlers = data.handlers[event.type];
- if (handlers) {
-
- var handlersCopy = handlers.slice(0);
- for (var m = 0, n = handlersCopy.length; m < n; m++) {
- if (event.isImmediatePropagationStopped()) {
- break;
- } else {
- handlersCopy[m].call(elem, event);
- }
- }
- }
- };
- }
- if (data.handlers[type].length == 1) {
- if (document.addEventListener) {
- elem.addEventListener(type, data.dispatcher, false);
- } else if (document.attachEvent) {
- elem.attachEvent('on' + type, data.dispatcher);
- }
- }
- };
- vjs.off = function(elem, type, fn) {
-
- if (!vjs.hasData(elem)) return;
- var data = vjs.getData(elem);
-
- if (!data.handlers) { return; }
-
- var removeType = function(t){
- data.handlers[t] = [];
- vjs.cleanUpEvents(elem,t);
- };
-
- if (!type) {
- for (var t in data.handlers) removeType(t);
- return;
- }
- var handlers = data.handlers[type];
-
- if (!handlers) return;
-
- if (!fn) {
- removeType(type);
- return;
- }
-
- if (fn.guid) {
- for (var n = 0; n < handlers.length; n++) {
- if (handlers[n].guid === fn.guid) {
- handlers.splice(n--, 1);
- }
- }
- }
- vjs.cleanUpEvents(elem, type);
- };
- vjs.cleanUpEvents = function(elem, type) {
- var data = vjs.getData(elem);
-
- if (data.handlers[type].length === 0) {
- delete data.handlers[type];
-
-
-
- if (document.removeEventListener) {
- elem.removeEventListener(type, data.dispatcher, false);
- } else if (document.detachEvent) {
- elem.detachEvent('on' + type, data.dispatcher);
- }
- }
-
- if (vjs.isEmpty(data.handlers)) {
- delete data.handlers;
- delete data.dispatcher;
- delete data.disabled;
-
-
-
- }
-
- if (vjs.isEmpty(data)) {
- vjs.removeData(elem);
- }
- };
- vjs.fixEvent = function(event) {
- function returnTrue() { return true; }
- function returnFalse() { return false; }
-
-
-
-
-
- if (!event || !event.isPropagationStopped) {
- var old = event || window.event;
- event = {};
-
-
-
-
-
- for (var key in old) {
-
- if (key !== 'layerX' && key !== 'layerY') {
- event[key] = old[key];
- }
- }
-
- if (!event.target) {
- event.target = event.srcElement || document;
- }
-
- event.relatedTarget = event.fromElement === event.target ?
- event.toElement :
- event.fromElement;
-
- event.preventDefault = function () {
- if (old.preventDefault) {
- old.preventDefault();
- }
- event.returnValue = false;
- event.isDefaultPrevented = returnTrue;
- };
- event.isDefaultPrevented = returnFalse;
-
- event.stopPropagation = function () {
- if (old.stopPropagation) {
- old.stopPropagation();
- }
- event.cancelBubble = true;
- event.isPropagationStopped = returnTrue;
- };
- event.isPropagationStopped = returnFalse;
-
- event.stopImmediatePropagation = function () {
- if (old.stopImmediatePropagation) {
- old.stopImmediatePropagation();
- }
- event.isImmediatePropagationStopped = returnTrue;
- event.stopPropagation();
- };
- event.isImmediatePropagationStopped = returnFalse;
-
- if (event.clientX != null) {
- var doc = document.documentElement, body = document.body;
- event.pageX = event.clientX +
- (doc && doc.scrollLeft || body && body.scrollLeft || 0) -
- (doc && doc.clientLeft || body && body.clientLeft || 0);
- event.pageY = event.clientY +
- (doc && doc.scrollTop || body && body.scrollTop || 0) -
- (doc && doc.clientTop || body && body.clientTop || 0);
- }
-
- event.which = event.charCode || event.keyCode;
-
-
- if (event.button != null) {
- event.button = (event.button & 1 ? 0 :
- (event.button & 4 ? 1 :
- (event.button & 2 ? 2 : 0)));
- }
- }
-
- return event;
- };
- vjs.trigger = function(elem, event) {
-
-
-
- var elemData = (vjs.hasData(elem)) ? vjs.getData(elem) : {};
- var parent = elem.parentNode || elem.ownerDocument;
-
-
-
- if (typeof event === 'string') {
- event = { type:event, target:elem };
- }
-
- event = vjs.fixEvent(event);
-
- if (elemData.dispatcher) {
- elemData.dispatcher.call(elem, event);
- }
-
-
- if (parent && !event.isPropagationStopped() && event.bubbles !== false) {
- vjs.trigger(parent, event);
-
- } else if (!parent && !event.isDefaultPrevented()) {
- var targetData = vjs.getData(event.target);
-
- if (event.target[event.type]) {
-
- targetData.disabled = true;
-
- if (typeof event.target[event.type] === 'function') {
- event.target[event.type]();
- }
-
- targetData.disabled = false;
- }
- }
-
- return !event.isDefaultPrevented();
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- };
- vjs.one = function(elem, type, fn) {
- var func = function(){
- vjs.off(elem, type, func);
- fn.apply(this, arguments);
- };
- func.guid = fn.guid = fn.guid || vjs.guid++;
- vjs.on(elem, type, func);
- };
- var hasOwnProp = Object.prototype.hasOwnProperty;
- vjs.createEl = function(tagName, properties){
- var el, propName;
- el = document.createElement(tagName || 'div');
- for (propName in properties){
- if (hasOwnProp.call(properties, propName)) {
-
-
-
-
-
-
-
-
- if (propName.indexOf('aria-') !== -1 || propName=='role') {
- el.setAttribute(propName, properties[propName]);
- } else {
- el[propName] = properties[propName];
- }
- }
- }
- return el;
- };
- vjs.capitalize = function(string){
- return string.charAt(0).toUpperCase() + string.slice(1);
- };
- vjs.obj = {};
- vjs.obj.create = Object.create || function(obj){
-
- function F() {}
-
-
- F.prototype = obj;
-
- return new F();
- };
- vjs.obj.each = function(obj, fn, context){
- for (var key in obj) {
- if (hasOwnProp.call(obj, key)) {
- fn.call(context || this, key, obj[key]);
- }
- }
- };
- vjs.obj.merge = function(obj1, obj2){
- if (!obj2) { return obj1; }
- for (var key in obj2){
- if (hasOwnProp.call(obj2, key)) {
- obj1[key] = obj2[key];
- }
- }
- return obj1;
- };
- vjs.obj.deepMerge = function(obj1, obj2){
- var key, val1, val2;
-
-
- obj1 = vjs.obj.copy(obj1);
- for (key in obj2){
- if (hasOwnProp.call(obj2, key)) {
- val1 = obj1[key];
- val2 = obj2[key];
-
- if (vjs.obj.isPlain(val1) && vjs.obj.isPlain(val2)) {
- obj1[key] = vjs.obj.deepMerge(val1, val2);
- } else {
- obj1[key] = obj2[key];
- }
- }
- }
- return obj1;
- };
- vjs.obj.copy = function(obj){
- return vjs.obj.merge({}, obj);
- };
- vjs.obj.isPlain = function(obj){
- return !!obj
- && typeof obj === 'object'
- && obj.toString() === '[object Object]'
- && obj.constructor === Object;
- };
- vjs.bind = function(context, fn, uid) {
-
- if (!fn.guid) { fn.guid = vjs.guid++; }
-
- var ret = function() {
- return fn.apply(context, arguments);
- };
-
-
-
-
-
-
- ret.guid = (uid) ? uid + '_' + fn.guid : fn.guid;
- return ret;
- };
- vjs.cache = {};
- vjs.guid = 1;
- vjs.expando = 'vdata' + (new Date()).getTime();
- vjs.getData = function(el){
- var id = el[vjs.expando];
- if (!id) {
- id = el[vjs.expando] = vjs.guid++;
- vjs.cache[id] = {};
- }
- return vjs.cache[id];
- };
- vjs.hasData = function(el){
- var id = el[vjs.expando];
- return !(!id || vjs.isEmpty(vjs.cache[id]));
- };
- vjs.removeData = function(el){
- var id = el[vjs.expando];
- if (!id) { return; }
-
-
-
-
- delete vjs.cache[id];
-
- try {
- delete el[vjs.expando];
- } catch(e) {
- if (el.removeAttribute) {
- el.removeAttribute(vjs.expando);
- } else {
-
- el[vjs.expando] = null;
- }
- }
- };
- vjs.isEmpty = function(obj) {
- for (var prop in obj) {
-
- if (obj[prop] !== null) {
- return false;
- }
- }
- return true;
- };
- vjs.addClass = function(element, classToAdd){
- if ((' '+element.className+' ').indexOf(' '+classToAdd+' ') == -1) {
- element.className = element.className === '' ? classToAdd : element.className + ' ' + classToAdd;
- }
- };
- vjs.removeClass = function(element, classToRemove){
- var classNames, i;
- if (element.className.indexOf(classToRemove) == -1) { return; }
- classNames = element.className.split(' ');
-
- for (i = classNames.length - 1; i >= 0; i--) {
- if (classNames[i] === classToRemove) {
- classNames.splice(i,1);
- }
- }
- element.className = classNames.join(' ');
- };
- vjs.TEST_VID = vjs.createEl('video');
- vjs.USER_AGENT = navigator.userAgent;
- vjs.IS_IPHONE = (/iPhone/i).test(vjs.USER_AGENT);
- vjs.IS_IPAD = (/iPad/i).test(vjs.USER_AGENT);
- vjs.IS_IPOD = (/iPod/i).test(vjs.USER_AGENT);
- vjs.IS_IOS = vjs.IS_IPHONE || vjs.IS_IPAD || vjs.IS_IPOD;
- vjs.IOS_VERSION = (function(){
- var match = vjs.USER_AGENT.match(/OS (\d+)_/i);
- if (match && match[1]) { return match[1]; }
- })();
- vjs.IS_ANDROID = (/Android/i).test(vjs.USER_AGENT);
- vjs.ANDROID_VERSION = (function() {
-
-
- var match = vjs.USER_AGENT.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i),
- major,
- minor;
- if (!match) {
- return null;
- }
- major = match[1] && parseFloat(match[1]);
- minor = match[2] && parseFloat(match[2]);
- if (major && minor) {
- return parseFloat(match[1] + '.' + match[2]);
- } else if (major) {
- return major;
- } else {
- return null;
- }
- })();
- vjs.IS_OLD_ANDROID = vjs.IS_ANDROID && (/webkit/i).test(vjs.USER_AGENT) && vjs.ANDROID_VERSION < 2.3;
- vjs.IS_FIREFOX = (/Firefox/i).test(vjs.USER_AGENT);
- vjs.IS_CHROME = (/Chrome/i).test(vjs.USER_AGENT);
- vjs.TOUCH_ENABLED = !!(('ontouchstart' in window) || window.DocumentTouch && document instanceof window.DocumentTouch);
- vjs.getAttributeValues = function(tag){
- var obj, knownBooleans, attrs, attrName, attrVal;
- obj = {};
-
-
-
- knownBooleans = ','+'autoplay,controls,loop,muted,default'+',';
- if (tag && tag.attributes && tag.attributes.length > 0) {
- attrs = tag.attributes;
- for (var i = attrs.length - 1; i >= 0; i--) {
- attrName = attrs[i].name;
- attrVal = attrs[i].value;
-
-
- if (typeof tag[attrName] === 'boolean' || knownBooleans.indexOf(','+attrName+',') !== -1) {
-
-
-
- attrVal = (attrVal !== null) ? true : false;
- }
- obj[attrName] = attrVal;
- }
- }
- return obj;
- };
- vjs.getComputedDimension = function(el, strCssRule){
- var strValue = '';
- if(document.defaultView && document.defaultView.getComputedStyle){
- strValue = document.defaultView.getComputedStyle(el, '').getPropertyValue(strCssRule);
- } else if(el.currentStyle){
-
- strValue = el['client'+strCssRule.substr(0,1).toUpperCase() + strCssRule.substr(1)] + 'px';
- }
- return strValue;
- };
- vjs.insertFirst = function(child, parent){
- if (parent.firstChild) {
- parent.insertBefore(child, parent.firstChild);
- } else {
- parent.appendChild(child);
- }
- };
- vjs.support = {};
- vjs.el = function(id){
- if (id.indexOf('#') === 0) {
- id = id.slice(1);
- }
- return document.getElementById(id);
- };
- vjs.formatTime = function(seconds, guide) {
-
- guide = guide || seconds;
- var s = Math.floor(seconds % 60),
- m = Math.floor(seconds / 60 % 60),
- h = Math.floor(seconds / 3600),
- gm = Math.floor(guide / 60 % 60),
- gh = Math.floor(guide / 3600);
-
- if (isNaN(seconds) || seconds === Infinity) {
-
-
- h = m = s = '-';
- }
-
- h = (h > 0 || gh > 0) ? h + ':' : '';
-
-
- m = (((h || gm >= 10) && m < 10) ? '0' + m : m) + ':';
-
- s = (s < 10) ? '0' + s : s;
- return h + m + s;
- };
- vjs.blockTextSelection = function(){
- document.body.focus();
- document.onselectstart = function () { return false; };
- };
- vjs.unblockTextSelection = function(){ document.onselectstart = function () { return true; }; };
- vjs.trim = function(str){
- return (str+'').replace(/^\s+|\s+$/g, '');
- };
- vjs.round = function(num, dec) {
- if (!dec) { dec = 0; }
- return Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
- };
- vjs.createTimeRange = function(start, end){
- return {
- length: 1,
- start: function() { return start; },
- end: function() { return end; }
- };
- };
- vjs.get = function(url, onSuccess, onError){
- var local, request;
- if (typeof XMLHttpRequest === 'undefined') {
- window.XMLHttpRequest = function () {
- try { return new window.ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch (e) {}
- try { return new window.ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch (f) {}
- try { return new window.ActiveXObject('Msxml2.XMLHTTP'); } catch (g) {}
- throw new Error('This browser does not support XMLHttpRequest.');
- };
- }
- request = new XMLHttpRequest();
- try {
- request.open('GET', url);
- } catch(e) {
- onError(e);
- }
- local = (url.indexOf('file:') === 0 || (window.location.href.indexOf('file:') === 0 && url.indexOf('http') === -1));
- request.onreadystatechange = function() {
- if (request.readyState === 4) {
- if (request.status === 200 || local && request.status === 0) {
- onSuccess(request.responseText);
- } else {
- if (onError) {
- onError();
- }
- }
- }
- };
- try {
- request.send();
- } catch(e) {
- if (onError) {
- onError(e);
- }
- }
- };
- vjs.setLocalStorage = function(key, value){
- try {
-
- var localStorage = window.localStorage || false;
- if (!localStorage) { return; }
- localStorage[key] = value;
- } catch(e) {
- if (e.code == 22 || e.code == 1014) {
- vjs.log('LocalStorage Full (VideoJS)', e);
- } else {
- if (e.code == 18) {
- vjs.log('LocalStorage not allowed (VideoJS)', e);
- } else {
- vjs.log('LocalStorage Error (VideoJS)', e);
- }
- }
- }
- };
- vjs.getAbsoluteURL = function(url){
-
- if (!url.match(/^https?:\/\//)) {
-
- url = vjs.createEl('div', {
- innerHTML: '<a href="'+url+'">x</a>'
- }).firstChild.href;
- }
- return url;
- };
- vjs.log = function(){
- vjs.log.history = vjs.log.history || [];
- vjs.log.history.push(arguments);
- if(window.console){
- window.console.log(Array.prototype.slice.call(arguments));
- }
- };
- vjs.findPosition = function(el) {
- var box, docEl, body, clientLeft, scrollLeft, left, clientTop, scrollTop, top;
- if (el.getBoundingClientRect && el.parentNode) {
- box = el.getBoundingClientRect();
- }
- if (!box) {
- return {
- left: 0,
- top: 0
- };
- }
- docEl = document.documentElement;
- body = document.body;
- clientLeft = docEl.clientLeft || body.clientLeft || 0;
- scrollLeft = window.pageXOffset || body.scrollLeft;
- left = box.left + scrollLeft - clientLeft;
- clientTop = docEl.clientTop || body.clientTop || 0;
- scrollTop = window.pageYOffset || body.scrollTop;
- top = box.top + scrollTop - clientTop;
- return {
- left: left,
- top: top
- };
- };
- vjs.Component = vjs.CoreObject.extend({
-
- init: function(player, options, ready){
- this.player_ = player;
-
- this.options_ = vjs.obj.copy(this.options_);
-
- options = this.options(options);
-
- this.id_ = options['id'] || ((options['el'] && options['el']['id']) ? options['el']['id'] : player.id() + '_component_' + vjs.guid++ );
- this.name_ = options['name'] || null;
-
- this.el_ = options['el'] || this.createEl();
- this.children_ = [];
- this.childIndex_ = {};
- this.childNameIndex_ = {};
-
- this.initChildren();
- this.ready(ready);
-
-
- }
- });
- vjs.Component.prototype.dispose = function(){
- this.trigger('dispose');
-
- if (this.children_) {
- for (var i = this.children_.length - 1; i >= 0; i--) {
- if (this.children_[i].dispose) {
- this.children_[i].dispose();
- }
- }
- }
-
- this.children_ = null;
- this.childIndex_ = null;
- this.childNameIndex_ = null;
-
- this.off();
-
- if (this.el_.parentNode) {
- this.el_.parentNode.removeChild(this.el_);
- }
- vjs.removeData(this.el_);
- this.el_ = null;
- };
- vjs.Component.prototype.player_ = true;
- vjs.Component.prototype.player = function(){
- return this.player_;
- };
- vjs.Component.prototype.options_;
- vjs.Component.prototype.options = function(obj){
- if (obj === undefined) return this.options_;
- return this.options_ = vjs.obj.deepMerge(this.options_, obj);
- };
- vjs.Component.prototype.el_;
- vjs.Component.prototype.createEl = function(tagName, attributes){
- return vjs.createEl(tagName, attributes);
- };
- vjs.Component.prototype.el = function(){
- return this.el_;
- };
- vjs.Component.prototype.contentEl_;
- vjs.Component.prototype.contentEl = function(){
- return this.contentEl_ || this.el_;
- };
- vjs.Component.prototype.id_;
- vjs.Component.prototype.id = function(){
- return this.id_;
- };
- vjs.Component.prototype.name_;
- vjs.Component.prototype.name = function(){
- return this.name_;
- };
- vjs.Component.prototype.children_;
- vjs.Component.prototype.children = function(){
- return this.children_;
- };
- vjs.Component.prototype.childIndex_;
- vjs.Component.prototype.getChildById = function(id){
- return this.childIndex_[id];
- };
- vjs.Component.prototype.childNameIndex_;
- vjs.Component.prototype.getChild = function(name){
- return this.childNameIndex_[name];
- };
- vjs.Component.prototype.addChild = function(child, options){
- var component, componentClass, componentName, componentId;
-
- if (typeof child === 'string') {
- componentName = child;
-
- options = options || {};
-
- componentClass = options['componentClass'] || vjs.capitalize(componentName);
-
- options['name'] = componentName;
-
-
-
-
- component = new window['videojs'][componentClass](this.player_ || this, options);
-
- } else {
- component = child;
- }
- this.children_.push(component);
- if (typeof component.id === 'function') {
- this.childIndex_[component.id()] = component;
- }
-
-
- componentName = componentName || (component.name && component.name());
- if (componentName) {
- this.childNameIndex_[componentName] = component;
- }
-
-
- if (typeof component['el'] === 'function' && component['el']()) {
- this.contentEl().appendChild(component['el']());
- }
-
- return component;
- };
- vjs.Component.prototype.removeChild = function(component){
- if (typeof component === 'string') {
- component = this.getChild(component);
- }
- if (!component || !this.children_) return;
- var childFound = false;
- for (var i = this.children_.length - 1; i >= 0; i--) {
- if (this.children_[i] === component) {
- childFound = true;
- this.children_.splice(i,1);
- break;
- }
- }
- if (!childFound) return;
- this.childIndex_[component.id] = null;
- this.childNameIndex_[component.name] = null;
- var compEl = component.el();
- if (compEl && compEl.parentNode === this.contentEl()) {
- this.contentEl().removeChild(component.el());
- }
- };
- vjs.Component.prototype.initChildren = function(){
- var options = this.options_;
- if (options && options['children']) {
- var self = this;
-
- vjs.obj.each(options['children'], function(name, opts){
-
-
- if (opts === false) return;
-
- var tempAdd = function(){
-
- self[name] = self.addChild(name, opts);
- };
- if (opts['loadEvent']) {
-
- } else {
- tempAdd();
- }
- });
- }
- };
- vjs.Component.prototype.buildCSSClass = function(){
-
-
- return '';
- };
- vjs.Component.prototype.on = function(type, fn){
- vjs.on(this.el_, type, vjs.bind(this, fn));
- return this;
- };
- vjs.Component.prototype.off = function(type, fn){
- vjs.off(this.el_, type, fn);
- return this;
- };
- vjs.Component.prototype.one = function(type, fn) {
- vjs.one(this.el_, type, vjs.bind(this, fn));
- return this;
- };
- vjs.Component.prototype.trigger = function(type, event){
- vjs.trigger(this.el_, type, event);
- return this;
- };
- vjs.Component.prototype.isReady_;
- vjs.Component.prototype.isReadyOnInitFinish_ = true;
- vjs.Component.prototype.readyQueue_;
- vjs.Component.prototype.ready = function(fn){
- if (fn) {
- if (this.isReady_) {
- fn.call(this);
- } else {
- if (this.readyQueue_ === undefined) {
- this.readyQueue_ = [];
- }
- this.readyQueue_.push(fn);
- }
- }
- return this;
- };
- vjs.Component.prototype.triggerReady = function(){
- this.isReady_ = true;
- var readyQueue = this.readyQueue_;
- if (readyQueue && readyQueue.length > 0) {
- for (var i = 0, j = readyQueue.length; i < j; i++) {
- readyQueue[i].call(this);
- }
-
- this.readyQueue_ = [];
-
- this.trigger('ready');
- }
- };
- vjs.Component.prototype.addClass = function(classToAdd){
- vjs.addClass(this.el_, classToAdd);
- return this;
- };
- vjs.Component.prototype.removeClass = function(classToRemove){
- vjs.removeClass(this.el_, classToRemove);
- return this;
- };
- vjs.Component.prototype.show = function(){
- this.el_.style.display = 'block';
- return this;
- };
- vjs.Component.prototype.hide = function(){
- this.el_.style.display = 'none';
- return this;
- };
- vjs.Component.prototype.lockShowing = function(){
- this.addClass('vjs-lock-showing');
- return this;
- };
- vjs.Component.prototype.unlockShowing = function(){
- this.removeClass('vjs-lock-showing');
- return this;
- };
- vjs.Component.prototype.disable = function(){
- this.hide();
- this.show = function(){};
- };
- vjs.Component.prototype.width = function(num, skipListeners){
- return this.dimension('width', num, skipListeners);
- };
- vjs.Component.prototype.height = function(num, skipListeners){
- return this.dimension('height', num, skipListeners);
- };
- vjs.Component.prototype.dimensions = function(width, height){
-
- return this.width(width, true).height(height);
- };
- vjs.Component.prototype.dimension = function(widthOrHeight, num, skipListeners){
- if (num !== undefined) {
-
- if ((''+num).indexOf('%') !== -1 || (''+num).indexOf('px') !== -1) {
- this.el_.style[widthOrHeight] = num;
- } else if (num === 'auto') {
- this.el_.style[widthOrHeight] = '';
- } else {
- this.el_.style[widthOrHeight] = num+'px';
- }
-
- if (!skipListeners) { this.trigger('resize'); }
-
- return this;
- }
-
-
- if (!this.el_) return 0;
-
- var val = this.el_.style[widthOrHeight];
- var pxIndex = val.indexOf('px');
- if (pxIndex !== -1) {
-
- return parseInt(val.slice(0,pxIndex), 10);
-
-
-
- } else {
- return parseInt(this.el_['offset'+vjs.capitalize(widthOrHeight)], 10);
-
-
-
-
-
-
-
-
-
-
-
- }
- };
- vjs.Component.prototype.onResize;
- vjs.Component.prototype.emitTapEvents = function(){
- var touchStart, touchTime, couldBeTap, noTap;
-
- touchStart = 0;
- this.on('touchstart', function(event) {
-
- touchStart = new Date().getTime();
-
- couldBeTap = true;
- });
- noTap = function(){
- couldBeTap = false;
- };
-
- this.on('touchmove', noTap);
- this.on('touchleave', noTap);
- this.on('touchcancel', noTap);
-
-
- this.on('touchend', function() {
-
- if (couldBeTap === true) {
-
- touchTime = new Date().getTime() - touchStart;
-
- if (touchTime < 250) {
- this.trigger('tap');
-
-
-
- }
- }
- });
- };
- vjs.Button = vjs.Component.extend({
-
- init: function(player, options){
- vjs.Component.call(this, player, options);
- var touchstart = false;
- this.on('touchstart', function(event) {
-
- event.preventDefault();
- touchstart = true;
- });
- this.on('touchmove', function() {
- touchstart = false;
- });
- var self = this;
- this.on('touchend', function(event) {
- if (touchstart) {
- self.onClick(event);
- }
- event.preventDefault();
- });
- this.on('click', this.onClick);
- this.on('focus', this.onFocus);
- this.on('blur', this.onBlur);
- }
- });
- vjs.Button.prototype.createEl = function(type, props){
-
- props = vjs.obj.merge({
- className: this.buildCSSClass(),
- innerHTML: '<div class="vjs-control-content"><span class="vjs-control-text">' + (this.buttonText || 'Need Text') + '</span></div>',
- role: 'button',
- 'aria-live': 'polite',
- tabIndex: 0
- }, props);
- return vjs.Component.prototype.createEl.call(this, type, props);
- };
- vjs.Button.prototype.buildCSSClass = function(){
-
- return 'vjs-control ' + vjs.Component.prototype.buildCSSClass.call(this);
- };
-
- vjs.Button.prototype.onClick = function(){};
-
- vjs.Button.prototype.onFocus = function(){
- vjs.on(document, 'keyup', vjs.bind(this, this.onKeyPress));
- };
-
- vjs.Button.prototype.onKeyPress = function(event){
-
- if (event.which == 32 || event.which == 13) {
- event.preventDefault();
- this.onClick();
- }
- };
- vjs.Button.prototype.onBlur = function(){
- vjs.off(document, 'keyup', vjs.bind(this, this.onKeyPress));
- };
- vjs.Slider = vjs.Component.extend({
-
- init: function(player, options){
- vjs.Component.call(this, player, options);
-
- this.bar = this.getChild(this.options_['barName']);
- this.handle = this.getChild(this.options_['handleName']);
- player.on(this.playerEvent, vjs.bind(this, this.update));
- this.on('mousedown', this.onMouseDown);
- this.on('touchstart', this.onMouseDown);
- this.on('focus', this.onFocus);
- this.on('blur', this.onBlur);
- this.on('click', this.onClick);
- this.player_.on('controlsvisible', vjs.bind(this, this.update));
-
-
- player.ready(vjs.bind(this, this.update));
- this.boundEvents = {};
- }
- });
- vjs.Slider.prototype.createEl = function(type, props) {
- props = props || {};
-
- props.className = props.className + ' vjs-slider';
- props = vjs.obj.merge({
- role: 'slider',
- 'aria-valuenow': 0,
- 'aria-valuemin': 0,
- 'aria-valuemax': 100,
- tabIndex: 0
- }, props);
- return vjs.Component.prototype.createEl.call(this, type, props);
- };
- vjs.Slider.prototype.onMouseDown = function(event){
- event.preventDefault();
- vjs.blockTextSelection();
- this.boundEvents.move = vjs.bind(this, this.onMouseMove);
- this.boundEvents.end = vjs.bind(this, this.onMouseUp);
- vjs.on(document, 'mousemove', this.boundEvents.move);
- vjs.on(document, 'mouseup', this.boundEvents.end);
- vjs.on(document, 'touchmove', this.boundEvents.move);
- vjs.on(document, 'touchend', this.boundEvents.end);
- this.onMouseMove(event);
- };
- vjs.Slider.prototype.onMouseUp = function() {
- vjs.unblockTextSelection();
- vjs.off(document, 'mousemove', this.boundEvents.move, false);
- vjs.off(document, 'mouseup', this.boundEvents.end, false);
- vjs.off(document, 'touchmove', this.boundEvents.move, false);
- vjs.off(document, 'touchend', this.boundEvents.end, false);
- this.update();
- };
- vjs.Slider.prototype.update = function(){
-
-
- if (!this.el_) return;
-
-
-
- var barProgress,
- progress = this.getPercent(),
- handle = this.handle,
- bar = this.bar;
-
- if (isNaN(progress)) { progress = 0; }
- barProgress = progress;
-
-
- if (handle) {
- var box = this.el_,
- boxWidth = box.offsetWidth,
- handleWidth = handle.el().offsetWidth,
-
-
- handlePercent = (handleWidth) ? handleWidth / boxWidth : 0,
-
-
- boxAdjustedPercent = 1 - handlePercent,
-
- adjustedProgress = progress * boxAdjustedPercent;
-
- barProgress = adjustedProgress + (handlePercent / 2);
-
- handle.el().style.left = vjs.round(adjustedProgress * 100, 2) + '%';
- }
-
- bar.el().style.width = vjs.round(barProgress * 100, 2) + '%';
- };
- vjs.Slider.prototype.calculateDistance = function(event){
- var el, box, boxX, boxY, boxW, boxH, handle, pageX, pageY;
- el = this.el_;
- box = vjs.findPosition(el);
- boxW = boxH = el.offsetWidth;
- handle = this.handle;
- if (this.options_.vertical) {
- boxY = box.top;
- if (event.changedTouches) {
- pageY = event.changedTouches[0].pageY;
- } else {
- pageY = event.pageY;
- }
- if (handle) {
- var handleH = handle.el().offsetHeight;
-
- boxY = boxY + (handleH / 2);
- boxH = boxH - handleH;
- }
-
- return Math.max(0, Math.min(1, ((boxY - pageY) + boxH) / boxH));
- } else {
- boxX = box.left;
- if (event.changedTouches) {
- pageX = event.changedTouches[0].pageX;
- } else {
- pageX = event.pageX;
- }
- if (handle) {
- var handleW = handle.el().offsetWidth;
-
- boxX = boxX + (handleW / 2);
- boxW = boxW - handleW;
- }
-
- return Math.max(0, Math.min(1, (pageX - boxX) / boxW));
- }
- };
- vjs.Slider.prototype.onFocus = function(){
- vjs.on(document, 'keyup', vjs.bind(this, this.onKeyPress));
- };
- vjs.Slider.prototype.onKeyPress = function(event){
- if (event.which == 37) {
- event.preventDefault();
- this.stepBack();
- } else if (event.which == 39) {
- event.preventDefault();
- this.stepForward();
- }
- };
- vjs.Slider.prototype.onBlur = function(){
- vjs.off(document, 'keyup', vjs.bind(this, this.onKeyPress));
- };
- vjs.Slider.prototype.onClick = function(event){
- event.stopImmediatePropagation();
- event.preventDefault();
- };
- vjs.SliderHandle = vjs.Component.extend();
- vjs.SliderHandle.prototype.defaultValue = 0;
- vjs.SliderHandle.prototype.createEl = function(type, props) {
- props = props || {};
-
- props.className = props.className + ' vjs-slider-handle';
- props = vjs.obj.merge({
- innerHTML: '<span class="vjs-control-text">'+this.defaultValue+'</span>'
- }, props);
- return vjs.Component.prototype.createEl.call(this, 'div', props);
- };
- vjs.Menu = vjs.Component.extend();
- vjs.Menu.prototype.addItem = function(component){
- this.addChild(component);
- component.on('click', vjs.bind(this, function(){
- this.unlockShowing();
- }));
- };
- vjs.Menu.prototype.createEl = function(){
- var contentElType = this.options().contentElType || 'ul';
- this.contentEl_ = vjs.createEl(contentElType, {
- className: 'vjs-menu-content'
- });
- var el = vjs.Component.prototype.createEl.call(this, 'div', {
- append: this.contentEl_,
- className: 'vjs-menu'
- });
- el.appendChild(this.contentEl_);
-
-
- vjs.on(el, 'click', function(event){
- event.preventDefault();
- event.stopImmediatePropagation();
- });
- return el;
- };
- vjs.MenuItem = vjs.Button.extend({
-
- init: function(player, options){
- vjs.Button.call(this, player, options);
- this.selected(options['selected']);
- }
- });
- vjs.MenuItem.prototype.createEl = function(type, props){
- return vjs.Button.prototype.createEl.call(this, 'li', vjs.obj.merge({
- className: 'vjs-menu-item',
- innerHTML: this.options_['label']
- }, props));
- };
- vjs.MenuItem.prototype.onClick = function(){
- this.selected(true);
- };
- vjs.MenuItem.prototype.selected = function(selected){
- if (selected) {
- this.addClass('vjs-selected');
- this.el_.setAttribute('aria-selected',true);
- } else {
- this.removeClass('vjs-selected');
- this.el_.setAttribute('aria-selected',false);
- }
- };
- vjs.MenuButton = vjs.Button.extend({
-
- init: function(player, options){
- vjs.Button.call(this, player, options);
- this.menu = this.createMenu();
-
- this.addChild(this.menu);
-
- if (this.items && this.items.length === 0) {
- this.hide();
- }
- this.on('keyup', this.onKeyPress);
- this.el_.setAttribute('aria-haspopup', true);
- this.el_.setAttribute('role', 'button');
- }
- });
- vjs.MenuButton.prototype.buttonPressed_ = false;
- vjs.MenuButton.prototype.createMenu = function(){
- var menu = new vjs.Menu(this.player_);
-
- if (this.options().title) {
- menu.el().appendChild(vjs.createEl('li', {
- className: 'vjs-menu-title',
- innerHTML: vjs.capitalize(this.kind_),
- tabindex: -1
- }));
- }
- this.items = this['createItems']();
- if (this.items) {
-
- for (var i = 0; i < this.items.length; i++) {
- menu.addItem(this.items[i]);
- }
- }
- return menu;
- };
- vjs.MenuButton.prototype.createItems = function(){};
- vjs.MenuButton.prototype.buildCSSClass = function(){
- return this.className + ' vjs-menu-button ' + vjs.Button.prototype.buildCSSClass.call(this);
- };
- vjs.MenuButton.prototype.onFocus = function(){};
- vjs.MenuButton.prototype.onBlur = function(){};
- vjs.MenuButton.prototype.onClick = function(){
-
-
-
- this.one('mouseout', vjs.bind(this, function(){
- this.menu.unlockShowing();
- this.el_.blur();
- }));
- if (this.buttonPressed_){
- this.unpressButton();
- } else {
- this.pressButton();
- }
- };
- vjs.MenuButton.prototype.onKeyPress = function(event){
- event.preventDefault();
-
- if (event.which == 32 || event.which == 13) {
- if (this.buttonPressed_){
- this.unpressButton();
- } else {
- this.pressButton();
- }
-
- } else if (event.which == 27){
- if (this.buttonPressed_){
- this.unpressButton();
- }
- }
- };
- vjs.MenuButton.prototype.pressButton = function(){
- this.buttonPressed_ = true;
- this.menu.lockShowing();
- this.el_.setAttribute('aria-pressed', true);
- if (this.items && this.items.length > 0) {
- this.items[0].el().focus();
- }
- };
- vjs.MenuButton.prototype.unpressButton = function(){
- this.buttonPressed_ = false;
- this.menu.unlockShowing();
- this.el_.setAttribute('aria-pressed', false);
- };
- vjs.Player = vjs.Component.extend({
-
- init: function(tag, options, ready){
- this.tag = tag;
-
-
-
-
-
- options = vjs.obj.merge(this.getTagSettings(tag), options);
-
- this.cache_ = {};
-
- this.poster_ = options['poster'];
-
- this.controls_ = options['controls'];
-
-
-
- tag.controls = false;
-
-
-
- vjs.Component.call(this, this, options, ready);
-
-
- if (this.controls()) {
- this.addClass('vjs-controls-enabled');
- } else {
- this.addClass('vjs-controls-disabled');
- }
-
-
-
-
-
-
-
- this.one('play', function(e){
- var fpEvent = { type: 'firstplay', target: this.el_ };
-
- var keepGoing = vjs.trigger(this.el_, fpEvent);
- if (!keepGoing) {
- e.preventDefault();
- e.stopPropagation();
- e.stopImmediatePropagation();
- }
- });
- this.on('ended', this.onEnded);
- this.on('play', this.onPlay);
- this.on('firstplay', this.onFirstPlay);
- this.on('pause', this.onPause);
- this.on('progress', this.onProgress);
- this.on('durationchange', this.onDurationChange);
- this.on('error', this.onError);
- this.on('fullscreenchange', this.onFullscreenChange);
-
- vjs.players[this.id_] = this;
- if (options['plugins']) {
- vjs.obj.each(options['plugins'], function(key, val){
- this[key](val);
- }, this);
- }
- this.listenForUserActivity();
- }
- });
- vjs.Player.prototype.options_ = vjs.options;
- vjs.Player.prototype.dispose = function(){
- this.trigger('dispose');
-
- this.off('dispose');
-
- vjs.players[this.id_] = null;
- if (this.tag && this.tag['player']) { this.tag['player'] = null; }
- if (this.el_ && this.el_['player']) { this.el_['player'] = null; }
-
- this.stopTrackingProgress();
- this.stopTrackingCurrentTime();
- if (this.tech) { this.tech.dispose(); }
-
- vjs.Component.prototype.dispose.call(this);
- };
- vjs.Player.prototype.getTagSettings = function(tag){
- var options = {
- 'sources': [],
- 'tracks': []
- };
- vjs.obj.merge(options, vjs.getAttributeValues(tag));
-
- if (tag.hasChildNodes()) {
- var children, child, childName, i, j;
- children = tag.childNodes;
- for (i=0,j=children.length; i<j; i++) {
- child = children[i];
-
- childName = child.nodeName.toLowerCase();
- if (childName === 'source') {
- options['sources'].push(vjs.getAttributeValues(child));
- } else if (childName === 'track') {
- options['tracks'].push(vjs.getAttributeValues(child));
- }
- }
- }
- return options;
- };
- vjs.Player.prototype.createEl = function(){
- var el = this.el_ = vjs.Component.prototype.createEl.call(this, 'div');
- var tag = this.tag;
-
- tag.removeAttribute('width');
- tag.removeAttribute('height');
-
-
-
-
- if (tag.hasChildNodes()) {
- var nodes, nodesLength, i, node, nodeName, removeNodes;
- nodes = tag.childNodes;
- nodesLength = nodes.length;
- removeNodes = [];
- while (nodesLength--) {
- node = nodes[nodesLength];
- nodeName = node.nodeName.toLowerCase();
- if (nodeName === 'track') {
- removeNodes.push(node);
- }
- }
- for (i=0; i<removeNodes.length; i++) {
- tag.removeChild(removeNodes[i]);
- }
- }
-
- tag.id = tag.id || 'vjs_video_' + vjs.guid++;
-
-
- el.id = tag.id;
- el.className = tag.className;
-
-
-
- tag.id += '_html5_api';
- tag.className = 'vjs-tech';
-
- tag['player'] = el['player'] = this;
-
- this.addClass('vjs-paused');
-
-
- this.width(this.options_['width'], true);
- this.height(this.options_['height'], true);
-
- if (tag.parentNode) {
- tag.parentNode.insertBefore(el, tag);
- }
- vjs.insertFirst(tag, el);
- return el;
- };
- vjs.Player.prototype.loadTech = function(techName, source){
-
- if (this.tech) {
- this.unloadTech();
-
-
- } else if (techName !== 'Html5' && this.tag) {
- vjs.Html5.disposeMediaElement(this.tag);
- this.tag = null;
- }
- this.techName = techName;
-
- this.isReady_ = false;
- var techReady = function(){
- this.player_.triggerReady();
-
- if (!this.features['progressEvents']) {
- this.player_.manualProgressOn();
- }
-
- if (!this.features['timeupdateEvents']) {
- this.player_.manualTimeUpdatesOn();
- }
- };
-
- var techOptions = vjs.obj.merge({ 'source': source, 'parentEl': this.el_ }, this.options_[techName.toLowerCase()]);
- if (source) {
- if (source.src == this.cache_.src && this.cache_.currentTime > 0) {
- techOptions['startTime'] = this.cache_.currentTime;
- }
- this.cache_.src = source.src;
- }
-
- this.tech = new window['videojs'][techName](this, techOptions);
- this.tech.ready(techReady);
- };
- vjs.Player.prototype.unloadTech = function(){
- this.isReady_ = false;
- this.tech.dispose();
-
- if (this.manualProgress) { this.manualProgressOff(); }
- if (this.manualTimeUpdates) { this.manualTimeUpdatesOff(); }
- this.tech = false;
- };
- vjs.Player.prototype.manualProgressOn = function(){
- this.manualProgress = true;
-
- this.trackProgress();
-
-
-
-
- this.tech.one('progress', function(){
-
- this.features['progressEvents'] = true;
-
- this.player_.manualProgressOff();
- });
- };
- vjs.Player.prototype.manualProgressOff = function(){
- this.manualProgress = false;
- this.stopTrackingProgress();
- };
- vjs.Player.prototype.trackProgress = function(){
- this.progressInterval = setInterval(vjs.bind(this, function(){
-
-
-
- if (this.cache_.bufferEnd < this.buffered().end(0)) {
- this.trigger('progress');
- } else if (this.bufferedPercent() == 1) {
- this.stopTrackingProgress();
- this.trigger('progress');
- }
- }), 500);
- };
- vjs.Player.prototype.stopTrackingProgress = function(){ clearInterval(this.progressInterval); };
- vjs.Player.prototype.manualTimeUpdatesOn = function(){
- this.manualTimeUpdates = true;
- this.on('play', this.trackCurrentTime);
- this.on('pause', this.stopTrackingCurrentTime);
-
-
- this.tech.one('timeupdate', function(){
-
- this.features['timeupdateEvents'] = true;
-
- this.player_.manualTimeUpdatesOff();
- });
- };
- vjs.Player.prototype.manualTimeUpdatesOff = function(){
- this.manualTimeUpdates = false;
- this.stopTrackingCurrentTime();
- this.off('play', this.trackCurrentTime);
- this.off('pause', this.stopTrackingCurrentTime);
- };
- vjs.Player.prototype.trackCurrentTime = function(){
- if (this.currentTimeInterval) { this.stopTrackingCurrentTime(); }
- this.currentTimeInterval = setInterval(vjs.bind(this, function(){
- this.trigger('timeupdate');
- }), 250);
- };
- vjs.Player.prototype.stopTrackingCurrentTime = function(){ clearInterval(this.currentTimeInterval); };
- vjs.Player.prototype.onLoadStart;
- vjs.Player.prototype.onLoadedMetaData;
- vjs.Player.prototype.onLoadedData;
- vjs.Player.prototype.onLoadedAllData;
- vjs.Player.prototype.onPlay = function(){
- vjs.removeClass(this.el_, 'vjs-paused');
- vjs.addClass(this.el_, 'vjs-playing');
- };
- vjs.Player.prototype.onFirstPlay = function(){
-
-
- if(this.options_['starttime']){
- this.currentTime(this.options_['starttime']);
- }
- this.addClass('vjs-has-started');
- };
- vjs.Player.prototype.onPause = function(){
- vjs.removeClass(this.el_, 'vjs-playing');
- vjs.addClass(this.el_, 'vjs-paused');
- };
- vjs.Player.prototype.onTimeUpdate;
- vjs.Player.prototype.onProgress = function(){
-
- if (this.bufferedPercent() == 1) {
- this.trigger('loadedalldata');
- }
- };
- vjs.Player.prototype.onEnded = function(){
- if (this.options_['loop']) {
- this.currentTime(0);
- this.play();
- }
- };
- vjs.Player.prototype.onDurationChange = function(){
-
- this.duration(this.techGet('duration'));
- };
- vjs.Player.prototype.onVolumeChange;
- vjs.Player.prototype.onFullscreenChange = function() {
- if (this.isFullScreen) {
- this.addClass('vjs-fullscreen');
- } else {
- this.removeClass('vjs-fullscreen');
- }
- };
- vjs.Player.prototype.onError = function(e) {
- vjs.log('Video Error', e);
- };
- vjs.Player.prototype.cache_;
- vjs.Player.prototype.getCache = function(){
- return this.cache_;
- };
- vjs.Player.prototype.techCall = function(method, arg){
-
- if (this.tech && !this.tech.isReady_) {
- this.tech.ready(function(){
- this[method](arg);
- });
-
- } else {
- try {
- this.tech[method](arg);
- } catch(e) {
- vjs.log(e);
- throw e;
- }
- }
- };
- vjs.Player.prototype.techGet = function(method){
- if (this.tech && this.tech.isReady_) {
-
-
-
- try {
- return this.tech[method]();
- } catch(e) {
-
- if (this.tech[method] === undefined) {
- vjs.log('Video.js: ' + method + ' method not defined for '+this.techName+' playback technology.', e);
- } else {
-
- if (e.name == 'TypeError') {
- vjs.log('Video.js: ' + method + ' unavailable on '+this.techName+' playback technology element.', e);
- this.tech.isReady_ = false;
- } else {
- vjs.log(e);
- }
- }
- throw e;
- }
- }
- return;
- };
- vjs.Player.prototype.play = function(){
- this.techCall('play');
- return this;
- };
- vjs.Player.prototype.pause = function(){
- this.techCall('pause');
- return this;
- };
- vjs.Player.prototype.paused = function(){
-
- return (this.techGet('paused') === false) ? false : true;
- };
- vjs.Player.prototype.currentTime = function(seconds){
- if (seconds !== undefined) {
-
- this.cache_.lastSetCurrentTime = seconds;
- this.techCall('setCurrentTime', seconds);
-
- if (this.manualTimeUpdates) { this.trigger('timeupdate'); }
- return this;
- }
-
-
- return this.cache_.currentTime = (this.techGet('currentTime') || 0);
- };
- vjs.Player.prototype.duration = function(seconds){
- if (seconds !== undefined) {
-
- this.cache_.duration = parseFloat(seconds);
- return this;
- }
- if (this.cache_.duration === undefined) {
- this.onDurationChange();
- }
- return this.cache_.duration;
- };
- vjs.Player.prototype.remainingTime = function(){
- return this.duration() - this.currentTime();
- };
- vjs.Player.prototype.buffered = function(){
- var buffered = this.techGet('buffered'),
- start = 0,
- buflast = buffered.length - 1,
-
- end = this.cache_.bufferEnd = this.cache_.bufferEnd || 0;
- if (buffered && buflast >= 0 && buffered.end(buflast) !== end) {
- end = buffered.end(buflast);
-
- this.cache_.bufferEnd = end;
- }
- return vjs.createTimeRange(start, end);
- };
- vjs.Player.prototype.bufferedPercent = function(){
- return (this.duration()) ? this.buffered().end(0) / this.duration() : 0;
- };
- vjs.Player.prototype.volume = function(percentAsDecimal){
- var vol;
- if (percentAsDecimal !== undefined) {
- vol = Math.max(0, Math.min(1, parseFloat(percentAsDecimal)));
- this.cache_.volume = vol;
- this.techCall('setVolume', vol);
- vjs.setLocalStorage('volume', vol);
- return this;
- }
-
- vol = parseFloat(this.techGet('volume'));
- return (isNaN(vol)) ? 1 : vol;
- };
- vjs.Player.prototype.muted = function(muted){
- if (muted !== undefined) {
- this.techCall('setMuted', muted);
- return this;
- }
- return this.techGet('muted') || false;
- };
- vjs.Player.prototype.supportsFullScreen = function(){ return this.techGet('supportsFullScreen') || false; };
- vjs.Player.prototype.requestFullScreen = function(){
- var requestFullScreen = vjs.support.requestFullScreen;
- this.isFullScreen = true;
- if (requestFullScreen) {
-
-
-
-
-
-
-
- vjs.on(document, requestFullScreen.eventName, vjs.bind(this, function(e){
- this.isFullScreen = document[requestFullScreen.isFullScreen];
-
- if (this.isFullScreen === false) {
- vjs.off(document, requestFullScreen.eventName, arguments.callee);
- }
- this.trigger('fullscreenchange');
- }));
- this.el_[requestFullScreen.requestFn]();
- } else if (this.tech.supportsFullScreen()) {
-
-
- this.techCall('enterFullScreen');
- } else {
-
-
- this.enterFullWindow();
- this.trigger('fullscreenchange');
- }
- return this;
- };
- vjs.Player.prototype.cancelFullScreen = function(){
- var requestFullScreen = vjs.support.requestFullScreen;
- this.isFullScreen = false;
-
- if (requestFullScreen) {
- document[requestFullScreen.cancelFn]();
- } else if (this.tech.supportsFullScreen()) {
- this.techCall('exitFullScreen');
- } else {
- this.exitFullWindow();
- this.trigger('fullscreenchange');
- }
- return this;
- };
- vjs.Player.prototype.enterFullWindow = function(){
- this.isFullWindow = true;
-
- this.docOrigOverflow = document.documentElement.style.overflow;
-
- vjs.on(document, 'keydown', vjs.bind(this, this.fullWindowOnEscKey));
-
- document.documentElement.style.overflow = 'hidden';
-
- vjs.addClass(document.body, 'vjs-full-window');
- this.trigger('enterFullWindow');
- };
- vjs.Player.prototype.fullWindowOnEscKey = function(event){
- if (event.keyCode === 27) {
- if (this.isFullScreen === true) {
- this.cancelFullScreen();
- } else {
- this.exitFullWindow();
- }
- }
- };
- vjs.Player.prototype.exitFullWindow = function(){
- this.isFullWindow = false;
- vjs.off(document, 'keydown', this.fullWindowOnEscKey);
-
- document.documentElement.style.overflow = this.docOrigOverflow;
-
- vjs.removeClass(document.body, 'vjs-full-window');
-
-
- this.trigger('exitFullWindow');
- };
- vjs.Player.prototype.selectSource = function(sources){
-
- for (var i=0,j=this.options_['techOrder'];i<j.length;i++) {
- var techName = vjs.capitalize(j[i]),
- tech = window['videojs'][techName];
-
- if (tech.isSupported()) {
-
- for (var a=0,b=sources;a<b.length;a++) {
- var source = b[a];
-
- if (tech['canPlaySource'](source)) {
- return { source: source, tech: techName };
- }
- }
- }
- }
- return false;
- };
- vjs.Player.prototype.src = function(source){
-
- if (source instanceof Array) {
- var sourceTech = this.selectSource(source),
- techName;
- if (sourceTech) {
- source = sourceTech.source;
- techName = sourceTech.tech;
-
- if (techName == this.techName) {
- this.src(source);
-
- } else {
- this.loadTech(techName, source);
- }
- } else {
- this.el_.appendChild(vjs.createEl('p', {
- innerHTML: this.options()['notSupportedMessage']
- }));
- }
-
- } else if (source instanceof Object) {
- if (window['videojs'][this.techName]['canPlaySource'](source)) {
- this.src(source.src);
- } else {
-
- this.src([source]);
- }
-
- } else {
-
- this.cache_.src = source;
- if (!this.isReady_) {
- this.ready(function(){
- this.src(source);
- });
- } else {
- this.techCall('src', source);
- if (this.options_['preload'] == 'auto') {
- this.load();
- }
- if (this.options_['autoplay']) {
- this.play();
- }
- }
- }
- return this;
- };
- vjs.Player.prototype.load = function(){
- this.techCall('load');
- return this;
- };
- vjs.Player.prototype.currentSrc = function(){
- return this.techGet('currentSrc') || this.cache_.src || '';
- };
- vjs.Player.prototype.preload = function(value){
- if (value !== undefined) {
- this.techCall('setPreload', value);
- this.options_['preload'] = value;
- return this;
- }
- return this.techGet('preload');
- };
- vjs.Player.prototype.autoplay = function(value){
- if (value !== undefined) {
- this.techCall('setAutoplay', value);
- this.options_['autoplay'] = value;
- return this;
- }
- return this.techGet('autoplay', value);
- };
- vjs.Player.prototype.loop = function(value){
- if (value !== undefined) {
- this.techCall('setLoop', value);
- this.options_['loop'] = value;
- return this;
- }
- return this.techGet('loop');
- };
- vjs.Player.prototype.poster_;
- vjs.Player.prototype.poster = function(src){
- if (src !== undefined) {
- this.poster_ = src;
- return this;
- }
- return this.poster_;
- };
- vjs.Player.prototype.controls_;
- vjs.Player.prototype.controls = function(bool){
- if (bool !== undefined) {
- bool = !!bool;
-
- if (this.controls_ !== bool) {
- this.controls_ = bool;
- if (bool) {
- this.removeClass('vjs-controls-disabled');
- this.addClass('vjs-controls-enabled');
- this.trigger('controlsenabled');
- } else {
- this.removeClass('vjs-controls-enabled');
- this.addClass('vjs-controls-disabled');
- this.trigger('controlsdisabled');
- }
- }
- return this;
- }
- return this.controls_;
- };
- vjs.Player.prototype.usingNativeControls_;
- vjs.Player.prototype.usingNativeControls = function(bool){
- if (bool !== undefined) {
- bool = !!bool;
-
- if (this.usingNativeControls_ !== bool) {
- this.usingNativeControls_ = bool;
- if (bool) {
- this.addClass('vjs-using-native-controls');
-
- this.trigger('usingnativecontrols');
- } else {
- this.removeClass('vjs-using-native-controls');
-
- this.trigger('usingcustomcontrols');
- }
- }
- return this;
- }
- return this.usingNativeControls_;
- };
- vjs.Player.prototype.error = function(){ return this.techGet('error'); };
- vjs.Player.prototype.ended = function(){ return this.techGet('ended'); };
- vjs.Player.prototype.seeking = function(){ return this.techGet('seeking'); };
- vjs.Player.prototype.userActivity_ = true;
- vjs.Player.prototype.reportUserActivity = function(event){
- this.userActivity_ = true;
- };
- vjs.Player.prototype.userActive_ = true;
- vjs.Player.prototype.userActive = function(bool){
- if (bool !== undefined) {
- bool = !!bool;
- if (bool !== this.userActive_) {
- this.userActive_ = bool;
- if (bool) {
-
-
- this.userActivity_ = true;
- this.removeClass('vjs-user-inactive');
- this.addClass('vjs-user-active');
- this.trigger('useractive');
- } else {
-
-
- this.userActivity_ = false;
-
-
-
-
-
-
-
-
- this.tech.one('mousemove', function(e){
- e.stopPropagation();
- e.preventDefault();
- });
- this.removeClass('vjs-user-active');
- this.addClass('vjs-user-inactive');
- this.trigger('userinactive');
- }
- }
- return this;
- }
- return this.userActive_;
- };
- vjs.Player.prototype.listenForUserActivity = function(){
- var onMouseActivity, onMouseDown, mouseInProgress, onMouseUp,
- activityCheck, inactivityTimeout;
- onMouseActivity = this.reportUserActivity;
- onMouseDown = function() {
- onMouseActivity();
-
-
-
- clearInterval(mouseInProgress);
-
-
-
- mouseInProgress = setInterval(vjs.bind(this, onMouseActivity), 250);
- };
- onMouseUp = function(event) {
- onMouseActivity();
-
- clearInterval(mouseInProgress);
- };
-
- this.on('mousedown', onMouseDown);
- this.on('mousemove', onMouseActivity);
- this.on('mouseup', onMouseUp);
-
-
- this.on('keydown', onMouseActivity);
- this.on('keyup', onMouseActivity);
-
-
-
- this.on('touchstart', onMouseDown);
- this.on('touchmove', onMouseActivity);
- this.on('touchend', onMouseUp);
- this.on('touchcancel', onMouseUp);
-
-
-
-
-
- activityCheck = setInterval(vjs.bind(this, function() {
-
- if (this.userActivity_) {
-
- this.userActivity_ = false;
-
- this.userActive(true);
-
- clearTimeout(inactivityTimeout);
-
-
- inactivityTimeout = setTimeout(vjs.bind(this, function() {
-
-
-
- if (!this.userActivity_) {
- this.userActive(false);
- }
- }), 2000);
- }
- }), 250);
-
- this.on('dispose', function(){
- clearInterval(activityCheck);
- clearTimeout(inactivityTimeout);
- });
- };
- (function(){
- var prefix, requestFS, div;
- div = document.createElement('div');
- requestFS = {};
-
-
-
-
- if (div.cancelFullscreen !== undefined) {
- requestFS.requestFn = 'requestFullscreen';
- requestFS.cancelFn = 'exitFullscreen';
- requestFS.eventName = 'fullscreenchange';
- requestFS.isFullScreen = 'fullScreen';
-
-
-
-
-
- } else {
- if (document.mozCancelFullScreen) {
- prefix = 'moz';
- requestFS.isFullScreen = prefix + 'FullScreen';
- } else {
- prefix = 'webkit';
- requestFS.isFullScreen = prefix + 'IsFullScreen';
- }
- if (div[prefix + 'RequestFullScreen']) {
- requestFS.requestFn = prefix + 'RequestFullScreen';
- requestFS.cancelFn = prefix + 'CancelFullScreen';
- }
- requestFS.eventName = prefix + 'fullscreenchange';
- }
- if (document[requestFS.cancelFn]) {
- vjs.support.requestFullScreen = requestFS;
- }
- })();
- vjs.ControlBar = vjs.Component.extend();
- vjs.ControlBar.prototype.options_ = {
- loadEvent: 'play',
- children: {
- 'playToggle': {},
- 'currentTimeDisplay': {},
- 'timeDivider': {},
- 'durationDisplay': {},
- 'remainingTimeDisplay': {},
- 'progressControl': {},
- 'fullscreenToggle': {},
- 'volumeControl': {},
- 'muteToggle': {}
-
- }
- };
- vjs.ControlBar.prototype.createEl = function(){
- return vjs.createEl('div', {
- className: 'vjs-control-bar'
- });
- };
- vjs.PlayToggle = vjs.Button.extend({
-
- init: function(player, options){
- vjs.Button.call(this, player, options);
- player.on('play', vjs.bind(this, this.onPlay));
- player.on('pause', vjs.bind(this, this.onPause));
- }
- });
- vjs.PlayToggle.prototype.buttonText = 'Play';
- vjs.PlayToggle.prototype.buildCSSClass = function(){
- return 'vjs-play-control ' + vjs.Button.prototype.buildCSSClass.call(this);
- };
- vjs.PlayToggle.prototype.onClick = function(){
- if (this.player_.paused()) {
- this.player_.play();
- } else {
- this.player_.pause();
- }
- };
-
- vjs.PlayToggle.prototype.onPlay = function(){
- vjs.removeClass(this.el_, 'vjs-paused');
- vjs.addClass(this.el_, 'vjs-playing');
- this.el_.children[0].children[0].innerHTML = 'Pause';
- };
-
- vjs.PlayToggle.prototype.onPause = function(){
- vjs.removeClass(this.el_, 'vjs-playing');
- vjs.addClass(this.el_, 'vjs-paused');
- this.el_.children[0].children[0].innerHTML = 'Play';
- };
- vjs.CurrentTimeDisplay = vjs.Component.extend({
-
- init: function(player, options){
- vjs.Component.call(this, player, options);
- player.on('timeupdate', vjs.bind(this, this.updateContent));
- }
- });
- vjs.CurrentTimeDisplay.prototype.createEl = function(){
- var el = vjs.Component.prototype.createEl.call(this, 'div', {
- className: 'vjs-current-time vjs-time-controls vjs-control'
- });
- this.content = vjs.createEl('div', {
- className: 'vjs-current-time-display',
- innerHTML: '<span class="vjs-control-text">Current Time </span>' + '0:00',
- 'aria-live': 'off'
- });
- el.appendChild(vjs.createEl('div').appendChild(this.content));
- return el;
- };
- vjs.CurrentTimeDisplay.prototype.updateContent = function(){
-
- var time = (this.player_.scrubbing) ? this.player_.getCache().currentTime : this.player_.currentTime();
- this.content.innerHTML = '<span class="vjs-control-text">Current Time </span>' + vjs.formatTime(time, this.player_.duration());
- };
- vjs.DurationDisplay = vjs.Component.extend({
-
- init: function(player, options){
- vjs.Component.call(this, player, options);
- player.on('timeupdate', vjs.bind(this, this.updateContent));
- }
- });
- vjs.DurationDisplay.prototype.createEl = function(){
- var el = vjs.Component.prototype.createEl.call(this, 'div', {
- className: 'vjs-duration vjs-time-controls vjs-control'
- });
- this.content = vjs.createEl('div', {
- className: 'vjs-duration-display',
- innerHTML: '<span class="vjs-control-text">Duration Time </span>' + '0:00',
- 'aria-live': 'off'
- });
- el.appendChild(vjs.createEl('div').appendChild(this.content));
- return el;
- };
- vjs.DurationDisplay.prototype.updateContent = function(){
- var duration = this.player_.duration();
- if (duration) {
- this.content.innerHTML = '<span class="vjs-control-text">Duration Time </span>' + vjs.formatTime(duration);
- }
- };
- vjs.TimeDivider = vjs.Component.extend({
-
- init: function(player, options){
- vjs.Component.call(this, player, options);
- }
- });
- vjs.TimeDivider.prototype.createEl = function(){
- return vjs.Component.prototype.createEl.call(this, 'div', {
- className: 'vjs-time-divider',
- innerHTML: '<div><span>/</span></div>'
- });
- };
- vjs.RemainingTimeDisplay = vjs.Component.extend({
-
- init: function(player, options){
- vjs.Component.call(this, player, options);
- player.on('timeupdate', vjs.bind(this, this.updateContent));
- }
- });
- vjs.RemainingTimeDisplay.prototype.createEl = function(){
- var el = vjs.Component.prototype.createEl.call(this, 'div', {
- className: 'vjs-remaining-time vjs-time-controls vjs-control'
- });
- this.content = vjs.createEl('div', {
- className: 'vjs-remaining-time-display',
- innerHTML: '<span class="vjs-control-text">Remaining Time </span>' + '-0:00',
- 'aria-live': 'off'
- });
- el.appendChild(vjs.createEl('div').appendChild(this.content));
- return el;
- };
- vjs.RemainingTimeDisplay.prototype.updateContent = function(){
- if (this.player_.duration()) {
- this.content.innerHTML = '<span class="vjs-control-text">Remaining Time </span>' + '-'+ vjs.formatTime(this.player_.remainingTime());
- }
-
-
-
- };
- vjs.FullscreenToggle = vjs.Button.extend({
-
- init: function(player, options){
- vjs.Button.call(this, player, options);
- }
- });
- vjs.FullscreenToggle.prototype.buttonText = 'Fullscreen';
- vjs.FullscreenToggle.prototype.buildCSSClass = function(){
- return 'vjs-fullscreen-control ' + vjs.Button.prototype.buildCSSClass.call(this);
- };
- vjs.FullscreenToggle.prototype.onClick = function(){
- if (!this.player_.isFullScreen) {
- this.player_.requestFullScreen();
- this.el_.children[0].children[0].innerHTML = 'Non-Fullscreen';
- } else {
- this.player_.cancelFullScreen();
- this.el_.children[0].children[0].innerHTML = 'Fullscreen';
- }
- };
- vjs.ProgressControl = vjs.Component.extend({
-
- init: function(player, options){
- vjs.Component.call(this, player, options);
- }
- });
- vjs.ProgressControl.prototype.options_ = {
- children: {
- 'seekBar': {}
- }
- };
- vjs.ProgressControl.prototype.createEl = function(){
- return vjs.Component.prototype.createEl.call(this, 'div', {
- className: 'vjs-progress-control vjs-control'
- });
- };
- vjs.SeekBar = vjs.Slider.extend({
-
- init: function(player, options){
- vjs.Slider.call(this, player, options);
- player.on('timeupdate', vjs.bind(this, this.updateARIAAttributes));
- player.ready(vjs.bind(this, this.updateARIAAttributes));
- }
- });
- vjs.SeekBar.prototype.options_ = {
- children: {
- 'loadProgressBar': {},
- 'playProgressBar': {},
- 'seekHandle': {}
- },
- 'barName': 'playProgressBar',
- 'handleName': 'seekHandle'
- };
- vjs.SeekBar.prototype.playerEvent = 'timeupdate';
- vjs.SeekBar.prototype.createEl = function(){
- return vjs.Slider.prototype.createEl.call(this, 'div', {
- className: 'vjs-progress-holder',
- 'aria-label': 'video progress bar'
- });
- };
- vjs.SeekBar.prototype.updateARIAAttributes = function(){
-
- var time = (this.player_.scrubbing) ? this.player_.getCache().currentTime : this.player_.currentTime();
- this.el_.setAttribute('aria-valuenow',vjs.round(this.getPercent()*100, 2));
- this.el_.setAttribute('aria-valuetext',vjs.formatTime(time, this.player_.duration()));
- };
- vjs.SeekBar.prototype.getPercent = function(){
- var currentTime;
-
-
-
-
- if (this.player_.techName === 'Flash' && this.player_.seeking()) {
- var cache = this.player_.getCache();
- if (cache.lastSetCurrentTime) {
- currentTime = cache.lastSetCurrentTime;
- }
- else {
- currentTime = this.player_.currentTime();
- }
- }
- else {
- currentTime = this.player_.currentTime();
- }
- return currentTime / this.player_.duration();
- };
- vjs.SeekBar.prototype.onMouseDown = function(event){
- vjs.Slider.prototype.onMouseDown.call(this, event);
- this.player_.scrubbing = true;
- this.videoWasPlaying = !this.player_.paused();
- this.player_.pause();
- };
- vjs.SeekBar.prototype.onMouseMove = function(event){
- var newTime = this.calculateDistance(event) * this.player_.duration();
-
- if (newTime == this.player_.duration()) { newTime = newTime - 0.1; }
-
- this.player_.currentTime(newTime);
- };
- vjs.SeekBar.prototype.onMouseUp = function(event){
- vjs.Slider.prototype.onMouseUp.call(this, event);
- this.player_.scrubbing = false;
- if (this.videoWasPlaying) {
- this.player_.play();
- }
- };
- vjs.SeekBar.prototype.stepForward = function(){
- this.player_.currentTime(this.player_.currentTime() + 5);
- };
- vjs.SeekBar.prototype.stepBack = function(){
- this.player_.currentTime(this.player_.currentTime() - 5);
- };
- vjs.LoadProgressBar = vjs.Component.extend({
-
- init: function(player, options){
- vjs.Component.call(this, player, options);
- player.on('progress', vjs.bind(this, this.update));
- }
- });
- vjs.LoadProgressBar.prototype.createEl = function(){
- return vjs.Component.prototype.createEl.call(this, 'div', {
- className: 'vjs-load-progress',
- innerHTML: '<span class="vjs-control-text">Loaded: 0%</span>'
- });
- };
- vjs.LoadProgressBar.prototype.update = function(){
- if (this.el_.style) { this.el_.style.width = vjs.round(this.player_.bufferedPercent() * 100, 2) + '%'; }
- };
- vjs.PlayProgressBar = vjs.Component.extend({
-
- init: function(player, options){
- vjs.Component.call(this, player, options);
- }
- });
- vjs.PlayProgressBar.prototype.createEl = function(){
- return vjs.Component.prototype.createEl.call(this, 'div', {
- className: 'vjs-play-progress',
- innerHTML: '<span class="vjs-control-text">Progress: 0%</span>'
- });
- };
- vjs.SeekHandle = vjs.SliderHandle.extend();
- vjs.SeekHandle.prototype.defaultValue = '00:00';
- vjs.SeekHandle.prototype.createEl = function(){
- return vjs.SliderHandle.prototype.createEl.call(this, 'div', {
- className: 'vjs-seek-handle'
- });
- };
- vjs.VolumeControl = vjs.Component.extend({
-
- init: function(player, options){
- vjs.Component.call(this, player, options);
-
- if (player.tech && player.tech.features && player.tech.features['volumeControl'] === false) {
- this.addClass('vjs-hidden');
- }
- player.on('loadstart', vjs.bind(this, function(){
- if (player.tech.features && player.tech.features['volumeControl'] === false) {
- this.addClass('vjs-hidden');
- } else {
- this.removeClass('vjs-hidden');
- }
- }));
- }
- });
- vjs.VolumeControl.prototype.options_ = {
- children: {
- 'volumeBar': {}
- }
- };
- vjs.VolumeControl.prototype.createEl = function(){
- return vjs.Component.prototype.createEl.call(this, 'div', {
- className: 'vjs-volume-control vjs-control'
- });
- };
- vjs.VolumeBar = vjs.Slider.extend({
-
- init: function(player, options){
- vjs.Slider.call(this, player, options);
- player.on('volumechange', vjs.bind(this, this.updateARIAAttributes));
- player.ready(vjs.bind(this, this.updateARIAAttributes));
- setTimeout(vjs.bind(this, this.update), 0);
- }
- });
- vjs.VolumeBar.prototype.updateARIAAttributes = function(){
-
- this.el_.setAttribute('aria-valuenow',vjs.round(this.player_.volume()*100, 2));
- this.el_.setAttribute('aria-valuetext',vjs.round(this.player_.volume()*100, 2)+'%');
- };
- vjs.VolumeBar.prototype.options_ = {
- children: {
- 'volumeLevel': {},
- 'volumeHandle': {}
- },
- 'barName': 'volumeLevel',
- 'handleName': 'volumeHandle'
- };
- vjs.VolumeBar.prototype.playerEvent = 'volumechange';
- vjs.VolumeBar.prototype.createEl = function(){
- return vjs.Slider.prototype.createEl.call(this, 'div', {
- className: 'vjs-volume-bar',
- 'aria-label': 'volume level'
- });
- };
- vjs.VolumeBar.prototype.onMouseMove = function(event) {
- if (this.player_.muted()) {
- this.player_.muted(false);
- }
- this.player_.volume(this.calculateDistance(event));
- };
- vjs.VolumeBar.prototype.getPercent = function(){
- if (this.player_.muted()) {
- return 0;
- } else {
- return this.player_.volume();
- }
- };
- vjs.VolumeBar.prototype.stepForward = function(){
- this.player_.volume(this.player_.volume() + 0.1);
- };
- vjs.VolumeBar.prototype.stepBack = function(){
- this.player_.volume(this.player_.volume() - 0.1);
- };
- vjs.VolumeLevel = vjs.Component.extend({
-
- init: function(player, options){
- vjs.Component.call(this, player, options);
- }
- });
- vjs.VolumeLevel.prototype.createEl = function(){
- return vjs.Component.prototype.createEl.call(this, 'div', {
- className: 'vjs-volume-level',
- innerHTML: '<span class="vjs-control-text"></span>'
- });
- };
- vjs.VolumeHandle = vjs.SliderHandle.extend();
- vjs.VolumeHandle.prototype.defaultValue = '00:00';
-
- vjs.VolumeHandle.prototype.createEl = function(){
- return vjs.SliderHandle.prototype.createEl.call(this, 'div', {
- className: 'vjs-volume-handle'
- });
- };
- vjs.MuteToggle = vjs.Button.extend({
-
- init: function(player, options){
- vjs.Button.call(this, player, options);
- player.on('volumechange', vjs.bind(this, this.update));
-
- if (player.tech && player.tech.features && player.tech.features['volumeControl'] === false) {
- this.addClass('vjs-hidden');
- }
- player.on('loadstart', vjs.bind(this, function(){
- if (player.tech.features && player.tech.features['volumeControl'] === false) {
- this.addClass('vjs-hidden');
- } else {
- this.removeClass('vjs-hidden');
- }
- }));
- }
- });
- vjs.MuteToggle.prototype.createEl = function(){
- return vjs.Button.prototype.createEl.call(this, 'div', {
- className: 'vjs-mute-control vjs-control',
- innerHTML: '<div><span class="vjs-control-text">Mute</span></div>'
- });
- };
- vjs.MuteToggle.prototype.onClick = function(){
- this.player_.muted( this.player_.muted() ? false : true );
- };
- vjs.MuteToggle.prototype.update = function(){
- var vol = this.player_.volume(),
- level = 3;
- if (vol === 0 || this.player_.muted()) {
- level = 0;
- } else if (vol < 0.33) {
- level = 1;
- } else if (vol < 0.67) {
- level = 2;
- }
-
-
-
- if(this.player_.muted()){
- if(this.el_.children[0].children[0].innerHTML!='Unmute'){
- this.el_.children[0].children[0].innerHTML = 'Unmute';
- }
- } else {
- if(this.el_.children[0].children[0].innerHTML!='Mute'){
- this.el_.children[0].children[0].innerHTML = 'Mute';
- }
- }
-
- for (var i = 0; i < 4; i++) {
- vjs.removeClass(this.el_, 'vjs-vol-'+i);
- }
- vjs.addClass(this.el_, 'vjs-vol-'+level);
- };
- vjs.VolumeMenuButton = vjs.MenuButton.extend({
-
- init: function(player, options){
- vjs.MenuButton.call(this, player, options);
-
- player.on('volumechange', vjs.bind(this, this.update));
-
- if (player.tech && player.tech.features && player.tech.features.volumeControl === false) {
- this.addClass('vjs-hidden');
- }
- player.on('loadstart', vjs.bind(this, function(){
- if (player.tech.features && player.tech.features.volumeControl === false) {
- this.addClass('vjs-hidden');
- } else {
- this.removeClass('vjs-hidden');
- }
- }));
- this.addClass('vjs-menu-button');
- }
- });
- vjs.VolumeMenuButton.prototype.createMenu = function(){
- var menu = new vjs.Menu(this.player_, {
- contentElType: 'div'
- });
- var vc = new vjs.VolumeBar(this.player_, vjs.obj.merge({vertical: true}, this.options_.volumeBar));
- menu.addChild(vc);
- return menu;
- };
- vjs.VolumeMenuButton.prototype.onClick = function(){
- vjs.MuteToggle.prototype.onClick.call(this);
- vjs.MenuButton.prototype.onClick.call(this);
- };
- vjs.VolumeMenuButton.prototype.createEl = function(){
- return vjs.Button.prototype.createEl.call(this, 'div', {
- className: 'vjs-volume-menu-button vjs-menu-button vjs-control',
- innerHTML: '<div><span class="vjs-control-text">Mute</span></div>'
- });
- };
- vjs.VolumeMenuButton.prototype.update = vjs.MuteToggle.prototype.update;
- vjs.PosterImage = vjs.Button.extend({
-
- init: function(player, options){
- vjs.Button.call(this, player, options);
- if (!player.poster() || !player.controls()) {
- this.hide();
- }
- player.on('play', vjs.bind(this, this.hide));
- }
- });
- vjs.PosterImage.prototype.createEl = function(){
- var el = vjs.createEl('div', {
- className: 'vjs-poster',
-
- tabIndex: -1
- }),
- poster = this.player_.poster();
- if (poster) {
- if ('backgroundSize' in el.style) {
- el.style.backgroundImage = 'url("' + poster + '")';
- } else {
- el.appendChild(vjs.createEl('img', { src: poster }));
- }
- }
- return el;
- };
- vjs.PosterImage.prototype.onClick = function(){
-
- if (this.player().controls()) {
- this.player_.play();
- }
- };
- vjs.LoadingSpinner = vjs.Component.extend({
-
- init: function(player, options){
- vjs.Component.call(this, player, options);
- player.on('canplay', vjs.bind(this, this.hide));
- player.on('canplaythrough', vjs.bind(this, this.hide));
- player.on('playing', vjs.bind(this, this.hide));
- player.on('seeked', vjs.bind(this, this.hide));
- player.on('seeking', vjs.bind(this, this.show));
-
-
-
- player.on('seeked', vjs.bind(this, this.hide));
- player.on('error', vjs.bind(this, this.show));
-
-
-
- player.on('waiting', vjs.bind(this, this.show));
- }
- });
- vjs.LoadingSpinner.prototype.createEl = function(){
- return vjs.Component.prototype.createEl.call(this, 'div', {
- className: 'vjs-loading-spinner'
- });
- };
- vjs.BigPlayButton = vjs.Button.extend();
- vjs.BigPlayButton.prototype.createEl = function(){
- return vjs.Button.prototype.createEl.call(this, 'div', {
- className: 'vjs-big-play-button',
- innerHTML: '<span aria-hidden="true"></span>',
- 'aria-label': 'play video'
- });
- };
- vjs.BigPlayButton.prototype.onClick = function(){
- this.player_.play();
- };
- vjs.MediaTechController = vjs.Component.extend({
-
- init: function(player, options, ready){
- vjs.Component.call(this, player, options, ready);
- this.initControlsListeners();
- }
- });
- vjs.MediaTechController.prototype.initControlsListeners = function(){
- var player, tech, activateControls, deactivateControls;
- tech = this;
- player = this.player();
- var activateControls = function(){
- if (player.controls() && !player.usingNativeControls()) {
- tech.addControlsListeners();
- }
- };
- deactivateControls = vjs.bind(tech, tech.removeControlsListeners);
-
-
- this.ready(activateControls);
- player.on('controlsenabled', activateControls);
- player.on('controlsdisabled', deactivateControls);
- };
- vjs.MediaTechController.prototype.addControlsListeners = function(){
- var preventBubble, userWasActive;
-
-
-
-
- this.on('mousedown', this.onClick);
-
-
-
-
-
-
-
-
-
-
-
- this.on('touchstart', function(event) {
-
- event.preventDefault();
- event.stopPropagation();
-
- userWasActive = this.player_.userActive();
- });
- preventBubble = function(event){
- event.stopPropagation();
- if (userWasActive) {
- this.player_.reportUserActivity();
- }
- };
-
- this.on('touchmove', preventBubble);
- this.on('touchleave', preventBubble);
- this.on('touchcancel', preventBubble);
- this.on('touchend', preventBubble);
-
- this.emitTapEvents();
-
-
- this.on('tap', this.onTap);
- };
- vjs.MediaTechController.prototype.removeControlsListeners = function(){
-
-
- this.off('tap');
- this.off('touchstart');
- this.off('touchmove');
- this.off('touchleave');
- this.off('touchcancel');
- this.off('touchend');
- this.off('click');
- this.off('mousedown');
- };
- vjs.MediaTechController.prototype.onClick = function(event){
-
-
- if (event.button !== 0) return;
-
-
- if (this.player().controls()) {
- if (this.player().paused()) {
- this.player().play();
- } else {
- this.player().pause();
- }
- }
- };
- vjs.MediaTechController.prototype.onTap = function(){
- this.player().userActive(!this.player().userActive());
- };
- vjs.MediaTechController.prototype.features = {
- 'volumeControl': true,
-
- 'fullscreenResize': false,
-
-
- 'progressEvents': false,
- 'timeupdateEvents': false
- };
- vjs.media = {};
- vjs.media.ApiMethods = 'play,pause,paused,currentTime,setCurrentTime,duration,buffered,volume,setVolume,muted,setMuted,width,height,supportsFullScreen,enterFullScreen,src,load,currentSrc,preload,setPreload,autoplay,setAutoplay,loop,setLoop,error,networkState,readyState,seeking,initialTime,startOffsetTime,played,seekable,ended,videoTracks,audioTracks,videoWidth,videoHeight,textTracks,defaultPlaybackRate,playbackRate,mediaGroup,controller,controls,defaultMuted'.split(',');
- function createMethod(methodName){
- return function(){
- throw new Error('The "'+methodName+'" method is not available on the playback technology\'s API');
- };
- }
- for (var i = vjs.media.ApiMethods.length - 1; i >= 0; i--) {
- var methodName = vjs.media.ApiMethods[i];
- vjs.MediaTechController.prototype[vjs.media.ApiMethods[i]] = createMethod(methodName);
- }
- vjs.Html5 = vjs.MediaTechController.extend({
-
- init: function(player, options, ready){
-
- this.features['volumeControl'] = vjs.Html5.canControlVolume();
-
- this.features['movingMediaElementInDOM'] = !vjs.IS_IOS;
-
- this.features['fullscreenResize'] = true;
- vjs.MediaTechController.call(this, player, options, ready);
- var source = options['source'];
-
-
- if (source && this.el_.currentSrc === source.src && this.el_.networkState > 0) {
- player.trigger('loadstart');
-
- } else if (source) {
- this.el_.src = source.src;
- }
-
-
-
-
- if (vjs.TOUCH_ENABLED && player.options()['nativeControlsForTouch'] !== false) {
- this.useNativeControls();
- }
-
-
-
-
- player.ready(function(){
- if (this.tag && this.options_['autoplay'] && this.paused()) {
- delete this.tag['poster'];
- this.play();
- }
- });
- this.setupTriggers();
- this.triggerReady();
- }
- });
- vjs.Html5.prototype.dispose = function(){
- vjs.MediaTechController.prototype.dispose.call(this);
- };
- vjs.Html5.prototype.createEl = function(){
- var player = this.player_,
-
- el = player.tag,
- newEl,
- clone;
-
-
-
- if (!el || this.features['movingMediaElementInDOM'] === false) {
-
- if (el) {
- clone = el.cloneNode(false);
- vjs.Html5.disposeMediaElement(el);
- el = clone;
- player.tag = null;
- } else {
- el = vjs.createEl('video', {
- id:player.id() + '_html5_api',
- className:'vjs-tech'
- });
- }
-
- el['player'] = player;
- vjs.insertFirst(el, player.el());
- }
-
- var attrs = ['autoplay','preload','loop','muted'];
- for (var i = attrs.length - 1; i >= 0; i--) {
- var attr = attrs[i];
- if (player.options_[attr] !== null) {
- el[attr] = player.options_[attr];
- }
- }
- return el;
-
- };
- vjs.Html5.prototype.setupTriggers = function(){
- for (var i = vjs.Html5.Events.length - 1; i >= 0; i--) {
- vjs.on(this.el_, vjs.Html5.Events[i], vjs.bind(this.player_, this.eventHandler));
- }
- };
- vjs.Html5.prototype.eventHandler = function(e){
- this.trigger(e);
-
- e.stopPropagation();
- };
- vjs.Html5.prototype.useNativeControls = function(){
- var tech, player, controlsOn, controlsOff, cleanUp;
- tech = this;
- player = this.player();
-
- tech.setControls(player.controls());
-
- controlsOn = function(){
- tech.setControls(true);
- };
- controlsOff = function(){
- tech.setControls(false);
- };
- player.on('controlsenabled', controlsOn);
- player.on('controlsdisabled', controlsOff);
-
- cleanUp = function(){
- player.off('controlsenabled', controlsOn);
- player.off('controlsdisabled', controlsOff);
- };
- tech.on('dispose', cleanUp);
- player.on('usingcustomcontrols', cleanUp);
-
- player.usingNativeControls(true);
- };
- vjs.Html5.prototype.play = function(){ this.el_.play(); };
- vjs.Html5.prototype.pause = function(){ this.el_.pause(); };
- vjs.Html5.prototype.paused = function(){ return this.el_.paused; };
- vjs.Html5.prototype.currentTime = function(){ return this.el_.currentTime; };
- vjs.Html5.prototype.setCurrentTime = function(seconds){
- try {
- this.el_.currentTime = seconds;
- } catch(e) {
- vjs.log(e, 'Video is not ready. (Video.js)');
-
- }
- };
- vjs.Html5.prototype.duration = function(){ return this.el_.duration || 0; };
- vjs.Html5.prototype.buffered = function(){ return this.el_.buffered; };
- vjs.Html5.prototype.volume = function(){ return this.el_.volume; };
- vjs.Html5.prototype.setVolume = function(percentAsDecimal){ this.el_.volume = percentAsDecimal; };
- vjs.Html5.prototype.muted = function(){ return this.el_.muted; };
- vjs.Html5.prototype.setMuted = function(muted){ this.el_.muted = muted; };
- vjs.Html5.prototype.width = function(){ return this.el_.offsetWidth; };
- vjs.Html5.prototype.height = function(){ return this.el_.offsetHeight; };
- vjs.Html5.prototype.supportsFullScreen = function(){
- if (typeof this.el_.webkitEnterFullScreen == 'function') {
-
- if (/Android/.test(vjs.USER_AGENT) || !/Chrome|Mac OS X 10.5/.test(vjs.USER_AGENT)) {
- return true;
- }
- }
- return false;
- };
- vjs.Html5.prototype.enterFullScreen = function(){
- var video = this.el_;
- if (video.paused && video.networkState <= video.HAVE_METADATA) {
-
-
- this.el_.play();
-
-
- setTimeout(function(){
- video.pause();
- video.webkitEnterFullScreen();
- }, 0);
- } else {
- video.webkitEnterFullScreen();
- }
- };
- vjs.Html5.prototype.exitFullScreen = function(){
- this.el_.webkitExitFullScreen();
- };
- vjs.Html5.prototype.src = function(src){ this.el_.src = src; };
- vjs.Html5.prototype.load = function(){ this.el_.load(); };
- vjs.Html5.prototype.currentSrc = function(){ return this.el_.currentSrc; };
- vjs.Html5.prototype.preload = function(){ return this.el_.preload; };
- vjs.Html5.prototype.setPreload = function(val){ this.el_.preload = val; };
- vjs.Html5.prototype.autoplay = function(){ return this.el_.autoplay; };
- vjs.Html5.prototype.setAutoplay = function(val){ this.el_.autoplay = val; };
- vjs.Html5.prototype.controls = function(){ return this.el_.controls; }
- vjs.Html5.prototype.setControls = function(val){ this.el_.controls = !!val; }
- vjs.Html5.prototype.loop = function(){ return this.el_.loop; };
- vjs.Html5.prototype.setLoop = function(val){ this.el_.loop = val; };
- vjs.Html5.prototype.error = function(){ return this.el_.error; };
- vjs.Html5.prototype.seeking = function(){ return this.el_.seeking; };
- vjs.Html5.prototype.ended = function(){ return this.el_.ended; };
- vjs.Html5.prototype.defaultMuted = function(){ return this.el_.defaultMuted; };
- vjs.Html5.isSupported = function(){
- return !!vjs.TEST_VID.canPlayType;
- };
- vjs.Html5.canPlaySource = function(srcObj){
-
-
- try {
- return !!vjs.TEST_VID.canPlayType(srcObj.type);
- } catch(e) {
- return '';
- }
-
-
-
- };
- vjs.Html5.canControlVolume = function(){
- var volume = vjs.TEST_VID.volume;
- vjs.TEST_VID.volume = (volume / 2) + 0.1;
- return volume !== vjs.TEST_VID.volume;
- };
- vjs.Html5.Events = 'loadstart,suspend,abort,error,emptied,stalled,loadedmetadata,loadeddata,canplay,canplaythrough,playing,waiting,seeking,seeked,ended,durationchange,timeupdate,progress,play,pause,ratechange,volumechange'.split(',');
- vjs.Html5.disposeMediaElement = function(el){
- if (!el) { return; }
- el['player'] = null;
- if (el.parentNode) {
- el.parentNode.removeChild(el);
- }
-
- while(el.hasChildNodes()) {
- el.removeChild(el.firstChild);
- }
-
-
- el.removeAttribute('src');
-
- if (typeof el.load === 'function') {
- el.load();
- }
- };
-
- if (vjs.IS_OLD_ANDROID) {
- document.createElement('video').constructor.prototype.canPlayType = function(type){
- return (type && type.toLowerCase().indexOf('video/mp4') != -1) ? 'maybe' : '';
- };
- }
- vjs.Flash = vjs.MediaTechController.extend({
-
- init: function(player, options, ready){
- vjs.MediaTechController.call(this, player, options, ready);
- var source = options['source'],
-
- parentEl = options['parentEl'],
-
- placeHolder = this.el_ = vjs.createEl('div', { id: player.id() + '_temp_flash' }),
-
- objId = player.id()+'_flash_api',
-
-
-
- playerOptions = player.options_,
-
- flashVars = vjs.obj.merge({
-
- 'readyFunction': 'videojs.Flash.onReady',
- 'eventProxyFunction': 'videojs.Flash.onEvent',
- 'errorEventProxyFunction': 'videojs.Flash.onError',
-
- 'autoplay': playerOptions.autoplay,
- 'preload': playerOptions.preload,
- 'loop': playerOptions.loop,
- 'muted': playerOptions.muted
- }, options['flashVars']),
-
- params = vjs.obj.merge({
- 'wmode': 'opaque',
- 'bgcolor': '#000000'
- }, options['params']),
-
- attributes = vjs.obj.merge({
- 'id': objId,
- 'name': objId,
- 'class': 'vjs-tech'
- }, options['attributes'])
- ;
-
- if (source) {
- if (source.type && vjs.Flash.isStreamingType(source.type)) {
- var parts = vjs.Flash.streamToParts(source.src);
- flashVars['rtmpConnection'] = encodeURIComponent(parts.connection);
- flashVars['rtmpStream'] = encodeURIComponent(parts.stream);
- }
- else {
- flashVars['src'] = encodeURIComponent(vjs.getAbsoluteURL(source.src));
- }
- }
-
- vjs.insertFirst(placeHolder, parentEl);
-
-
- if (options['startTime']) {
- this.ready(function(){
- this.load();
- this.play();
- this.currentTime(options['startTime']);
- });
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if (options['iFrameMode'] === true && !vjs.IS_FIREFOX) {
-
- var iFrm = vjs.createEl('iframe', {
- 'id': objId + '_iframe',
- 'name': objId + '_iframe',
- 'className': 'vjs-tech',
- 'scrolling': 'no',
- 'marginWidth': 0,
- 'marginHeight': 0,
- 'frameBorder': 0
- });
-
- flashVars['readyFunction'] = 'ready';
- flashVars['eventProxyFunction'] = 'events';
- flashVars['errorEventProxyFunction'] = 'errors';
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- vjs.on(iFrm, 'load', vjs.bind(this, function(){
- var iDoc,
- iWin = iFrm.contentWindow;
-
-
-
-
-
-
-
-
-
- iDoc = iFrm.contentDocument ? iFrm.contentDocument : iFrm.contentWindow.document;
-
-
-
-
-
-
-
-
-
-
-
- iDoc.write(vjs.Flash.getEmbedCode(options['swf'], flashVars, params, attributes));
-
-
- iWin['player'] = this.player_;
-
- iWin['ready'] = vjs.bind(this.player_, function(currSwf){
- var el = iDoc.getElementById(currSwf),
- player = this,
- tech = player.tech;
-
- tech.el_ = el;
-
- vjs.Flash.checkReady(tech);
- });
-
- iWin['events'] = vjs.bind(this.player_, function(swfID, eventName){
- var player = this;
- if (player && player.techName === 'flash') {
- player.trigger(eventName);
- }
- });
-
- iWin['errors'] = vjs.bind(this.player_, function(swfID, eventName){
- vjs.log('Flash Error', eventName);
- });
- }));
-
- placeHolder.parentNode.replaceChild(iFrm, placeHolder);
-
- } else {
- vjs.Flash.embed(options['swf'], placeHolder, flashVars, params, attributes);
- }
- }
- });
- vjs.Flash.prototype.dispose = function(){
- vjs.MediaTechController.prototype.dispose.call(this);
- };
- vjs.Flash.prototype.play = function(){
- this.el_.vjs_play();
- };
- vjs.Flash.prototype.pause = function(){
- this.el_.vjs_pause();
- };
- vjs.Flash.prototype.src = function(src){
- if (vjs.Flash.isStreamingSrc(src)) {
- src = vjs.Flash.streamToParts(src);
- this.setRtmpConnection(src.connection);
- this.setRtmpStream(src.stream);
- }
- else {
-
- src = vjs.getAbsoluteURL(src);
- this.el_.vjs_src(src);
- }
-
-
- if (this.player_.autoplay()) {
- var tech = this;
- setTimeout(function(){ tech.play(); }, 0);
- }
- };
- vjs.Flash.prototype.currentSrc = function(){
- var src = this.el_.vjs_getProperty('currentSrc');
-
- if (src == null) {
- var connection = this.rtmpConnection(),
- stream = this.rtmpStream();
- if (connection && stream) {
- src = vjs.Flash.streamFromParts(connection, stream);
- }
- }
- return src;
- };
- vjs.Flash.prototype.load = function(){
- this.el_.vjs_load();
- };
- vjs.Flash.prototype.poster = function(){
- this.el_.vjs_getProperty('poster');
- };
- vjs.Flash.prototype.buffered = function(){
- return vjs.createTimeRange(0, this.el_.vjs_getProperty('buffered'));
- };
- vjs.Flash.prototype.supportsFullScreen = function(){
- return false;
- };
- vjs.Flash.prototype.enterFullScreen = function(){
- return false;
- };
- var api = vjs.Flash.prototype,
- readWrite = 'rtmpConnection,rtmpStream,preload,currentTime,defaultPlaybackRate,playbackRate,autoplay,loop,mediaGroup,controller,controls,volume,muted,defaultMuted'.split(','),
- readOnly = 'error,currentSrc,networkState,readyState,seeking,initialTime,duration,startOffsetTime,paused,played,seekable,ended,videoTracks,audioTracks,videoWidth,videoHeight,textTracks'.split(',');
-
- var createSetter = function(attr){
- var attrUpper = attr.charAt(0).toUpperCase() + attr.slice(1);
- api['set'+attrUpper] = function(val){ return this.el_.vjs_setProperty(attr, val); };
- };
- var createGetter = function(attr){
- api[attr] = function(){ return this.el_.vjs_getProperty(attr); };
- };
- (function(){
- var i;
-
- for (i = 0; i < readWrite.length; i++) {
- createGetter(readWrite[i]);
- createSetter(readWrite[i]);
- }
-
- for (i = 0; i < readOnly.length; i++) {
- createGetter(readOnly[i]);
- }
- })();
- vjs.Flash.isSupported = function(){
- return vjs.Flash.version()[0] >= 10;
-
- };
- vjs.Flash.canPlaySource = function(srcObj){
- var type;
- if (!srcObj.type) {
- return '';
- }
- type = srcObj.type.replace(/;.*/,'').toLowerCase();
- if (type in vjs.Flash.formats || type in vjs.Flash.streamingFormats) {
- return 'maybe';
- }
- };
- vjs.Flash.formats = {
- 'video/flv': 'FLV',
- 'video/x-flv': 'FLV',
- 'video/mp4': 'MP4',
- 'video/m4v': 'MP4'
- };
- vjs.Flash.streamingFormats = {
- 'rtmp/mp4': 'MP4',
- 'rtmp/flv': 'FLV'
- };
- vjs.Flash['onReady'] = function(currSwf){
- var el = vjs.el(currSwf);
-
-
- var player = el['player'] || el.parentNode['player'],
- tech = player.tech;
-
- el['player'] = player;
-
- tech.el_ = el;
- vjs.Flash.checkReady(tech);
- };
- vjs.Flash.checkReady = function(tech){
-
- if (tech.el().vjs_getProperty) {
-
- tech.triggerReady();
-
- } else {
- setTimeout(function(){
- vjs.Flash.checkReady(tech);
- }, 50);
- }
- };
- vjs.Flash['onEvent'] = function(swfID, eventName){
- var player = vjs.el(swfID)['player'];
- player.trigger(eventName);
- };
- vjs.Flash['onError'] = function(swfID, err){
- var player = vjs.el(swfID)['player'];
- player.trigger('error');
- vjs.log('Flash Error', err, swfID);
- };
- vjs.Flash.version = function(){
- var version = '0,0,0';
-
- try {
- version = new window.ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
-
- } catch(e) {
- try {
- if (navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin){
- version = (navigator.plugins['Shockwave Flash 2.0'] || navigator.plugins['Shockwave Flash']).description.replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
- }
- } catch(err) {}
- }
- return version.split(',');
- };
- vjs.Flash.embed = function(swf, placeHolder, flashVars, params, attributes){
- var code = vjs.Flash.getEmbedCode(swf, flashVars, params, attributes),
-
- obj = vjs.createEl('div', { innerHTML: code }).childNodes[0],
- par = placeHolder.parentNode
- ;
- placeHolder.parentNode.replaceChild(obj, placeHolder);
-
-
- var newObj = par.childNodes[0];
- setTimeout(function(){
- newObj.style.display = 'block';
- }, 1000);
- return obj;
- };
- vjs.Flash.getEmbedCode = function(swf, flashVars, params, attributes){
- var objTag = '<object type="application/x-shockwave-flash"',
- flashVarsString = '',
- paramsString = '',
- attrsString = '';
-
- if (flashVars) {
- vjs.obj.each(flashVars, function(key, val){
- flashVarsString += (key + '=' + val + '&');
- });
- }
-
- params = vjs.obj.merge({
- 'movie': swf,
- 'flashvars': flashVarsString,
- 'allowScriptAccess': 'always',
- 'allowNetworking': 'all'
- }, params);
-
- vjs.obj.each(params, function(key, val){
- paramsString += '<param name="'+key+'" value="'+val+'" />';
- });
- attributes = vjs.obj.merge({
-
- 'data': swf,
-
- 'width': '100%',
- 'height': '100%'
- }, attributes);
-
- vjs.obj.each(attributes, function(key, val){
- attrsString += (key + '="' + val + '" ');
- });
- return objTag + attrsString + '>' + paramsString + '</object>';
- };
- vjs.Flash.streamFromParts = function(connection, stream) {
- return connection + '&' + stream;
- };
- vjs.Flash.streamToParts = function(src) {
- var parts = {
- connection: '',
- stream: ''
- };
- if (! src) {
- return parts;
- }
-
-
-
- var connEnd = src.indexOf('&');
- var streamBegin;
- if (connEnd !== -1) {
- streamBegin = connEnd + 1;
- }
- else {
-
- connEnd = streamBegin = src.lastIndexOf('/') + 1;
- if (connEnd === 0) {
-
- connEnd = streamBegin = src.length;
- }
- }
- parts.connection = src.substring(0, connEnd);
- parts.stream = src.substring(streamBegin, src.length);
- return parts;
- };
- vjs.Flash.isStreamingType = function(srcType) {
- return srcType in vjs.Flash.streamingFormats;
- };
- vjs.Flash.RTMP_RE = /^rtmp[set]?:\/\//i;
- vjs.Flash.isStreamingSrc = function(src) {
- return vjs.Flash.RTMP_RE.test(src);
- };
- vjs.MediaLoader = vjs.Component.extend({
-
- init: function(player, options, ready){
- vjs.Component.call(this, player, options, ready);
-
-
- if (!player.options_['sources'] || player.options_['sources'].length === 0) {
- for (var i=0,j=player.options_['techOrder']; i<j.length; i++) {
- var techName = vjs.capitalize(j[i]),
- tech = window['videojs'][techName];
-
- if (tech && tech.isSupported()) {
- player.loadTech(techName);
- break;
- }
- }
- } else {
-
-
-
-
- player.src(player.options_['sources']);
- }
- }
- });
- vjs.Player.prototype.textTracks_;
- vjs.Player.prototype.textTracks = function(){
- this.textTracks_ = this.textTracks_ || [];
- return this.textTracks_;
- };
- vjs.Player.prototype.addTextTrack = function(kind, label, language, options){
- var tracks = this.textTracks_ = this.textTracks_ || [];
- options = options || {};
- options['kind'] = kind;
- options['label'] = label;
- options['language'] = language;
-
-
- var Kind = vjs.capitalize(kind || 'subtitles');
-
- var track = new window['videojs'][Kind + 'Track'](this, options);
- tracks.push(track);
-
-
-
-
-
-
-
- return track;
- };
- vjs.Player.prototype.addTextTracks = function(trackList){
- var trackObj;
- for (var i = 0; i < trackList.length; i++) {
- trackObj = trackList[i];
- this.addTextTrack(trackObj['kind'], trackObj['label'], trackObj['language'], trackObj);
- }
- return this;
- };
- vjs.Player.prototype.showTextTrack = function(id, disableSameKind){
- var tracks = this.textTracks_,
- i = 0,
- j = tracks.length,
- track, showTrack, kind;
-
- for (;i<j;i++) {
- track = tracks[i];
- if (track.id() === id) {
- track.show();
- showTrack = track;
-
- } else if (disableSameKind && track.kind() == disableSameKind && track.mode() > 0) {
- track.disable();
- }
- }
-
- kind = (showTrack) ? showTrack.kind() : ((disableSameKind) ? disableSameKind : false);
-
- if (kind) {
- this.trigger(kind+'trackchange');
- }
- return this;
- };
- vjs.TextTrack = vjs.Component.extend({
-
- init: function(player, options){
- vjs.Component.call(this, player, options);
-
-
-
- this.id_ = options['id'] || ('vjs_' + options['kind'] + '_' + options['language'] + '_' + vjs.guid++);
- this.src_ = options['src'];
-
- this.dflt_ = options['default'] || options['dflt'];
- this.title_ = options['title'];
- this.language_ = options['srclang'];
- this.label_ = options['label'];
- this.cues_ = [];
- this.activeCues_ = [];
- this.readyState_ = 0;
- this.mode_ = 0;
- this.player_.on('fullscreenchange', vjs.bind(this, this.adjustFontSize));
- }
- });
- vjs.TextTrack.prototype.kind_;
- vjs.TextTrack.prototype.kind = function(){
- return this.kind_;
- };
- vjs.TextTrack.prototype.src_;
- vjs.TextTrack.prototype.src = function(){
- return this.src_;
- };
- vjs.TextTrack.prototype.dflt_;
- vjs.TextTrack.prototype.dflt = function(){
- return this.dflt_;
- };
- vjs.TextTrack.prototype.title_;
- vjs.TextTrack.prototype.title = function(){
- return this.title_;
- };
- vjs.TextTrack.prototype.language_;
- vjs.TextTrack.prototype.language = function(){
- return this.language_;
- };
- vjs.TextTrack.prototype.label_;
- vjs.TextTrack.prototype.label = function(){
- return this.label_;
- };
- vjs.TextTrack.prototype.cues_;
- vjs.TextTrack.prototype.cues = function(){
- return this.cues_;
- };
- vjs.TextTrack.prototype.activeCues_;
- vjs.TextTrack.prototype.activeCues = function(){
- return this.activeCues_;
- };
- vjs.TextTrack.prototype.readyState_;
- vjs.TextTrack.prototype.readyState = function(){
- return this.readyState_;
- };
- vjs.TextTrack.prototype.mode_;
- vjs.TextTrack.prototype.mode = function(){
- return this.mode_;
- };
- vjs.TextTrack.prototype.adjustFontSize = function(){
- if (this.player_.isFullScreen) {
-
-
-
- this.el_.style.fontSize = screen.width / this.player_.width() * 1.4 * 100 + '%';
- } else {
-
- this.el_.style.fontSize = '';
- }
- };
- vjs.TextTrack.prototype.createEl = function(){
- return vjs.Component.prototype.createEl.call(this, 'div', {
- className: 'vjs-' + this.kind_ + ' vjs-text-track'
- });
- };
- vjs.TextTrack.prototype.show = function(){
- this.activate();
- this.mode_ = 2;
-
- vjs.Component.prototype.show.call(this);
- };
- vjs.TextTrack.prototype.hide = function(){
-
- this.activate();
- this.mode_ = 1;
-
- vjs.Component.prototype.hide.call(this);
- };
- vjs.TextTrack.prototype.disable = function(){
-
- if (this.mode_ == 2) { this.hide(); }
-
- this.deactivate();
-
- this.mode_ = 0;
- };
- vjs.TextTrack.prototype.activate = function(){
-
- if (this.readyState_ === 0) { this.load(); }
-
- if (this.mode_ === 0) {
-
-
- this.player_.on('timeupdate', vjs.bind(this, this.update, this.id_));
-
- this.player_.on('ended', vjs.bind(this, this.reset, this.id_));
-
- if (this.kind_ === 'captions' || this.kind_ === 'subtitles') {
- this.player_.getChild('textTrackDisplay').addChild(this);
- }
- }
- };
- vjs.TextTrack.prototype.deactivate = function(){
-
- this.player_.off('timeupdate', vjs.bind(this, this.update, this.id_));
- this.player_.off('ended', vjs.bind(this, this.reset, this.id_));
- this.reset();
-
- this.player_.getChild('textTrackDisplay').removeChild(this);
- };
- vjs.TextTrack.prototype.load = function(){
-
- if (this.readyState_ === 0) {
- this.readyState_ = 1;
- vjs.get(this.src_, vjs.bind(this, this.parseCues), vjs.bind(this, this.onError));
- }
- };
- vjs.TextTrack.prototype.onError = function(err){
- this.error = err;
- this.readyState_ = 3;
- this.trigger('error');
- };
- vjs.TextTrack.prototype.parseCues = function(srcContent) {
- var cue, time, text,
- lines = srcContent.split('\n'),
- line = '', id;
- for (var i=1, j=lines.length; i<j; i++) {
-
- line = vjs.trim(lines[i]);
- if (line) {
-
-
- if (line.indexOf('-->') == -1) {
- id = line;
-
- line = vjs.trim(lines[++i]);
- } else {
- id = this.cues_.length;
- }
-
- cue = {
- id: id,
- index: this.cues_.length
- };
-
- time = line.split(' --> ');
- cue.startTime = this.parseCueTime(time[0]);
- cue.endTime = this.parseCueTime(time[1]);
-
- text = [];
-
-
- while (lines[++i] && (line = vjs.trim(lines[i]))) {
- text.push(line);
- }
- cue.text = text.join('<br/>');
-
- this.cues_.push(cue);
- }
- }
- this.readyState_ = 2;
- this.trigger('loaded');
- };
- vjs.TextTrack.prototype.parseCueTime = function(timeText) {
- var parts = timeText.split(':'),
- time = 0,
- hours, minutes, other, seconds, ms;
-
-
- if (parts.length == 3) {
- hours = parts[0];
- minutes = parts[1];
- other = parts[2];
- } else {
- hours = 0;
- minutes = parts[0];
- other = parts[1];
- }
-
-
- other = other.split(/\s+/);
-
- seconds = other.splice(0,1)[0];
-
- seconds = seconds.split(/\.|,/);
-
- ms = parseFloat(seconds[1]);
- seconds = seconds[0];
-
- time += parseFloat(hours) * 3600;
-
- time += parseFloat(minutes) * 60;
-
- time += parseFloat(seconds);
-
- if (ms) { time += ms/1000; }
- return time;
- };
- vjs.TextTrack.prototype.update = function(){
- if (this.cues_.length > 0) {
-
- var time = this.player_.currentTime();
-
- if (this.prevChange === undefined || time < this.prevChange || this.nextChange <= time) {
- var cues = this.cues_,
-
- newNextChange = this.player_.duration(),
- newPrevChange = 0,
- reverse = false,
- newCues = [],
-
- firstActiveIndex, lastActiveIndex,
- cue, i;
-
-
- if (time >= this.nextChange || this.nextChange === undefined) {
-
- i = (this.firstActiveIndex !== undefined) ? this.firstActiveIndex : 0;
- } else {
-
- reverse = true;
- i = (this.lastActiveIndex !== undefined) ? this.lastActiveIndex : cues.length - 1;
- }
- while (true) {
- cue = cues[i];
-
- if (cue.endTime <= time) {
- newPrevChange = Math.max(newPrevChange, cue.endTime);
- if (cue.active) {
- cue.active = false;
- }
-
-
-
-
-
- } else if (time < cue.startTime) {
- newNextChange = Math.min(newNextChange, cue.startTime);
- if (cue.active) {
- cue.active = false;
- }
-
- if (!reverse) { break; }
-
- } else {
- if (reverse) {
-
- newCues.splice(0,0,cue);
-
- if (lastActiveIndex === undefined) { lastActiveIndex = i; }
- firstActiveIndex = i;
- } else {
-
- newCues.push(cue);
-
- if (firstActiveIndex === undefined) { firstActiveIndex = i; }
- lastActiveIndex = i;
- }
- newNextChange = Math.min(newNextChange, cue.endTime);
- newPrevChange = Math.max(newPrevChange, cue.startTime);
- cue.active = true;
- }
- if (reverse) {
-
- if (i === 0) { break; } else { i--; }
- } else {
-
- if (i === cues.length - 1) { break; } else { i++; }
- }
- }
- this.activeCues_ = newCues;
- this.nextChange = newNextChange;
- this.prevChange = newPrevChange;
- this.firstActiveIndex = firstActiveIndex;
- this.lastActiveIndex = lastActiveIndex;
- this.updateDisplay();
- this.trigger('cuechange');
- }
- }
- };
- vjs.TextTrack.prototype.updateDisplay = function(){
- var cues = this.activeCues_,
- html = '',
- i=0,j=cues.length;
- for (;i<j;i++) {
- html += '<span class="vjs-tt-cue">'+cues[i].text+'</span>';
- }
- this.el_.innerHTML = html;
- };
- vjs.TextTrack.prototype.reset = function(){
- this.nextChange = 0;
- this.prevChange = this.player_.duration();
- this.firstActiveIndex = 0;
- this.lastActiveIndex = 0;
- };
- vjs.CaptionsTrack = vjs.TextTrack.extend();
- vjs.CaptionsTrack.prototype.kind_ = 'captions';
- vjs.SubtitlesTrack = vjs.TextTrack.extend();
- vjs.SubtitlesTrack.prototype.kind_ = 'subtitles';
- vjs.ChaptersTrack = vjs.TextTrack.extend();
- vjs.ChaptersTrack.prototype.kind_ = 'chapters';
- vjs.TextTrackDisplay = vjs.Component.extend({
-
- init: function(player, options, ready){
- vjs.Component.call(this, player, options, ready);
-
-
-
-
- if (player.options_['tracks'] && player.options_['tracks'].length > 0) {
- this.player_.addTextTracks(player.options_['tracks']);
- }
- }
- });
- vjs.TextTrackDisplay.prototype.createEl = function(){
- return vjs.Component.prototype.createEl.call(this, 'div', {
- className: 'vjs-text-track-display'
- });
- };
- vjs.TextTrackMenuItem = vjs.MenuItem.extend({
-
- init: function(player, options){
- var track = this.track = options['track'];
-
- options['label'] = track.label();
- options['selected'] = track.dflt();
- vjs.MenuItem.call(this, player, options);
- this.player_.on(track.kind() + 'trackchange', vjs.bind(this, this.update));
- }
- });
- vjs.TextTrackMenuItem.prototype.onClick = function(){
- vjs.MenuItem.prototype.onClick.call(this);
- this.player_.showTextTrack(this.track.id_, this.track.kind());
- };
- vjs.TextTrackMenuItem.prototype.update = function(){
- this.selected(this.track.mode() == 2);
- };
- vjs.OffTextTrackMenuItem = vjs.TextTrackMenuItem.extend({
-
- init: function(player, options){
-
-
- options['track'] = {
- kind: function() { return options['kind']; },
- player: player,
- label: function(){ return options['kind'] + ' off'; },
- dflt: function(){ return false; },
- mode: function(){ return false; }
- };
- vjs.TextTrackMenuItem.call(this, player, options);
- this.selected(true);
- }
- });
- vjs.OffTextTrackMenuItem.prototype.onClick = function(){
- vjs.TextTrackMenuItem.prototype.onClick.call(this);
- this.player_.showTextTrack(this.track.id_, this.track.kind());
- };
- vjs.OffTextTrackMenuItem.prototype.update = function(){
- var tracks = this.player_.textTracks(),
- i=0, j=tracks.length, track,
- off = true;
- for (;i<j;i++) {
- track = tracks[i];
- if (track.kind() == this.track.kind() && track.mode() == 2) {
- off = false;
- }
- }
- this.selected(off);
- };
- vjs.TextTrackButton = vjs.MenuButton.extend({
-
- init: function(player, options){
- vjs.MenuButton.call(this, player, options);
- if (this.items.length <= 1) {
- this.hide();
- }
- }
- });
- vjs.TextTrackButton.prototype.createItems = function(){
- var items = [], track;
-
- items.push(new vjs.OffTextTrackMenuItem(this.player_, { 'kind': this.kind_ }));
- for (var i = 0; i < this.player_.textTracks().length; i++) {
- track = this.player_.textTracks()[i];
- if (track.kind() === this.kind_) {
- items.push(new vjs.TextTrackMenuItem(this.player_, {
- 'track': track
- }));
- }
- }
- return items;
- };
- vjs.CaptionsButton = vjs.TextTrackButton.extend({
-
- init: function(player, options, ready){
- vjs.TextTrackButton.call(this, player, options, ready);
- this.el_.setAttribute('aria-label','Captions Menu');
- }
- });
- vjs.CaptionsButton.prototype.kind_ = 'captions';
- vjs.CaptionsButton.prototype.buttonText = 'Captions';
- vjs.CaptionsButton.prototype.className = 'vjs-captions-button';
- vjs.SubtitlesButton = vjs.TextTrackButton.extend({
-
- init: function(player, options, ready){
- vjs.TextTrackButton.call(this, player, options, ready);
- this.el_.setAttribute('aria-label','Subtitles Menu');
- }
- });
- vjs.SubtitlesButton.prototype.kind_ = 'subtitles';
- vjs.SubtitlesButton.prototype.buttonText = 'Subtitles';
- vjs.SubtitlesButton.prototype.className = 'vjs-subtitles-button';
- vjs.ChaptersButton = vjs.TextTrackButton.extend({
-
- init: function(player, options, ready){
- vjs.TextTrackButton.call(this, player, options, ready);
- this.el_.setAttribute('aria-label','Chapters Menu');
- }
- });
- vjs.ChaptersButton.prototype.kind_ = 'chapters';
- vjs.ChaptersButton.prototype.buttonText = 'Chapters';
- vjs.ChaptersButton.prototype.className = 'vjs-chapters-button';
- vjs.ChaptersButton.prototype.createItems = function(){
- var items = [], track;
- for (var i = 0; i < this.player_.textTracks().length; i++) {
- track = this.player_.textTracks()[i];
- if (track.kind() === this.kind_) {
- items.push(new vjs.TextTrackMenuItem(this.player_, {
- 'track': track
- }));
- }
- }
- return items;
- };
- vjs.ChaptersButton.prototype.createMenu = function(){
- var tracks = this.player_.textTracks(),
- i = 0,
- j = tracks.length,
- track, chaptersTrack,
- items = this.items = [];
- for (;i<j;i++) {
- track = tracks[i];
- if (track.kind() == this.kind_ && track.dflt()) {
- if (track.readyState() < 2) {
- this.chaptersTrack = track;
- track.on('loaded', vjs.bind(this, this.createMenu));
- return;
- } else {
- chaptersTrack = track;
- break;
- }
- }
- }
- var menu = this.menu = new vjs.Menu(this.player_);
- menu.el_.appendChild(vjs.createEl('li', {
- className: 'vjs-menu-title',
- innerHTML: vjs.capitalize(this.kind_),
- tabindex: -1
- }));
- if (chaptersTrack) {
- var cues = chaptersTrack.cues_, cue, mi;
- i = 0;
- j = cues.length;
- for (;i<j;i++) {
- cue = cues[i];
- mi = new vjs.ChaptersTrackMenuItem(this.player_, {
- 'track': chaptersTrack,
- 'cue': cue
- });
- items.push(mi);
- menu.addChild(mi);
- }
- }
- if (this.items.length > 0) {
- this.show();
- }
- return menu;
- };
- vjs.ChaptersTrackMenuItem = vjs.MenuItem.extend({
-
- init: function(player, options){
- var track = this.track = options['track'],
- cue = this.cue = options['cue'],
- currentTime = player.currentTime();
-
- options['label'] = cue.text;
- options['selected'] = (cue.startTime <= currentTime && currentTime < cue.endTime);
- vjs.MenuItem.call(this, player, options);
- track.on('cuechange', vjs.bind(this, this.update));
- }
- });
- vjs.ChaptersTrackMenuItem.prototype.onClick = function(){
- vjs.MenuItem.prototype.onClick.call(this);
- this.player_.currentTime(this.cue.startTime);
- this.update(this.cue.startTime);
- };
- vjs.ChaptersTrackMenuItem.prototype.update = function(){
- var cue = this.cue,
- currentTime = this.player_.currentTime();
-
- this.selected(cue.startTime <= currentTime && currentTime < cue.endTime);
- };
- vjs.obj.merge(vjs.ControlBar.prototype.options_['children'], {
- 'subtitlesButton': {},
- 'captionsButton': {},
- 'chaptersButton': {}
- });
- vjs.JSON;
- if (typeof window.JSON !== 'undefined' && window.JSON.parse === 'function') {
- vjs.JSON = window.JSON;
- } else {
- vjs.JSON = {};
- var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
-
- vjs.JSON.parse = function (text, reviver) {
- var j;
- function walk(holder, key) {
- var k, v, value = holder[key];
- if (value && typeof value === 'object') {
- for (k in value) {
- if (Object.prototype.hasOwnProperty.call(value, k)) {
- v = walk(value, k);
- if (v !== undefined) {
- value[k] = v;
- } else {
- delete value[k];
- }
- }
- }
- }
- return reviver.call(holder, key, value);
- }
- text = String(text);
- cx.lastIndex = 0;
- if (cx.test(text)) {
- text = text.replace(cx, function (a) {
- return '\\u' +
- ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- });
- }
- if (/^[\],:{}\s]*$/
- .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
- .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
- .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
- j = eval('(' + text + ')');
- return typeof reviver === 'function' ?
- walk({'': j}, '') : j;
- }
- throw new SyntaxError('JSON.parse(): invalid or malformed JSON data');
- };
- }
- vjs.autoSetup = function(){
- var options, vid, player,
- vids = document.getElementsByTagName('video');
-
- if (vids && vids.length > 0) {
- for (var i=0,j=vids.length; i<j; i++) {
- vid = vids[i];
-
-
- if (vid && vid.getAttribute) {
-
- if (vid['player'] === undefined) {
- options = vid.getAttribute('data-setup');
-
-
- if (options !== null) {
-
-
- options = vjs.JSON.parse(options || '{}');
-
- player = videojs(vid, options);
- }
- }
-
- } else {
- vjs.autoSetupTimeout(1);
- break;
- }
- }
-
- } else if (!vjs.windowLoaded) {
- vjs.autoSetupTimeout(1);
- }
- };
- vjs.autoSetupTimeout = function(wait){
- setTimeout(vjs.autoSetup, wait);
- };
- if (document.readyState === 'complete') {
- vjs.windowLoaded = true;
- } else {
- vjs.one(window, 'load', function(){
- vjs.windowLoaded = true;
- });
- }
- vjs.autoSetupTimeout(1);
- vjs.plugin = function(name, init){
- vjs.Player.prototype[name] = init;
- };
|