webVideoCtrl.js 149 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691
  1. ! function() {
  2. if (!window.WebVideoCtrl) {
  3. var e = function() {
  4. function e(e, t, n) {
  5. return (e << 16 | t << 8 | n).toString(16)
  6. }
  7. function n(e, t) {
  8. return (Array(t).join("0") + e).slice(-t)
  9. }
  10. function r(e) {
  11. var t = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
  12. if (e && t.test(e)) {
  13. if (4 === e.length) {
  14. for (var n = "#", r = 1; 4 > r; r += 1) n += e.slice(r, r + 1).concat(e.slice(r, r + 1));
  15. e = n
  16. }
  17. for (var s = [], r = 1; 7 > r; r += 2) s.push(parseInt("0x" + e.slice(r, r + 2)));
  18. return "[" + s.join(",") + ",0.6]"
  19. }
  20. return e
  21. }
  22. function s() {
  23. return void 0 !== s.unique ? s.unique : (this.szIP = "", this.szHostName = "", this.szAuth = "", this.szHttpProtocol = "http://", this.iCGIPort = 80, this.szDeviceIdentify = "", this.iDevicePort = -1, this.iHttpPort = -1, this.iHttpsPort = -1, this.iRtspPort = -1, this.iWSPort = -1, this.iAudioType = 1, this.m_iAudioBitRate = -1, this.m_iAudioSamplingRate = -1, this.iDeviceProtocol = x, this.oProtocolInc = null, this.iAnalogChannelNum = 0, this.szDeviceType = "", this.bVoiceTalk = !1, this.oAuthType = {}, this.oStreamCapa = {
  24. bObtained: !1,
  25. bSupportShttpPlay: !1,
  26. bSupportShttpPlayback: !1,
  27. bSupportShttpsPlay: !1,
  28. bSupportShttpsPlayback: !1,
  29. bSupportShttpPlaybackTransCode: !1,
  30. bSupportShttpsPlaybackTransCode: !1,
  31. iIpChanBase: 1
  32. }, s.unique = this, void 0)
  33. }
  34. function o() {
  35. this.id = this.createUUID()
  36. }
  37. var a = "100%",
  38. u = "100%",
  39. c = "",
  40. l = "";
  41. oSecurityCap = {}, szAESKey = "";
  42. var d = {
  43. szversion: "websdk3.220200429",
  44. szContainerID: "",
  45. szColorProperty: "",
  46. szOcxClassId: "clsid:FDF0038A-CF64-4634-81AB-80F0A7946D6C",
  47. szMimeTypes: "application/webvideo-plugin-kit",
  48. szBasePath: "",
  49. iWndowType: 1,
  50. iPlayMode: 2,
  51. bWndFull: !0,
  52. iPackageType: 2,
  53. bDebugMode: !1,
  54. bNoPlugin: !0,
  55. cbSelWnd: null,
  56. cbDoubleClickWnd: null,
  57. cbEvent: null,
  58. cbRemoteConfig: null,
  59. cbInitPluginComplete: null,
  60. proxyAddress: null
  61. },
  62. p = null,
  63. f = 0,
  64. h = !1,
  65. P = [],
  66. I = [],
  67. m = null,
  68. v = null,
  69. C = null,
  70. S = null,
  71. y = this,
  72. g = null;
  73. this.w_options = d, this.w_deviceSet = P, this.w_wndSet = I, this.w_xmlLocalCfg = g;
  74. var x = 1,
  75. D = 2,
  76. z = 200,
  77. b = 0,
  78. T = 1,
  79. A = 2,
  80. M = 3,
  81. L = 4,
  82. q = 5,
  83. R = 6,
  84. w = 0,
  85. G = 2,
  86. W = 3,
  87. X = 21,
  88. _ = -1,
  89. H = 0,
  90. k = "IPCamera",
  91. E = "IPDome",
  92. Z = "IPZoom",
  93. B = "<?xml version='1.0' encoding='utf-8'?><FileVersion><Platform name='win32'><npWebVideoKitPlugin.dll>3,0,6,2</npWebVideoKitPlugin.dll><WebVideoKitActiveX.ocx>3,0,6,2</WebVideoKitActiveX.ocx><PlayCtrl.dll>7,3,3,61</PlayCtrl.dll><StreamTransClient.dll>1,1,3,6</StreamTransClient.dll><SystemTransform.dll>2,5,2,8</SystemTransform.dll><NetStream.dll>1,0,5,59</NetStream.dll></Platform></FileVersion>";
  94. window.GetSelectWndInfo = function(e) {
  95. if (ct()) {
  96. f = e;
  97. var n = [];
  98. n.push("<RealPlayInfo>"), n.push("<SelectWnd>" + e + "</SelectWnd>"), n.push("</RealPlayInfo>"), d.cbSelWnd && d.cbSelWnd(S.loadXML(n.join("")))
  99. } else {
  100. var r = S.loadXML(e);
  101. if (t.$XML(r).find("SelectWnd", !0).length > 0) {
  102. f = parseInt(t.$XML(r).find("SelectWnd").eq(0).text(), 10), null === g && Y();
  103. var n = [];
  104. n.push("<RealPlayInfo>"), n.push("<SelectWnd>" + f + "</SelectWnd>"), n.push("</RealPlayInfo>"), d.cbSelWnd && d.cbSelWnd(S.loadXML(n.join("")))
  105. } else if (t.$XML(r).find("DoubleClickWnd", !0).length > 0) {
  106. var s = parseInt(t.$XML(r).find("DoubleClickWnd").eq(0).text(), 10);
  107. h = "0" === t.$XML(r).find("IsFullScreen").eq(0).text(), d.cbDoubleClickWnd && d.cbDoubleClickWnd(s, h)
  108. }
  109. }
  110. }, window.WindowDblClick = function(e) {
  111. h = e, d.cbDoubleClickWnd && d.cbDoubleClickWnd(f, h)
  112. }, window.ZoomInfoCallback = function(e) {
  113. var t = y.findWndIndexByIndex(f);
  114. if (-1 != t) {
  115. var n = I[t];
  116. if (t = y.findDeviceIndexByIP(n.szDeviceIdentify), -1 != t) {
  117. var r = P[t];
  118. r.oProtocolInc.set3DZoom(r, n, e, {
  119. success: function() {},
  120. error: function() {}
  121. })
  122. }
  123. }
  124. }, window.PluginEventHandler = function(e, t, n) {
  125. ct() ? d.cbEvent && d.cbEvent(e, t, n) : (w == t || G == t ? y.I_Stop(e) : X == t ? y.I_StopRecord(e) : W == t && y.I_StopVoiceTalk(), d.cbEvent && d.cbEvent(t, e, n))
  126. }, window.GetHttpInfo = function(e, t) {
  127. Pt.prototype.processCallback(e, t)
  128. }, window.RemoteConfigInfo = function(e) {
  129. d.cbRemoteConfig && d.cbRemoteConfig(e)
  130. }, window.KeyBoardEventInfo = function(e) {
  131. 100 === parseInt(e, 10) && (h = !1, d.cbDoubleClickWnd && d.cbDoubleClickWnd(f, h))
  132. };
  133. var N = function() {
  134. if (d.bDebugMode) {
  135. var e = F(arguments);
  136. m._alert(e)
  137. }
  138. },
  139. F = function() {
  140. for (var e = arguments[0], t = 1; t < arguments.length; t++) e = e.replace("%s", arguments[t]);
  141. return e
  142. },
  143. V = function(e) {
  144. var t = e.indexOf(":");
  145. return t > -1 ? e.substring(0, t) : e
  146. },
  147. U = function(e) {
  148. return "undefined" == typeof e
  149. },
  150. j = function(e) {
  151. return "[object Object]" === Object.prototype.toString.call(e)
  152. },
  153. O = function(e, t) {
  154. if (e.oAuthType[e.szIP] < 2) {return "";}
  155. var n = "",
  156. r = {
  157. type: "GET",
  158. async: !1,
  159. success: function(e) {
  160. e && e.Token && (n = e.Token.value)
  161. }
  162. },
  163. s = "ISAPI/Security/token?format=json";
  164. return y.I_SendHTTPRequest(t, s, r), n
  165. },
  166. J = function(e, n, r) {
  167. y.I_GetSecurityVersion(e, {
  168. success: function(e) {
  169. oSecurityCap.iKeyIterateNum = parseInt(t.$XML(e).find("keyIterateNum").eq(0).text(), 10), oSecurityCap.oIrreversibleEncrypt = {
  170. bSupport: "true" === t.$XML(e).find("isIrreversible").eq(0).text(),
  171. salt: t.$XML(e).find("salt").eq(0).text()
  172. }, szAESKey = S.strToAESKey(n, r)
  173. }
  174. })
  175. },
  176. K = function() {
  177. var e = "";
  178. if (S.browser().msie) e = "<object classid='" + d.szOcxClassId + "' codebase='' standby='Waiting...' " + "id='" + c + "' width='" + a + "' height='" + u + "' align='center' >" + "<param name='wndtype' value='" + d.iWndowType + "'>" + "<param name='playmode' value='" + d.iPlayMode + "'>" + "<param name='colors' value='" + d.szColorProperty + "'></object>";
  179. else
  180. for (var t = navigator.mimeTypes.length, n = 0; t > n; n++) navigator.mimeTypes[n].type.toLowerCase() == d.szMimeTypes && (e = "<embed align='center' type='" + d.szMimeTypes + "' width='" + a + "' height='" + u + "' name='" + l + "' wndtype='" + d.iWndowType + "' playmode='" + d.iPlayMode + "' colors='" + d.szColorProperty + "'>");
  181. return e
  182. },
  183. Y = function() {
  184. if (!ct() && null !== p) {
  185. var e = p.HWP_GetLocalConfig();
  186. g = S.loadXML(e)
  187. }
  188. },
  189. Q = function(e) {
  190. y.I_GetDeviceInfo(e.szIP, {
  191. success: function(n) {
  192. e.szDeviceType = t.$XML(n).find("deviceType").eq(0).text()
  193. }
  194. }), y.I_GetAnalogChannelInfo(e.szIP, {
  195. success: function() {},
  196. error: function() {}
  197. }), y.I_GetAudioInfo(e.szIP, {
  198. success: function(n) {
  199. var r = t.$XML(n).find("audioCompressionType", !0);
  200. if (r.length > 0) {
  201. var s = t.$XML(r).eq(0).text(),
  202. o = 0;
  203. "G.711ulaw" == s ? o = 1 : "G.711alaw" == s ? o = 2 : "G.726" == s ? o = 3 : "MP2L2" == s || "MPEL2" == s ? o = 4 : "G.722.1" == s ? o = 0 : "AAC" == s ? o = 5 : "PCM" == s && (o = 6), e.iAudioType = o
  204. }
  205. e.m_iAudioBitRate = "" !== t.$XML(n).find("audioBitRate").eq(0).text() ? 1e3 * parseInt(t.$XML(n).find("audioBitRate").eq(0).text(), 10) : 0, e.m_iAudioSamplingRate = "" !== t.$XML(n).find("audioSamplingRate").eq(0).text() ? 1e3 * parseInt(t.$XML(n).find("audioSamplingRate").eq(0).text(), 10) : 0
  206. }
  207. })
  208. },
  209. et = function(e) {
  210. e.bSupportWebsocket = !1, e.bSupportSubStreamPlayback = !1, e.oProtocolInc.getSystemCapa(e, {
  211. success: function(n) {
  212. var r = t.$XML(n).find("NetworkCap").eq(0).find("isSupportWebsocket", !0);
  213. r.length > 0 && (e.bSupportWebsocket = "true" === t.$XML(n).find("NetworkCap").eq(0).find("isSupportWebsocket").eq(0).text()), e.bSupportWebsocket = !0, r = t.$XML(n).find("RacmCap").eq(0).find("isSupportMainAndSubRecord", !0), r.length > 0 && (e.bSupportSubStreamPlayback = "true" === t.$XML(n).find("RacmCap").eq(0).find("isSupportMainAndSubRecord").eq(0).text()), e.bSupportSubStreamPlayback = !0
  214. }
  215. })
  216. },
  217. tt = function() {
  218. var e = d.bWndFull ? 1 : 0;
  219. p.HWP_SetCanFullScreen(e), p.HWP_SetPackageType(d.iPackageType)
  220. },
  221. nt = function(e) {
  222. var t = -1,
  223. n = -1,
  224. r = -1,
  225. s = null;
  226. if (it(e)) s = rt(e), t = s.iRtspPort, r = s.iDevicePort;
  227. else {
  228. for (var o = ot(e), i = !1, a = 0; a < o.length; a++)
  229. if (o[a].ipv4 == e.szIP || o[a].ipv6 == e.szIP) {
  230. i = !0;
  231. break
  232. }
  233. i ? s = rt(e) : (s = st(e), -1 == s.iRtspPort && -1 == s.iDevicePort && (s = rt(e))), t = s.iRtspPort, n = s.iHttpPort, r = s.iDevicePort
  234. }
  235. return s
  236. },
  237. rt = function(e) {
  238. var n = -1,
  239. r = -1,
  240. s = -1;
  241. return e.oProtocolInc.getPortInfo(e, {
  242. async: !1,
  243. success: function(e) {
  244. var o = t.$XML(e).find("AdminAccessProtocol", !0);
  245. n = 554;
  246. for (var i = 0, a = o.length; a > i; i++) "rtsp" === t.$XML(o).eq(i).find("protocol").eq(0).text().toLowerCase() && (n = parseInt(t.$XML(o).eq(i).find("portNo").eq(0).text(), 10)), "http" === t.$XML(o).eq(i).find("protocol").eq(0).text().toLowerCase() && (r = parseInt(t.$XML(o).eq(i).find("portNo").eq(0).text(), 10)), "dev_manage" === t.$XML(o).eq(i).find("protocol").eq(0).text().toLowerCase() && (s = parseInt(t.$XML(o).eq(i).find("portNo").eq(0).text(), 10))
  247. },
  248. error: function() {
  249. n = -1, r = -1, s = -1
  250. }
  251. }), {
  252. iRtspPort: n,
  253. iHttpPort: r,
  254. iDevicePort: s
  255. }
  256. },
  257. st = function(e) {
  258. var n = -1,
  259. r = -1,
  260. s = -1;
  261. return e.oProtocolInc.getUPnPPortStatus(e, {
  262. async: !1,
  263. success: function(e) {
  264. for (var o = t.$XML(e).find("portStatus", !0), i = 0, a = o.length; a > i; i++) "rtsp" == t.$XML(o).eq(i).find("internalPort").eq(0).text().toLowerCase() && (n = parseInt(t.$XML(o).eq(i).find("externalPort").eq(0).text(), 10)), "http" == t.$XML(o).eq(i).find("internalPort").eq(0).text().toLowerCase() && (r = parseInt(t.$XML(o).eq(i).find("externalPort").eq(0).text(), 10)), "admin" == t.$XML(o).eq(i).find("internalPort").eq(0).text().toLowerCase() && (s = parseInt(t.$XML(o).eq(i).find("externalPort").eq(0).text(), 10))
  265. },
  266. error: function() {
  267. n = -1, r = -1, s = -1
  268. }
  269. }), {
  270. iRtspPort: n,
  271. iHttpPort: r,
  272. iDevicePort: s
  273. }
  274. },
  275. ot = function(e) {
  276. var n = [];
  277. return e.oProtocolInc.getNetworkBond(e, {
  278. async: !1,
  279. success: function(r) {
  280. "true" == t.$XML(r).find("enabled").eq(0).text() ? n.push({
  281. ipv4: t.$XML(r).find("ipAddress").eq(0).text(),
  282. ipv6: t.$XML(r).find("ipv6Address").eq(0).text()
  283. }) : e.oProtocolInc.getNetworkInterface(e, {
  284. async: !1,
  285. success: function(e) {
  286. for (var r = t.$XML(e).find("NetworkInterface", !0), s = 0, o = r.length; o > s; s++) {
  287. n.push({
  288. ipv4: t.$XML(e).find("ipAddress").eq(0).text(),
  289. ipv6: t.$XML(e).find("ipv6Address").eq(0).text()
  290. });
  291. break
  292. }
  293. },
  294. error: function() {}
  295. })
  296. },
  297. error: function() {
  298. e.oProtocolInc.getNetworkInterface(e, {
  299. async: !1,
  300. success: function(e) {
  301. for (var r = t.$XML(e).find("NetworkInterface", !0), s = 0, o = r.length; o > s; s++) {
  302. n.push({
  303. ipv4: t.$XML(e).find("ipAddress").eq(0).text(),
  304. ipv6: t.$XML(e).find("ipv6Address").eq(0).text()
  305. });
  306. break
  307. }
  308. },
  309. error: function() {}
  310. })
  311. }
  312. }), n
  313. },
  314. it = function(e) {
  315. var n = !1;
  316. return e.oProtocolInc.getPPPoEStatus(e, {
  317. async: !1,
  318. success: function(e) {
  319. n = t.$XML(e).find("ipAddress", !0).length > 0 ? !0 : t.$XML(e).find("ipv6Address", !0).length > 0 ? !0 : !1
  320. },
  321. error: function() {
  322. n = !1
  323. }
  324. }), n
  325. },
  326. at = function(e) {
  327. e.oProtocolInc instanceof It && e.oProtocolInc.getSDKCapa(e, {
  328. async: !1,
  329. success: function(n) {
  330. e.oStreamCapa.bObtained = !0, e.oStreamCapa.bSupportShttpPlay = "true" === t.$XML(n).find("isSupportHttpPlay").eq(0).text(), e.oStreamCapa.bSupportShttpPlayback = "true" === t.$XML(n).find("isSupportHttpPlayback").eq(0).text(), e.oStreamCapa.bSupportShttpsPlay = "true" === t.$XML(n).find("isSupportHttpsPlay").eq(0).text(), e.oStreamCapa.bSupportShttpsPlayback = "true" === t.$XML(n).find("isSupportHttpsPlayback").eq(0).text(), e.oStreamCapa.bSupportShttpPlaybackTransCode = "true" === t.$XML(n).find("isSupportHttpTransCodePlayback").eq(0).text(), e.oStreamCapa.bSupportShttpsPlaybackTransCode = "true" === t.$XML(n).find("isSupportHttpsTransCodePlayback").eq(0).text(), e.oStreamCapa.iIpChanBase = t.$XML(n).find("ipChanBase", !0).length > 0 ? parseInt(t.$XML(n).find("ipChanBase").eq(0).text(), 10) : 1
  331. },
  332. error: function() {
  333. e.oStreamCapa.bObtained = !0
  334. }
  335. })
  336. },
  337. ut = function(e) {
  338. var t = {
  339. TransFrameRate: "",
  340. TransResolution: "",
  341. TransBitrate: ""
  342. };
  343. if (S.extend(t, e), "" == t.TransFrameRate || "" == t.TransResolution || "" == t.TransBitrate) return "";
  344. var n = [];
  345. return n.push("<?xml version='1.0' encoding='UTF-8'?>"), n.push("<CompressionInfo>"), n.push("<TransFrameRate>" + t.TransFrameRate + "</TransFrameRate>"), n.push("<TransResolution>" + t.TransResolution + "</TransResolution>"), n.push("<TransBitrate>" + t.TransBitrate + "</TransBitrate>"), n.push("</CompressionInfo>"), n.join("")
  346. },
  347. ct = function() {
  348. if (d.bNoPlugin) {
  349. var e = S.browser();
  350. return e.chrome && parseInt(e.version, 10) > 45 || e.mozilla && parseInt(e.version, 10) > 52 ? !0 : !1
  351. }
  352. return !1
  353. },
  354. lt = function(e) {
  355. var t = location.hostname,
  356. n = location.port || "80";
  357. return d.proxyAddress && (t = d.proxyAddress.ip, n = d.proxyAddress.port), /^(http|https):\/\/([^\/]+)(.+)$/.test(e) && (e = e.replace(RegExp.$2, t + ":" + n)), S.cookie("webVideoCtrlProxy", RegExp.$2, {
  358. raw: !0
  359. }), e
  360. },
  361. dt = function(e) {
  362. var t = location.hostname,
  363. n = location.port || "80";
  364. return /^(ws):\/\/([^\/:]+):(\d+)\/(.+)$/.test(e) && (e = e.replace(RegExp.$2 + ":" + RegExp.$3, t + ":" + n)), e.indexOf("ws") > -1 ? S.cookie("webVideoCtrlProxyWs", RegExp.$2 + ":" + RegExp.$3, {
  365. raw: !0
  366. }) : S.cookie("webVideoCtrlProxyWss", RegExp.$2 + ":" + RegExp.$3, {
  367. raw: !0
  368. }), S.cookie("webVideoCtrlProxyWsChannel", RegExp.$4, {
  369. raw: !0
  370. }), e + "/webSocketVideoCtrlProxy"
  371. },
  372. pt = function() {
  373. var e = "<ResponseStatus>";
  374. return e += "<requestURL></requestURL>", e += "<statusCode>4</statusCode>", e += "<statusString>Invalid Operation</statusString>", e += "<subStatusCode>notSupport</subStatusCode>", e += "</ResponseStatus>", S.loadXML(e)
  375. };
  376. this.I_SupportNoPlugin = function() {
  377. return ct()
  378. }, this.I_DestroyWorker = function() {
  379. null !== p && ct() && p.JS_DestroyWorker()
  380. }, this.I_Resize = function(e, t) {
  381. null !== p && ct() && (a = e, u = t, p.JS_Resize(e, t))
  382. }, this.I_InitPlugin = function(e, t, n) {
  383. if (a = e, u = t, S.extend(d, n), ct()) {
  384. var r = S.getDirName();
  385. r && ("object" == typeof exports && "undefined" != typeof module || ("function" == typeof define && define.amd ? require([r + "/jsPlugin-1.2.0.min.js"], function(e) {
  386. window.JSPlugin = e.JSPlugin, n.cbInitPluginComplete && n.cbInitPluginComplete()
  387. }) : S.loadScript(r + "/jsPlugin-1.2.0.min.js", function() {
  388. n.cbInitPluginComplete && n.cbInitPluginComplete()
  389. }))), window.addEventListener("resize", function() {
  390. null !== p && ct() && p.JS_Resize($("#divPlugin").width(), $("#divPlugin").height())
  391. }), U(document.fullScreen) ? U(document.webkitIsFullScreen) ? U(document.mozFullScreen) || document.addEventListener("mozfullscreenchange", function() {
  392. var e = document.fullscreen || document.webkitIsFullScreen || document.mozFullScreen || !1;
  393. h && !e && window.KeyBoardEventInfo(100)
  394. }) : document.addEventListener("webkitfullscreenchange", function() {
  395. var e = document.fullscreen || document.webkitIsFullScreen || document.mozFullScreen || !1;
  396. h && !e && window.KeyBoardEventInfo(100)
  397. }) : document.addEventListener("fullscreenchange", function() {
  398. var e = document.fullscreen || document.webkitIsFullScreen || document.mozFullScreen || !1;
  399. h && !e && window.KeyBoardEventInfo(100)
  400. }), window.addEventListener("unload", function() {
  401. null !== p && p.JS_DestroyWorker()
  402. })
  403. } else n.cbInitPluginComplete && n.cbInitPluginComplete()
  404. }, this.I_InsertOBJECTPlugin = function(e) {
  405. if (U(e) || (d.szContainerID = e), null == document.getElementById(d.szContainerID)) return -1;
  406. if (null != document.getElementById(c) || 0 != document.getElementsByName(c).length) return -1;
  407. if (ct()) {
  408. var t = {
  409. szId: e,
  410. iType: 1,
  411. iWidth: a,
  412. iHeight: u,
  413. iMaxSplit: 4,
  414. iCurrentSplit: d.iWndowType,
  415. szBasePath: S.getDirName()
  416. },
  417. n = d.szColorProperty;
  418. if ("" != n) {
  419. for (var r = {}, s = n.split(";"), o = "", i = 0, f = s.length; f > i; i++) o = s[i], o.indexOf("sub-background") > -1 ? r.background = "#" + o.split(":")[1] : o.indexOf("sub-border-select") > -1 ? r.borderSelect = "#" + o.split(":")[1] : o.indexOf("sub-border") > -1 && (r.border = "#" + o.split(":")[1]);
  420. t.oStyle = r
  421. }
  422. p = new JSPlugin(t)
  423. } else document.getElementById(d.szContainerID).innerHTML = K(), p = S.browser().msie ? document.getElementById(c) : document.getElementsByName(l)[0];
  424. return null == p && null == p.object ? -1 : ("object" == typeof window.attachEvent && S.browser().msie && (p.attachEvent("GetSelectWndInfo", GetSelectWndInfo), p.attachEvent("ZoomInfoCallback", ZoomInfoCallback), p.attachEvent("GetHttpInfo", GetHttpInfo), p.attachEvent("PluginEventHandler", PluginEventHandler), p.attachEvent("RemoteConfigInfo", RemoteConfigInfo), p.attachEvent("KeyBoardEventInfo", KeyBoardEventInfo)), Y(), 0)
  425. }, this.I_WriteOBJECT_XHTML = function() {
  426. return ct() ? -1 : (document.writeln(K()), p = S.browser().msie ? document.getElementById(c) : document.getElementsByName(l)[0], null == p && null == p.object ? -1 : ("object" == typeof window.attachEvent && S.browser().msie && (p.attachEvent("GetSelectWndInfo", GetSelectWndInfo), p.attachEvent("ZoomInfoCallback", ZoomInfoCallback), p.attachEvent("GetHttpInfo", GetHttpInfo), p.attachEvent("PluginEventHandler", PluginEventHandler), p.attachEvent("RemoteConfigInfo", RemoteConfigInfo), p.attachEvent("KeyBoardEventInfo", KeyBoardEventInfo)), Y(), 0))
  427. }, this.I_OpenFileDlg = function(e) {
  428. var t = "";
  429. if (ct()) return t;
  430. if (t = p.HWP_OpenFileBrowser(e, ""), null == t) return "";
  431. if (1 == e) {
  432. if (t.length > 100) return -1
  433. } else if (t.length > 130) return -1;
  434. return t
  435. }, this.I2_OpenFileDlg = function(e) {
  436. var t = "",
  437. n = $.Deferred();
  438. return ct() ? p.JS_OpenFileBrowser(e, "").then(function(t) {
  439. null != t ? 1 == e ? t.length > 100 && n.resolve(-1) : t.length > 130 && n.resolve(-1) : n.resolve(), n.resolve(t)
  440. }) : (t = p.HWP_OpenFileBrowser(e, ""), null != t ? 1 == e ? t.length > 100 && n.resolve(-1) : t.length > 130 && n.resolve(-1) : n.resolve(), n.resolve(t)), n
  441. }, this.I_GetLocalCfg = function() {
  442. var e = null;
  443. if (ct()) return e;
  444. var n = p.HWP_GetLocalConfig(),
  445. r = [];
  446. return g = S.loadXML(n), r.push("<LocalConfigInfo>"), r.push("<ProtocolType>" + t.$XML(g).find("ProtocolType").eq(0).text() + "</ProtocolType>"), r.push("<PackgeSize>" + t.$XML(g).find("PackgeSize").eq(0).text() + "</PackgeSize>"), r.push("<PlayWndType>" + t.$XML(g).find("PlayWndType").eq(0).text() + "</PlayWndType>"), r.push("<BuffNumberType>" + t.$XML(g).find("BuffNumberType").eq(0).text() + "</BuffNumberType>"), r.push("<RecordPath>" + t.$XML(g).find("RecordPath").eq(0).text() + "</RecordPath>"), r.push("<CapturePath>" + t.$XML(g).find("CapturePath").eq(0).text() + "</CapturePath>"), r.push("<PlaybackFilePath>" + t.$XML(g).find("PlaybackFilePath").eq(0).text() + "</PlaybackFilePath>"), r.push("<PlaybackPicPath>" + t.$XML(g).find("PlaybackPicPath").eq(0).text() + "</PlaybackPicPath>"), r.push("<DeviceCapturePath>" + t.$XML(g).find("DeviceCapturePath").eq(0).text() + "</DeviceCapturePath>"), r.push("<DownloadPath>" + t.$XML(g).find("DownloadPath").eq(0).text() + "</DownloadPath>"), r.push("<IVSMode>" + t.$XML(g).find("IVSMode").eq(0).text() + "</IVSMode>"), r.push("<CaptureFileFormat>" + t.$XML(g).find("CaptureFileFormat").eq(0).text() + "</CaptureFileFormat>"), r.push("</LocalConfigInfo>"), e = S.loadXML(r.join(""))
  447. }, this.I_SetLocalCfg = function(e) {
  448. if (ct()) return -1;
  449. var n = S.loadXML(e),
  450. r = !1;
  451. return t.$XML(g).find("ProtocolType").eq(0).text(t.$XML(n).find("ProtocolType").eq(0).text()), t.$XML(g).find("PackgeSize").eq(0).text(t.$XML(n).find("PackgeSize").eq(0).text()), t.$XML(g).find("PlayWndType").eq(0).text(t.$XML(n).find("PlayWndType").eq(0).text()), t.$XML(g).find("BuffNumberType").eq(0).text(t.$XML(n).find("BuffNumberType").eq(0).text()), t.$XML(g).find("RecordPath").eq(0).text(t.$XML(n).find("RecordPath").eq(0).text()), t.$XML(g).find("CapturePath").eq(0).text(t.$XML(n).find("CapturePath").eq(0).text()), t.$XML(g).find("PlaybackFilePath").eq(0).text(t.$XML(n).find("PlaybackFilePath").eq(0).text()), t.$XML(g).find("DeviceCapturePath").eq(0).text(t.$XML(n).find("DeviceCapturePath").eq(0).text()), t.$XML(g).find("PlaybackPicPath").eq(0).text(t.$XML(n).find("PlaybackPicPath").eq(0).text()), t.$XML(g).find("DownloadPath").eq(0).text(t.$XML(n).find("DownloadPath").eq(0).text()), t.$XML(g).find("IVSMode").eq(0).text(t.$XML(n).find("IVSMode").eq(0).text()), t.$XML(g).find("CaptureFileFormat").eq(0).text(t.$XML(n).find("CaptureFileFormat").eq(0).text()), r = p.HWP_SetLocalConfig(S.toXMLStr(g)), r ? 0 : -1
  452. };
  453. var ft = function(e, t, n, r, o, i, a) {
  454. var u = {
  455. protocol: t,
  456. success: null,
  457. error: null
  458. };
  459. S.extend(u, a), S.extend(u, {
  460. success: function(u) {
  461. var c = new s;
  462. c.szIP = e, 2 == t ? (c.szHttpProtocol = "https://", c.iHttpsPort = n) : (c.szHttpProtocol = "http://", c.iHttpPort = n), c.iCGIPort = n, c.szDeviceIdentify = e + "_" + n, c.szAuth = r, c.iDeviceProtocol = o, c.oProtocolInc = i, N("使用%s协议登录成功", o), Q(c), tt(), et(c), P.push(jQuery.extend({}, c)), a.success && a.success(u)
  463. },
  464. error: function(e, t) {
  465. a.error && a.error(e, t)
  466. }
  467. }), i.login(e, n, r, u)
  468. };
  469. this.getAuthType = function(e, n, r, s, o, i) {
  470. e.oAuthType[n] = 1;
  471. var a = v,
  472. u = {
  473. async: !0,
  474. success: function(r) {
  475. var iSessionIDVersion = 1;
  476. if (t.$XML(r).find("sessionIDVersion").eq(0).text()) {iSessionIDVersion = parseInt(t.$XML(r).find("sessionIDVersion").eq(0).text(), 10);}
  477. e.oAuthType[n] = iSessionIDVersion, i()
  478. },
  479. error: function(t) {
  480. t > 500 && (e.oAuthType[n] = t), i(t)
  481. }
  482. };
  483. a.getSessionCap(n, r, s, o, u)
  484. }, this.setDeviceInfo = function(e, t, n, r, o) {
  485. var t = new s;
  486. return t.szIP = n, 2 == r ? (t.szHttpProtocol = "https://", t.iHttpsPort = o) : (t.szHttpProtocol = "http://", t.iHttpPort = o), t.iCGIPort = o, t.szDeviceIdentify = n + "_" + o, t.iDeviceProtocol = x, t.oProtocolInc = e, t
  487. }, this.successV1cb = function(e, n, r, s, o, i, a, u) {
  488. n = this.setDeviceInfo(e, n, r, s, o), n.szAuth = t.$XML(i).find("sessionID").eq(0).text(), Q(n), N("使用%s协议登录成功", x), J(n.szDeviceIdentify, a, u), n.sessionFailed = 0, et(n);
  489. var c = jQuery.extend({}, n);
  490. P.push(c), c.sesstionTimer = setInterval(function() {
  491. e.sessionHeartbeat(c, function() {
  492. c.sessionFailed = 0
  493. }, function() {
  494. c.sessionFailed++, c.sessionFailed >= 5 && (window.PluginEventHandler(null, _, c.szDeviceIdentify), clearInterval(c.sesstionTimer))
  495. })
  496. }, 3e4)
  497. }, this.successV2cb = function(e, t, n, r, s, o, i, a) {
  498. t = this.setDeviceInfo(e, t, n, r, s), t.szAuth = O(t, t.szDeviceIdentify), Q(t), N("使用%s协议登录成功", x), document.cookie = "domain='10.18.99.194';path=/;", et(t), J(t.szDeviceIdentify, i, a), t.sessionFailed = 0;
  499. var u = jQuery.extend({}, t);
  500. P.push(u), u.sesstionTimer = setInterval(function() {
  501. e.sessionHeartbeat(u, function() {
  502. u.sessionFailed = 0
  503. }, function() {
  504. u.sessionFailed++, u.sessionFailed >= 5 && (window.PluginEventHandler(null, _, u.szDeviceIdentify), clearInterval(u.sesstionTimer))
  505. })
  506. }, 3e4)
  507. }, this.I_LoginV1 = function(e, t, n, r, s, o, i, a) {
  508. var u = this,
  509. c = {
  510. success: null,
  511. error: null
  512. };
  513. return S.extend(c, {
  514. success: function(c) {
  515. var l = {
  516. success: null,
  517. error: null
  518. };
  519. S.extend(l, {
  520. success: function(c) {
  521. a.success && (a.success(c), u.successV1cb(e, t, n, r, s, c, i, o))
  522. },
  523. error: function(e, t) {
  524. a.error && a.error(e, t)
  525. }
  526. }), e.sessionLogin(n, r, s, o, i, c, l)
  527. },
  528. error: function(e, t) {
  529. a.error && a.error(e, t)
  530. }
  531. }), c
  532. }, this.I_LoginV2 = function(e, t, n, r, s, o, i, a, u) {
  533. var c = {
  534. success: null,
  535. error: null
  536. },
  537. l = this;
  538. return S.extend(c, {
  539. success: function(c) {
  540. var d = {
  541. success: null,
  542. error: null
  543. };
  544. S.extend(d, {
  545. success: function(e) {
  546. l.successV2cb(t, n, r, s, o, e, a, i), u.success && u.success(e)
  547. },
  548. error: function(e, t) {
  549. u.error && u.error(e, t)
  550. }
  551. }), t.sessionV2Login(e, r, s, o, i, a, c, d)
  552. },
  553. error: function(e, t) {
  554. u.error && u.error(e, t)
  555. }
  556. }), c
  557. }, this.I_Login = function(e, t, n, r, o, i) {
  558. var a = e + "_" + n,
  559. u = this.findDeviceIndexByIP(a);
  560. if (-1 != u) return N("设备已经登录过"), -1;
  561. var c = v,
  562. l = x;
  563. if (U(i.cgi) || (x == i.cgi ? (c = v, l = x) : (c = C, l = D)), ct())
  564. if (x == l) {
  565. var d = new s;
  566. this.getAuthType(d, e, t, n, r, function() {
  567. var s = d.oAuthType[e];
  568. if (s > 2) i.error && i.error(s);
  569. else if (2 > s) {
  570. var a = this.I_LoginV1(c, d, e, t, n, r, o, i);
  571. c.getSessionCap(e, t, n, r, a)
  572. } else {
  573. var u = MD5((new Date).getTime().toString()).substring(0, 8);
  574. u = parseInt(u.replace("#", ""), 16).toString().substring(0, 8);
  575. var a = this.I_LoginV2(u, c, d, e, t, n, r, o, i);
  576. c.getSessionV2Cap(u, e, t, n, r, a)
  577. }
  578. })
  579. } else i.error && i.error(403, pt());
  580. else {
  581. var p = "";
  582. if (x == l) {
  583. p = S.Base64.encode(":" + r + ":" + o);
  584. var f = {
  585. success: null,
  586. error: null
  587. };
  588. S.extend(f, i), S.extend(f, {
  589. error: function(s, a) {
  590. p = S.Base64.encode(r + ":" + o), l = x, c = v;
  591. var u = {
  592. success: null,
  593. error: null
  594. };
  595. S.extend(u, i), S.extend(u, {
  596. error: function() {
  597. if (!U(i.cgi)) return i.error && i.error(s, a), void 0;
  598. p = S.Base64.encode(":" + r + ":" + o), l = D, c = C;
  599. var u = {
  600. success: null,
  601. error: null
  602. };
  603. S.extend(u, i), S.extend(u, {
  604. error: function(s, a) {
  605. p = S.Base64.encode(r + ":" + o), l = D, c = C;
  606. var u = {
  607. success: null,
  608. error: null
  609. };
  610. S.extend(u, i), S.extend(u, {
  611. error: function() {
  612. i.error && i.error(s, a)
  613. }
  614. }), ft(e, t, n, p, l, c, u)
  615. }
  616. }), ft(e, t, n, p, l, c, u)
  617. }
  618. }), ft(e, t, n, p, l, c, u)
  619. }
  620. }), ft(e, t, n, p, l, c, f)
  621. } else {
  622. p = S.Base64.encode(":" + r + ":" + o), l = D, c = C;
  623. var f = {
  624. success: null,
  625. error: null
  626. };
  627. S.extend(f, i), S.extend(f, {
  628. error: function(s, a) {
  629. p = S.Base64.encode(r + ":" + o), l = D, c = C;
  630. var u = {
  631. success: null,
  632. error: null
  633. };
  634. S.extend(u, i), S.extend(u, {
  635. error: function() {
  636. i.error && i.error(s, a)
  637. }
  638. }), ft(e, t, n, p, l, c, u)
  639. }
  640. }), ft(e, t, n, p, l, c, f)
  641. }
  642. }
  643. }, this.I_Logout = function(e) {
  644. var t = this.findDeviceIndexByIP(e);
  645. if (-1 != t) {
  646. if (ct()) {
  647. var n = P[t];
  648. clearInterval(n.sesstionTimer), n.oProtocolInc.sessionLogout(n, {})
  649. }
  650. return P.splice(t, 1), 0
  651. }
  652. return -1
  653. }, this.I_GetAudioInfo = function(e, t) {
  654. var n = this.findDeviceIndexByIP(e);
  655. if (-1 != n) {
  656. var r = P[n],
  657. s = {
  658. success: null,
  659. error: null
  660. };
  661. S.extend(s, t), r.oProtocolInc.getAudioInfo(r, s)
  662. }
  663. }, this.I_GetDeviceInfo = function(e, t) {
  664. var n = this.findDeviceIndexByIP(e);
  665. if (-1 != n) {
  666. var r = P[n],
  667. s = {
  668. success: null,
  669. error: null
  670. };
  671. S.extend(s, t), r.oProtocolInc.getDeviceInfo(r, s)
  672. }
  673. }, this.I_GetAnalogChannelInfo = function(e, t) {
  674. var n = this.findDeviceIndexByIP(e);
  675. if (-1 != n) {
  676. var r = P[n],
  677. s = {
  678. success: null,
  679. error: null
  680. };
  681. S.extend(s, t), r.oProtocolInc.getAnalogChannelInfo(r, s)
  682. }
  683. }, this.I_GetSecurityVersion = function(e, t) {
  684. var n = this.findDeviceIndexByIP(e);
  685. if (-1 != n) {
  686. var r = P[n],
  687. s = {
  688. success: null,
  689. error: null
  690. };
  691. S.extend(s, t), r.oProtocolInc.getSecurityVersion(r, s)
  692. }
  693. }, this.I_GetDigitalChannelInfo = function(e, t) {
  694. var n = this.findDeviceIndexByIP(e);
  695. if (-1 != n) {
  696. var r = P[n],
  697. s = {
  698. success: null,
  699. error: null
  700. };
  701. S.extend(s, t), r.oProtocolInc.getDigitalChannelInfo(r, s)
  702. }
  703. }, this.I_GetZeroChannelInfo = function(e, t) {
  704. var n = this.findDeviceIndexByIP(e);
  705. if (-1 != n) {
  706. var r = P[n],
  707. s = {
  708. success: null,
  709. error: null
  710. };
  711. S.extend(s, t), r.oProtocolInc.getZeroChannelInfo(r, s)
  712. }
  713. }, this.getStream = function(e, t, n) {
  714. var r = $.Deferred();
  715. return ct() && p.JS_Play(e, t, n).then(function() {
  716. addToWndSet(), r.resolve()
  717. }, function() {
  718. r.reject()
  719. }), r
  720. }, this.I_StartRealPlay = function(e, n) {
  721. var r = this.findDeviceIndexByIP(e),
  722. s = "",
  723. o = "",
  724. i = -1,
  725. a = 0,
  726. u = 0,
  727. c = !1,
  728. l = {
  729. iWndIndex: f,
  730. iStreamType: 1,
  731. iChannelID: 1,
  732. bZeroChannel: !1
  733. };
  734. if (S.extend(l, n), -1 != r) {
  735. at(P[r]);
  736. var d = P[r];
  737. if (ct()) {
  738. if (!d.bSupportWebsocket) return n.error && n.error(403, pt()), void 0;
  739. s = d.oProtocolInc.CGI.startWsRealPlay;
  740. var p = location.protocol;
  741. o = /^(https)(.*)$/.test(p) ? "wss://" : "ws://", d.iWSPort = U(l.iWSPort) ? 7681 : l.iWSPort, i = d.iWSPort, u = l.iStreamType, a = l.iChannelID <= d.iAnalogChannelNum ? l.iChannelID : d.oStreamCapa.iIpChanBase + parseInt(l.iChannelID, 10) - d.iAnalogChannelNum - 1, c = !0
  742. } else {
  743. var h = parseInt(t.$XML(g).find("ProtocolType").eq(0).text(), 10);
  744. h == H && d.oStreamCapa.bSupportShttpPlay ? (N("SHTTP RealPlay"), s = d.oProtocolInc.CGI.startShttpRealPlay, o = "http://", u = l.iStreamType - 1, a = l.iChannelID <= d.iAnalogChannelNum ? l.iChannelID : d.oStreamCapa.iIpChanBase + parseInt(l.iChannelID, 10) - d.iAnalogChannelNum - 1, c = !0, U(l.iPort) ? "https://" == d.szHttpProtocol ? (-1 == d.iHttpPort && (d.iHttpPort = nt(d).iHttpPort), i = d.iHttpPort) : i = d.iCGIPort : (d.iHttpPort = l.iPort, i = l.iPort)) : (N("RTSP RealPlay"), s = d.oProtocolInc.CGI.startRealPlay, o = "rtsp://", u = l.iStreamType, a = l.iChannelID, U(l.iRtspPort) || (d.iRtspPort = l.iRtspPort), -1 == d.iRtspPort && (d.iRtspPort = nt(d).iRtspPort), i = d.iRtspPort)
  745. }
  746. if (-1 == i) return N("获取端口号失败"), n.error && n.error(), void 0;
  747. S.extend(l, {
  748. urlProtocol: o,
  749. cgi: s,
  750. iPort: i,
  751. iStreamType: u,
  752. iChannelID: a
  753. }), r = this.findWndIndexByIndex(l.iWndIndex);
  754. var m = this; - 1 == r && d.oProtocolInc.startRealPlay(d, l).then(function() {
  755. r = m.findWndIndexByIndex(l.iWndIndex);
  756. var e = I[r];
  757. e.bShttpIPChannel = c, n.success && n.success()
  758. }, function() {
  759. ct() || (d.iRtspPort = -1), n.error && n.error()
  760. })
  761. } else n.error && n.error()
  762. }, this.I_CloseWin = function(e) {
  763. var t = this.findWndIndexByIndex(e);
  764. I.splice(t, 1)
  765. }, this.I_Stop = function(e) {
  766. var t = {
  767. iWndIndex: f
  768. };
  769. j(e) ? S.extend(t, e) : U(e) || (t.iWndIndex = e);
  770. var n = this.findWndIndexByIndex(t.iWndIndex);
  771. if (-1 != n) {
  772. var r = I[n];
  773. if (r.bRecord && (ct() || p.HWP_StopSave(r.iIndex)), r.bSound && (ct() || p.HWP_CloseSound()), r.bEZoom && (ct() || p.HWP_DisableZoom(r.iIndex)), ct()) p.JS_Stop(t.iWndIndex).then(function() {
  774. var iPlayIndex = this.findWndIndexByIndex(t.iWndIndex);
  775. I.splice(iPlayIndex, 1), t.success && t.success()
  776. }, function() {
  777. t.error && t.error()
  778. });
  779. else {
  780. var s = p.HWP_Stop(t.iWndIndex);
  781. var iPlayIndex = this.findWndIndexByIndex(t.iWndIndex);
  782. 0 == s ? (I.splice(iPlayIndex, 1), t.success && t.success()) : t.error && t.error()
  783. }
  784. } else t.error && t.error()
  785. }, this.I_OpenSound = function(e) {
  786. e = U(e) ? f : e;
  787. var t = this.findWndIndexByIndex(e),
  788. n = -1;
  789. if (-1 != t) {
  790. var r = I[t];
  791. r.bSound || (n = ct() ? p.JS_OpenSound(e) : p.HWP_OpenSound(e), 0 == n && (r.bSound = !0))
  792. }
  793. return n
  794. }, this.I_CloseSound = function(e) {
  795. e = U(e) ? f : e;
  796. var t = this.findWndIndexByIndex(e),
  797. n = -1;
  798. if (-1 != t) {
  799. var r = I[t];
  800. r.bSound && (n = ct() ? p.JS_CloseSound() : p.HWP_CloseSound(), 0 == n && (r.bSound = !1))
  801. }
  802. return n
  803. }, this.I_SetVolume = function(e, t) {
  804. var n = -1;
  805. if (e = parseInt(e, 10), isNaN(e)) return n;
  806. if (0 > e || e > 100) return n;
  807. t = U(t) ? f : t;
  808. var r = this.findWndIndexByIndex(t);
  809. return -1 != r && (ct() ? (p.JS_SetVolume(t, e), n = 0) : n = p.HWP_SetVolume(t, e)), n
  810. }, this.I2_CapturePic = function(e, t) {
  811. var n = {
  812. iWndIndex: f,
  813. bDateDir: !0
  814. };
  815. j(t) ? S.extend(n, t) : U(t) || (n.iWndIndex = t);
  816. var r = this.findWndIndexByIndex(n.iWndIndex),
  817. s = -1,
  818. o = $.Deferred();
  819. if (-1 != r)
  820. if (ct()) {
  821. var i = "JPEG";
  822. ".jpg" === e.slice(-4).toLowerCase() ? e = e.slice(0, -4) : ".jpeg" === e.slice(-5).toLowerCase() ? e = e.slice(0, -5) : ".bmp" === e.slice(-4).toLowerCase() && (e = e.slice(0, -4), i = "BMP"), p.JS_CapturePicture(n.iWndIndex, e, i).then(function() {
  823. o.resolve()
  824. }, function() {
  825. o.reject()
  826. })
  827. } else ".jpg" === e.slice(-4).toLowerCase() ? e = e.slice(0, -4) : ".jpeg" === e.slice(-5).toLowerCase() && (e = e.slice(0, -5)), s = p.HWP_CapturePicture(n.iWndIndex, e, n.bDateDir), 0 === s ? o.resolve() : o.reject();
  828. else o.reject();
  829. return o
  830. }, this.I2_CapturePicData = function(e) {
  831. var t = {
  832. iWndIndex: f,
  833. bDateDir: !0
  834. };
  835. j(e) ? S.extend(t, e) : U(e) || (t.iWndIndex = e);
  836. var n = this.findWndIndexByIndex(t.iWndIndex);
  837. if (-1 != n) {
  838. var r = $.Deferred();
  839. ct() ? p.JS_CapturePictureData(t.iWndIndex).then(function(e) {
  840. r.resolve(e)
  841. }, function(e) {
  842. N(e), r.reject()
  843. }) : r.reject()
  844. } else r.reject();
  845. return r
  846. }, this.I_StartRecord = function(e, t) {
  847. var n = {
  848. iWndIndex: f,
  849. bDateDir: !0
  850. };
  851. j(t) ? S.extend(n, t) : U(t) || (n.iWndIndex = t);
  852. var r = this.findWndIndexByIndex(n.iWndIndex);
  853. if (-1 != r) {
  854. var s = I[r];
  855. if (s.bRecord) n.error && n.error();
  856. else if (ct()) {
  857. var o = S.browser();
  858. o.chrome ? p.JS_StartSave(n.iWndIndex, e).then(function() {
  859. s.bRecord = !0, n.success && n.success()
  860. }, function() {
  861. n.error && n.error()
  862. }) : n.error && n.error()
  863. } else {
  864. var i = p.HWP_StartSave(n.iWndIndex, e, n.bDateDir);
  865. 0 == i ? (s.bRecord = !0, n.success && n.success()) : n.error && n.error()
  866. }
  867. } else n.error && n.error()
  868. }, this.I_StopRecord = function(e) {
  869. var t = {
  870. iWndIndex: f
  871. };
  872. j(e) ? S.extend(t, e) : U(e) || (t.iWndIndex = e);
  873. var n = this.findWndIndexByIndex(t.iWndIndex);
  874. if (-1 != n) {
  875. var r = I[n];
  876. if (r.bRecord)
  877. if (ct()) {
  878. var s = S.browser();
  879. s.chrome ? p.JS_StopSave(t.iWndIndex).then(function() {
  880. r.bRecord = !1, t.success && t.success()
  881. }, function() {
  882. t.error && t.error()
  883. }) : t.error && t.error()
  884. } else {
  885. var o = p.HWP_StopSave(t.iWndIndex);
  886. 0 == o ? (r.bRecord = !1, t.success && t.success()) : t.error && t.error()
  887. }
  888. else t.error && t.error()
  889. } else t.error && t.error()
  890. }, this.I_StartVoiceTalk = function(e, t) {
  891. if (isNaN(parseInt(t, 10))) return -1;
  892. var n = this.findDeviceIndexByIP(e),
  893. r = -1;
  894. if (-1 != n) {
  895. var s = P[n];
  896. s.bVoiceTalk || (r = ct() ? -1 : s.oProtocolInc.startVoiceTalk(s, t), 0 == r && (P[n].bVoiceTalk = !0))
  897. }
  898. return r
  899. }, this.I_StopVoiceTalk = function() {
  900. var e = -1;
  901. if (!ct()) {
  902. e = p.HWP_StopVoiceTalk();
  903. for (var t = 0, n = P.length; n > t; t++)
  904. if (P[t].bVoiceTalk) {
  905. P[t].bVoiceTalk = !1;
  906. break
  907. }
  908. }
  909. return e
  910. }, this.I_PTZControl = function(e, t, n) {
  911. var r = {
  912. iWndIndex: f,
  913. iPTZIndex: e,
  914. iPTZSpeed: 4
  915. };
  916. S.extend(r, n), S.extend(r, {
  917. async: !1
  918. });
  919. var s = this.findWndIndexByIndex(r.iWndIndex);
  920. if (-1 != s) {
  921. var o = I[s];
  922. if (s = this.findDeviceIndexByIP(o.szIP), -1 != s) {
  923. var i = P[s];
  924. 9 == e ? i.oProtocolInc.ptzAutoControl(i, t, o, r) : i.oProtocolInc.ptzControl(i, t, o, r)
  925. }
  926. }
  927. }, this.I_EnableEZoom = function(e) {
  928. e = U(e) ? f : e;
  929. var t = this.findWndIndexByIndex(e),
  930. n = -1;
  931. if (-1 != t) {
  932. var r = I[t];
  933. r.bEZoom || (n = ct() ? p.JS_EnableZoom(e) : p.HWP_EnableZoom(e, 0), 0 == n && (r.bEZoom = !0))
  934. }
  935. return n
  936. }, this.I_DisableEZoom = function(e) {
  937. e = U(e) ? f : e;
  938. var t = this.findWndIndexByIndex(e),
  939. n = -1;
  940. if (-1 != t) {
  941. var r = I[t];
  942. r.bEZoom && (ct() ? n = p.JS_DisableZoom(e) : (p.HWP_DisableZoom(e), n = 0), 0 == n && (r.bEZoom = !1))
  943. }
  944. return n
  945. }, this.I_Enable3DZoom = function(e) {
  946. e = U(e) ? f : e;
  947. var t = this.findWndIndexByIndex(e),
  948. n = -1;
  949. if (-1 != t) {
  950. var r = I[t];
  951. r.b3DZoom || (ct() ? (n = 0, p.JS_Enable3DZoom(e, function(e) {
  952. window.ZoomInfoCallback(e)
  953. })) : n = p.HWP_EnableZoom(e, 1), 0 == n && (r.b3DZoom = !0))
  954. }
  955. return n
  956. }, this.I_Disable3DZoom = function(e) {
  957. e = U(e) ? f : e;
  958. var t = this.findWndIndexByIndex(e),
  959. n = -1;
  960. if (-1 != t) {
  961. var r = I[t];
  962. r.b3DZoom && (ct() ? (p.JS_Disable3DZoom(e), n = 0) : (p.HWP_DisableZoom(e), n = 0), 0 == n && (r.b3DZoom = !1))
  963. }
  964. return n
  965. }, this.I_FullScreen = function(e) {
  966. ct() ? p.JS_FullScreenSingle(f) : p.HWP_FullScreenDisplay(e)
  967. }, this.I_SetPreset = function(e, t) {
  968. var n = {
  969. iWndIndex: f,
  970. iPresetID: e
  971. };
  972. S.extend(n, t);
  973. var r = this.findWndIndexByIndex(n.iWndIndex);
  974. if (-1 != r) {
  975. var s = I[r];
  976. if (r = this.findDeviceIndexByIP(s.szIP), -1 != r) {
  977. var o = P[r];
  978. o.oProtocolInc.setPreset(o, s, n)
  979. }
  980. }
  981. }, this.I_GoPreset = function(e, t) {
  982. var n = {
  983. iWndIndex: f,
  984. iPresetID: e
  985. };
  986. S.extend(n, t);
  987. var r = this.findWndIndexByIndex(n.iWndIndex);
  988. if (-1 != r) {
  989. var s = I[r];
  990. if (r = this.findDeviceIndexByIP(s.szIP), -1 != r) {
  991. var o = P[r];
  992. o.oProtocolInc.goPreset(o, s, n)
  993. }
  994. }
  995. }, this.I_RecordSearch = function(e, t, n, r, s) {
  996. var o = this.findDeviceIndexByIP(e);
  997. if (-1 != o) {
  998. var i = P[o],
  999. a = {
  1000. iChannelID: t,
  1001. szStartTime: n,
  1002. szEndTime: r,
  1003. iSearchPos: 0,
  1004. iStreamType: 1,
  1005. success: null,
  1006. error: null
  1007. };
  1008. S.extend(a, s), i.oProtocolInc.recordSearch(i, a)
  1009. }
  1010. }, this.I_StartPlayback = function(e, n) {
  1011. var r = this.findDeviceIndexByIP(e),
  1012. s = "",
  1013. o = "",
  1014. i = -1,
  1015. a = 1,
  1016. u = 0,
  1017. c = S.dateFormat(new Date, "yyyy-MM-dd"),
  1018. l = {
  1019. iWndIndex: f,
  1020. iStreamType: 1,
  1021. iChannelID: 1,
  1022. szStartTime: c + " 00:00:00",
  1023. szEndTime: c + " 23:59:59"
  1024. };
  1025. if (S.extend(l, n), -1 != r) {
  1026. at(P[r]);
  1027. var d = P[r];
  1028. if (ct()) {
  1029. if (!d.bSupportWebsocket) return n.error && n.error(403, pt()), void 0;
  1030. if (!U(l.oTransCodeParam)) return n.error && n.error(), void 0;
  1031. s = d.oProtocolInc.CGI.startWsPlayback;
  1032. var p = location.protocol;
  1033. o = /^(https)(.*)$/.test(p) ? "wss://" : "ws://", d.iWSPort = U(l.iWSPort) ? 7681 : l.iWSPort, i = d.iWSPort, u = l.iStreamType, a = l.iChannelID <= d.iAnalogChannelNum ? l.iChannelID : d.oStreamCapa.iIpChanBase + parseInt(l.iChannelID, 10) - d.iAnalogChannelNum - 1, a = 100 * a + u
  1034. } else {
  1035. var h = parseInt(t.$XML(g).find("ProtocolType").eq(0).text(), 10);
  1036. h == H && d.oStreamCapa.bSupportShttpPlay ? (s = U(l.oTransCodeParam) ? d.oProtocolInc.CGI.startShttpPlayback : d.oProtocolInc.CGI.startTransCodePlayback, o = "http://", u = l.iStreamType - 1, a = l.iChannelID <= d.iAnalogChannelNum ? l.iChannelID : d.oStreamCapa.iIpChanBase + parseInt(l.iChannelID, 10) - d.iAnalogChannelNum - 1, d.bSupportSubStreamPlayback && (a = 100 * a + u), U(l.iPort) ? "https://" == d.szHttpProtocol ? (-1 == d.iHttpPort && (d.iHttpPort = nt(d).iHttpPort), i = d.iHttpPort) : i = d.iCGIPort : (d.iHttpPort = l.iPort, i = l.iPort)) : (s = d.oProtocolInc.CGI.startPlayback, o = "rtsp://", u = l.iStreamType, a = 100 * l.iChannelID + u, U(l.iRtspPort) || (d.iRtspPort = l.iRtspPort), -1 == d.iRtspPort && (d.iRtspPort = nt(d).iRtspPort), i = d.iRtspPort)
  1037. }
  1038. if (-1 == i) return N("获取端口号失败"), n.error && n.error(), void 0;
  1039. S.extend(l, {
  1040. urlProtocol: o,
  1041. cgi: s,
  1042. iPort: i,
  1043. iChannelID: a
  1044. }), r = this.findWndIndexByIndex(l.iWndIndex), -1 == r && (ct() ? (l.szStartTime = l.szStartTime.replace(" ", "T") + "Z", l.szEndTime = l.szEndTime.replace(" ", "T") + "Z", d.oProtocolInc.startPlayback(d, l).then(function() {
  1045. n.success && n.success()
  1046. }, function() {
  1047. n.error && n.error()
  1048. })) : (l.szStartTime = l.szStartTime.replace(/[-:]/g, "").replace(" ", "T") + "Z", l.szEndTime = l.szEndTime.replace(/[-:]/g, "").replace(" ", "T") + "Z", d.oProtocolInc.startPlayback(d, l).then(function() {
  1049. n.success && n.success()
  1050. }, function() {
  1051. d.iRtspPort = -1, n.error && n.error()
  1052. })))
  1053. } else n.error && n.error()
  1054. }, this.I_ReversePlayback = function(e, n) {
  1055. var r = this.findDeviceIndexByIP(e),
  1056. s = -1,
  1057. o = "",
  1058. i = "",
  1059. a = -1,
  1060. u = -1,
  1061. c = 0,
  1062. l = S.dateFormat(new Date, "yyyy-MM-dd"),
  1063. d = {
  1064. iWndIndex: f,
  1065. iStreamType: 1,
  1066. iChannelID: 1,
  1067. szStartTime: l + " 00:00:00",
  1068. szEndTime: l + " 23:59:59"
  1069. };
  1070. if (S.extend(d, n), -1 != r) {
  1071. at(P[r]);
  1072. var p = P[r];
  1073. if (ct()) return s;
  1074. var h = parseInt(t.$XML(g).find("ProtocolType").eq(0).text(), 10);
  1075. if (h == H && p.oStreamCapa.bSupportShttpPlay ? (o = p.oProtocolInc.CGI.startShttpReversePlayback, i = "http://", c = d.iStreamType - 1, u = d.iChannelID <= p.iAnalogChannelNum ? d.iChannelID : p.oStreamCapa.iIpChanBase + parseInt(d.iChannelID, 10) - p.iAnalogChannelNum - 1, u = 100 * u + c, U(d.iPort) ? "https://" == p.szHttpProtocol ? (-1 == p.iHttpPort && (p.iHttpPort = nt(p).iHttpPort), a = p.iHttpPort) : a = p.iCGIPort : (p.iHttpPort = d.iPort, a = d.iPort)) : (o = p.oProtocolInc.CGI.startPlayback, i = "rtsp://", c = d.iStreamType, u = 100 * d.iChannelID + c, U(d.iRtspPort) || (p.iRtspPort = d.iRtspPort), -1 == p.iRtspPort && (p.iRtspPort = nt(p).iRtspPort), a = p.iRtspPort), -1 == a) return N("获取端口号失败"), s;
  1076. S.extend(d, {
  1077. urlProtocol: i,
  1078. cgi: o,
  1079. iPort: a,
  1080. iChannelID: u
  1081. }), r = this.findWndIndexByIndex(d.iWndIndex), -1 == r && (d.szStartTime = d.szStartTime.replace(/[-:]/g, "").replace(" ", "T") + "Z", d.szEndTime = d.szEndTime.replace(/[-:]/g, "").replace(" ", "T") + "Z", s = p.oProtocolInc.reversePlayback(p, d))
  1082. }
  1083. return -1 == s && (p.iRtspPort = -1), s
  1084. }, this.I_Frame = function(e) {
  1085. var t = {
  1086. iWndIndex: f
  1087. };
  1088. j(e) ? S.extend(t, e) : U(e) || (t.iWndIndex = e);
  1089. var n = this.findWndIndexByIndex(t.iWndIndex);
  1090. if (-1 != n) {
  1091. var r = I[n],
  1092. s = r.iPlayStatus;
  1093. if (s == A || s == L)
  1094. if (ct()) p.JS_FrameForward(t.iWndIndex).then(function() {
  1095. r.iPlayStatus = L, t.success && t.success()
  1096. }, function() {
  1097. t.error && t.error()
  1098. });
  1099. else {
  1100. var o = p.HWP_FrameForward(t.iWndIndex);
  1101. 0 == o ? (r.iPlayStatus = L, t.success && t.success()) : t.error && t.error()
  1102. }
  1103. else t.error && t.error()
  1104. } else t.error && t.error()
  1105. }, this.I_Pause = function(e) {
  1106. var t = {
  1107. iWndIndex: f
  1108. };
  1109. j(e) ? S.extend(t, e) : U(e) || (t.iWndIndex = e);
  1110. var n = this.findWndIndexByIndex(t.iWndIndex);
  1111. if (-1 != n) {
  1112. var r = I[n],
  1113. s = r.iPlayStatus,
  1114. o = -1;
  1115. if (s == A) o = M;
  1116. else {
  1117. if (s != q) return t.error && t.error(), void 0;
  1118. o = R
  1119. }
  1120. if (ct()) p.JS_Pause(t.iWndIndex).then(function() {
  1121. r.iPlayStatus = o, t.success && t.success()
  1122. }, function() {
  1123. t.error && t.error()
  1124. });
  1125. else {
  1126. var i = p.HWP_Pause(t.iWndIndex);
  1127. 0 == i ? (r.iPlayStatus = o, t.success && t.success()) : t.error && t.error()
  1128. }
  1129. } else t.error && t.error()
  1130. }, this.I_Resume = function(e) {
  1131. var t = {
  1132. iWndIndex: f
  1133. };
  1134. j(e) ? S.extend(t, e) : U(e) || (t.iWndIndex = e);
  1135. var n = this.findWndIndexByIndex(t.iWndIndex);
  1136. if (-1 != n) {
  1137. var r = I[n],
  1138. s = r.iPlayStatus,
  1139. o = -1;
  1140. if (s == M || s == L) o = A;
  1141. else {
  1142. if (s != R) return t.error && t.error(), void 0;
  1143. o = q
  1144. }
  1145. if (ct()) p.JS_Resume(t.iWndIndex).then(function() {
  1146. r.iPlayStatus = o, t.success && t.success()
  1147. }, function() {
  1148. t.error && t.error()
  1149. });
  1150. else {
  1151. var i = p.HWP_Resume(t.iWndIndex);
  1152. 0 == i ? (r.iPlayStatus = o, t.success && t.success()) : t.error && t.error()
  1153. }
  1154. } else t.error && t.error()
  1155. }, this.I_PlaySlow = function(e) {
  1156. var t = {
  1157. iWndIndex: f
  1158. };
  1159. j(e) ? S.extend(t, e) : U(e) || (t.iWndIndex = e);
  1160. var n = this.findWndIndexByIndex(t.iWndIndex);
  1161. if (-1 != n) {
  1162. var r = I[n];
  1163. if (r.iPlayStatus == A)
  1164. if (ct()) {
  1165. var s = p.JS_GetWndStatus(t.iWndIndex);
  1166. s.iRate <= -4 ? t.error && t.error() : p.JS_Slow(t.iWndIndex).then(function() {
  1167. t.success && t.success()
  1168. }, function() {
  1169. t.error && t.error()
  1170. })
  1171. } else {
  1172. var o = p.HWP_Slow(t.iWndIndex);
  1173. 0 == o ? t.success && t.success() : t.error && t.error()
  1174. }
  1175. else t.error && t.error()
  1176. } else t.error && t.error()
  1177. }, this.I_PlayFast = function(e) {
  1178. var t = {
  1179. iWndIndex: f
  1180. };
  1181. j(e) ? S.extend(t, e) : U(e) || (t.iWndIndex = e);
  1182. var n = this.findWndIndexByIndex(t.iWndIndex);
  1183. if (-1 != n) {
  1184. var r = I[n];
  1185. if (r.iPlayStatus == A)
  1186. if (ct()) {
  1187. var s = p.JS_GetWndStatus(t.iWndIndex);
  1188. s.iRate >= 8 ? t.error && t.error() : p.JS_Fast(t.iWndIndex).then(function() {
  1189. t.success && t.success()
  1190. }, function() {
  1191. t.error && t.error()
  1192. })
  1193. } else {
  1194. var o = p.HWP_Fast(t.iWndIndex);
  1195. 0 == o ? t.success && t.success() : t.error && t.error()
  1196. }
  1197. else t.error && t.error()
  1198. } else t.error && t.error()
  1199. }, this.I_GetOSDTime = function(e) {
  1200. var t = {
  1201. iWndIndex: f
  1202. };
  1203. j(e) ? S.extend(t, e) : U(e) || (t.iWndIndex = e);
  1204. var n = this.findWndIndexByIndex(t.iWndIndex);
  1205. if (-1 != n) {
  1206. if (ct()) p.JS_GetOSDTime(t.iWndIndex).then(function(e) {
  1207. if (t.success) {
  1208. var n = S.dateFormat(new Date(1e3 * e), "yyyy-MM-dd hh:mm:ss");
  1209. t.success(n)
  1210. }
  1211. }, function() {
  1212. t.error && t.error()
  1213. });
  1214. else if (t.success) {
  1215. var r = p.HWP_GetOSDTime(t.iWndIndex),
  1216. s = S.dateFormat(new Date(1e3 * r), "yyyy-MM-dd hh:mm:ss");
  1217. t.success(s)
  1218. }
  1219. } else t.error && t.error()
  1220. }, this.I_StartDownloadRecord = function(e, t, n, r) {
  1221. var s = this.findDeviceIndexByIP(e),
  1222. o = -1;
  1223. if (-1 != s) {
  1224. var i = P[s],
  1225. a = {
  1226. szPlaybackURI: t,
  1227. szFileName: n,
  1228. bDateDir: !0
  1229. };
  1230. U(r) || S.extend(a, r), o = i.oProtocolInc.startDownloadRecord(i, a)
  1231. }
  1232. return o
  1233. }, this.I_StartDownloadRecordByTime = function(e, t, n, r, s, o) {
  1234. var i = this.findDeviceIndexByIP(e),
  1235. a = -1;
  1236. if (-1 != i) {
  1237. var u = P[i];
  1238. t = t.split("?")[0] + "?starttime=" + r.replace(" ", "T") + "Z&endtime=" + s.replace(" ", "T") + "Z";
  1239. var c = {
  1240. szPlaybackURI: t,
  1241. szFileName: n,
  1242. bDateDir: !0
  1243. };
  1244. U(o) || S.extend(c, o), a = u.oProtocolInc.startDownloadRecord(u, c)
  1245. }
  1246. return a
  1247. }, this.I_GetDownloadStatus = function(e) {
  1248. var t = -1;
  1249. return ct() ? t : (t = p.HWP_GetDownloadStatus(e), 1 == t && (t = -1), t)
  1250. }, this.I_GetDownloadProgress = function(e) {
  1251. return ct() ? -1 : p.HWP_GetDownloadProgress(e)
  1252. }, this.I_StopDownloadRecord = function(e) {
  1253. return ct() ? -1 : p.HWP_StopDownload(e)
  1254. }, this.I_ExportDeviceConfig = function(e, t) {
  1255. var n = this.findDeviceIndexByIP(e),
  1256. r = -1;
  1257. if (-1 != n) {
  1258. var s = P[n];
  1259. r = s.oProtocolInc.exportDeviceConfig(s, t)
  1260. }
  1261. return r
  1262. }, this.I_ImportDeviceConfig = function(e, t, n) {
  1263. var r = this.findDeviceIndexByIP(e),
  1264. s = -1;
  1265. if (-1 != r) {
  1266. var o = P[r],
  1267. i = {
  1268. szFileName: t
  1269. };
  1270. s = o.oProtocolInc.importDeviceConfig(o, i, n)
  1271. }
  1272. return s
  1273. }, this.I_RestoreDefault = function(e, t, n) {
  1274. var r = {
  1275. success: null,
  1276. error: null
  1277. };
  1278. S.extend(r, n);
  1279. var s = this.findDeviceIndexByIP(e);
  1280. if (-1 != s) {
  1281. var o = P[s];
  1282. o.oProtocolInc.restore(o, t, r)
  1283. }
  1284. }, this.I_Restart = function(e, t) {
  1285. var n = this.findDeviceIndexByIP(e),
  1286. r = {
  1287. success: null,
  1288. error: null
  1289. };
  1290. if (S.extend(r, t), -1 != n) {
  1291. var s = P[n];
  1292. s.oProtocolInc.restart(s, r)
  1293. }
  1294. }, this.I_Reconnect = function(e, t) {
  1295. var n = this.findDeviceIndexByIP(e),
  1296. r = {
  1297. success: null,
  1298. error: null
  1299. };
  1300. if (S.extend(r, t), -1 != n) {
  1301. var s = P[n];
  1302. s.oProtocolInc.login(s.szIP, s.iCGIPort, s.szAuth, r)
  1303. }
  1304. }, this.I_StartUpgrade = function(e, t) {
  1305. var n = this.findDeviceIndexByIP(e),
  1306. r = -1;
  1307. if (-1 != n) {
  1308. var s = P[n],
  1309. o = {
  1310. szFileName: t
  1311. };
  1312. return ct() ? r : s.oProtocolInc.startUpgrade(s, o)
  1313. }
  1314. return r
  1315. }, this.I2_StartUpgrade = function(e, t) {
  1316. var n = this.findDeviceIndexByIP(e);
  1317. if (-1 != n) {
  1318. var r = P[n],
  1319. s = {
  1320. szFileName: t
  1321. };
  1322. return r.oProtocolInc.asyncstartUpgrade(r, s)
  1323. }
  1324. }, this.I_UpgradeStatus = function() {
  1325. return ct() ? p.JS_UpgradeStatus() : p.HWP_UpgradeStatus()
  1326. }, this.I_UpgradeProgress = function() {
  1327. return ct() ? p.JS_UpgradeProgress() : p.HWP_UpgradeProgress()
  1328. }, this.I_StopUpgrade = function() {
  1329. return ct() ? -1 : p.HWP_StopUpgrade()
  1330. }, this.I_CheckPluginInstall = function() {
  1331. var e = -1,
  1332. t = S.browser();
  1333. if (ct()) e = 0;
  1334. else if (t.msie) try {
  1335. new ActiveXObject("WebVideoKitActiveX.WebVideoKitActiveXCtrl.1"), e = 0
  1336. } catch (n) {} else
  1337. for (var r = 0, s = navigator.mimeTypes.length; s > r; r++)
  1338. if ("application/webvideo-plugin-kit" == navigator.mimeTypes[r].type.toLowerCase()) {
  1339. e = 0;
  1340. break
  1341. }
  1342. return e
  1343. }, this.I_CheckPluginVersion = function() {
  1344. return ct() ? 0 : p.HWP_CheckPluginUpdate(B) ? -1 : 0
  1345. }, this.I_SendHTTPRequest = function(e, t, n) {
  1346. var r = this.findDeviceIndexByIP(e);
  1347. if (!(0 > r)) {
  1348. var s = P[r],
  1349. o = new Pt,
  1350. i = s.szHttpProtocol + s.szIP + ":" + s.iCGIPort + "/" + t,
  1351. a = {
  1352. type: "GET",
  1353. url: i,
  1354. auth: s.szAuth,
  1355. success: null,
  1356. error: null
  1357. };
  1358. S.extend(a, n), S.extend(a, {
  1359. success: function(e) {
  1360. n.success && n.success(e)
  1361. },
  1362. error: function(e, t) {
  1363. n.error && n.error(e, t)
  1364. }
  1365. }), o.setRequestParam(a), o.submitRequest()
  1366. }
  1367. }, this.I_RemoteConfig = function(e, t) {
  1368. var n = this.findDeviceIndexByIP(e),
  1369. r = -1,
  1370. s = -1;
  1371. if (ct()) return r;
  1372. var o = {
  1373. iLan: 0,
  1374. iDevicePort: -1,
  1375. iType: 0
  1376. };
  1377. if (S.extend(o, t), -1 != n) {
  1378. var i = P[n];
  1379. if (-1 == o.iDevicePort)
  1380. if (-1 == i.iDevicePort) {
  1381. if (i.iDevicePort = nt(i).iDevicePort, s = i.iDevicePort, -1 == s) return r
  1382. } else s = i.iDevicePort;
  1383. else s = o.iDevicePort;
  1384. if (":" == S.Base64.decode(i.szAuth)[0]) var a = S.Base64.decode(i.szAuth).split(":")[1],
  1385. u = S.Base64.decode(i.szAuth).split(":")[2];
  1386. else var a = S.Base64.decode(i.szAuth).split(":")[0],
  1387. u = S.Base64.decode(i.szAuth).split(":")[1];
  1388. var c = "<RemoteInfo><DeviceInfo><DeviceType>" + o.iType + "</DeviceType>" + "<LanType>" + o.iLan + "</LanType>" + "<IP>" + i.szIP + "</IP>" + "<Port>" + s + "</Port>" + "<UName>" + a + "</UName>" + "<PWD>" + S.Base64.encode(u) + "</PWD></DeviceInfo></RemoteInfo>";
  1389. return p.HWP_ShowRemConfig(c)
  1390. }
  1391. return r
  1392. }, this.I_ChangeWndNum = function(e) {
  1393. return isNaN(parseInt(e, 10)) ? -1 : (ct() ? p.JS_ArrangeWindow(e) : p.HWP_ArrangeWindow(e), 0)
  1394. }, this.I_GetLastError = function() {
  1395. return ct() ? -1 : p.HWP_GetLastError()
  1396. }, this.I_GetWindowStatus = function(e) {
  1397. if (U(e)) {
  1398. var t = [];
  1399. return S.extend(t, I), t
  1400. }
  1401. var n = this.findWndIndexByIndex(e);
  1402. if (-1 != n) {
  1403. var t = {};
  1404. return S.extend(t, I[n]), t
  1405. }
  1406. return null
  1407. }, this.I_GetIPInfoByMode = function(e, t, n, r) {
  1408. return ct() ? "" : p.HWP_GetIpInfoByMode(e, t, n, r)
  1409. }, this.I_SetPlayModeType = function(e) {
  1410. return ct() ? 0 : p.HWP_SetPlayModeType(e)
  1411. }, this.I_SetSnapDrawMode = function(e, t) {
  1412. return ct() ? t > -1 ? p.JS_SetDrawStatus(!0) : p.JS_SetDrawStatus(!1) : p.HWP_SetSnapDrawMode(e, t)
  1413. }, this.I2_SetSnapPolygonInfo = function(r, s) {
  1414. if (ct()) {
  1415. p.JS_GetPolygonInfo();
  1416. var o = S.loadXML(s),
  1417. a = [];
  1418. for (nodeList = t.$XML(o).find("SnapPolygon", !0), i = 0, iLen = nodeList.length; iLen > i; i++) {
  1419. node = nodeList[i];
  1420. var u = e(t.$XML(node).find("r").eq(0).text(), t.$XML(node).find("g").eq(0).text(), t.$XML(node).find("b").eq(0).text());
  1421. u = n(u, 6), u = "#" + u;
  1422. for (var c = [], l = t.$XML(node).find("point", !0), d = 0, f = l.length; f > d; d++) oNodePoint = l[d], c.push([500 * t.$XML(oNodePoint).find("x").eq(0).text(), 300 * t.$XML(oNodePoint).find("y").eq(0).text()]);
  1423. a.push({
  1424. iPolygonType: 1,
  1425. id: t.$XML(node).find("id").eq(0).text(),
  1426. iEditType: 0,
  1427. aPoint: c,
  1428. bClosed: !0,
  1429. szTips: t.$XML(node).find("tips").eq(0).text(),
  1430. szDrawColor: u,
  1431. iTranslucent: .1
  1432. })
  1433. }
  1434. return p.JS_SetPolygonInfo(a)
  1435. }
  1436. return p.HWP_SetSnapPolygonInfo(r, s)
  1437. }, this.I_SetSnapPolygonInfo = function(r, s) {
  1438. if (ct()) {
  1439. var o = p.JS_GetPolygonInfo(),
  1440. i = S.loadXML(s),
  1441. a = [];
  1442. for (D = t.$XML(i).find("SnapPolygon", !0), d = 0, f = D.length; f > d; d++) {
  1443. h = D[d];
  1444. var u = e(t.$XML(h).find("r").eq(0).text(), t.$XML(h).find("g").eq(0).text(), t.$XML(h).find("b").eq(0).text());
  1445. u = n(u, 6), u = "#" + u, a.push({
  1446. id: t.$XML(h).find("id").eq(0).text(),
  1447. tips: t.$XML(h).find("tips").eq(0).text(),
  1448. iMaxShapeSupport: o.length + 1,
  1449. iMaxPointSupport: t.$XML(h).find("PointNumMax").eq(0).text(),
  1450. iMinPointSupport: t.$XML(h).find("MinClosed").eq(0).text(),
  1451. style: {
  1452. szDrawColor: u,
  1453. iTranslucent: .1
  1454. }
  1455. })
  1456. }
  1457. 0 === D.length && a.push({
  1458. iMaxShapeSupport: 1,
  1459. iMaxPointSupport: 17,
  1460. iMinPointSupport: 1,
  1461. style: {
  1462. szDrawColor: "#FFFF00",
  1463. iTranslucent: .1
  1464. }
  1465. });
  1466. var c = [];
  1467. $.each(o, function(e, t) {
  1468. c.push(t.id)
  1469. });
  1470. var l = c.join(",");
  1471. if (l = "," + l + ",", o.length + a.length > 32) return -3;
  1472. for (var d = 0, f = a.length; f > d; d++) {
  1473. var h = a[d],
  1474. P = h.id;
  1475. if (!S.isInt(P)) return -2;
  1476. var I = parseInt(P, 10);
  1477. if (1 > I || I > 32) return -2;
  1478. if (l.indexOf("," + P + ",") > -1) return -4;
  1479. var m = h.tips;
  1480. if (m.length > 32) return -2;
  1481. var v = h.flag;
  1482. if (!v) {
  1483. var C = h.iMinPointSupport;
  1484. if (!S.isInt(C)) return -2;
  1485. var y = parseInt(C, 10);
  1486. if (4 > y || y > 17) return -2;
  1487. var g = h.iMaxPointSupport;
  1488. if (!S.isInt(g)) return -2;
  1489. var x = parseInt(g, 10);
  1490. if (y > x || x > 17) return -2
  1491. }
  1492. }
  1493. return p.JS_SetDrawShapeInfo("Polygon", a[0])
  1494. }
  1495. var i, D, d, f, h, P, I, m, C, y, v, g, x, z = p.HWP_GetSnapPolygonInfo(r);
  1496. i = S.loadXML(z), D = t.$XML(i).find("SnapPolygon", !0);
  1497. var b = D.length,
  1498. c = [];
  1499. for (d = 0, f = D.length; f > d; d++) h = D[d], c.push(t.$XML(h).find("id").eq(0).text());
  1500. var l = c.join(",");
  1501. if (l = "," + l + ",", i = S.loadXML(s), D = t.$XML(i).find("SnapPolygon", !0), b + D.length > 32) return -3;
  1502. for (d = 0, f = D.length; f > d; d++) {
  1503. if (h = D[d], P = t.$XML(h).find("id").eq(0).text(), !S.isInt(P)) return -2;
  1504. if (I = parseInt(P, 10), 1 > I || I > 32) return -2;
  1505. if (l.indexOf("," + P + ",") > -1) return -4;
  1506. if (m = t.$XML(h).find("tips").eq(0).text(), m.length > 32) return -2;
  1507. if (v = "true" === t.$XML(h).find("isClosed").eq(0).text(), !v) {
  1508. if (C = t.$XML(h).find("MinClosed").eq(0).text(), !S.isInt(C)) return -2;
  1509. if (y = parseInt(C, 10), 4 > y || y > 17) return -2;
  1510. if (g = t.$XML(h).find("PointNumMax").eq(0).text(), !S.isInt(g)) return -2;
  1511. if (x = parseInt(g, 10), y > x || x > 17) return -2
  1512. }
  1513. }
  1514. return p.HWP_SetSnapPolygonInfo(r, s)
  1515. }, this.I_GetSnapPolygonInfo = function(e) {
  1516. if (ct()) {
  1517. for (var t = p.JS_GetPolygonInfo(e), n = '<?xml version="1.0" encoding="utf-8"?><SnapPolygonList>', s = 0; s < t.length; s++) {
  1518. n += "<SnapPolygon>";
  1519. var o = r(t[s].szDrawColor);
  1520. n += "<id>" + t[s].szTips.split("#")[1] + "</id><polygonType>1</polygonType><color><r>" + o[0] + "</r><g>" + o[1] + "</g><b>" + o[2] + "</b></color><tips>" + t[s].szTips + "</tips><isClosed>" + t[s].bClosed + "</isClosed><pointList>";
  1521. for (var i = 0; i < t[s].aPoint.length; i++) n += "<point><x>" + t[s].aPoint[i][0] / a + "</x><y>" + t[s].aPoint[i][1] / u + "</y></point>";
  1522. n += "</pointList></SnapPolygon>"
  1523. }
  1524. return n += "</SnapPolygonList>"
  1525. }
  1526. return p.HWP_GetSnapPolygonInfo(e)
  1527. }, this.I_ClearSnapInfo = function(e) {
  1528. return ct() ? p.JS_ClearSnapInfo() : p.HWP_ClearSnapInfo(e, 1)
  1529. }, this.I_DeviceCapturePic = function(e, t, n, r) {
  1530. var s = this.findDeviceIndexByIP(e),
  1531. o = -1;
  1532. if (-1 != s) {
  1533. var i = P[s],
  1534. a = {
  1535. bDateDir: !0
  1536. };
  1537. if (S.extend(a, r), !U(a.iResolutionWidth) && !S.isInt(a.iResolutionWidth)) return o;
  1538. if (!U(a.iResolutionHeight) && !S.isInt(a.iResolutionHeight)) return o;
  1539. o = i.oProtocolInc.deviceCapturePic(i, t, n, a)
  1540. }
  1541. return o
  1542. }, this.I_SetPackageType = function(e) {
  1543. return ct() ? -1 : p.HWP_SetPackageType(e)
  1544. }, this.I_GetDevicePort = function(e) {
  1545. var t = this.findDeviceIndexByIP(e),
  1546. n = null;
  1547. if (-1 != t) {
  1548. var r = P[t];
  1549. n = nt(r)
  1550. }
  1551. return n
  1552. }, this.I_GetTextOverlay = function(e, t, n) {
  1553. var r = this.findDeviceIndexByIP(t),
  1554. s = -1;
  1555. if (-1 != r) {
  1556. var o = P[r];
  1557. I[r];
  1558. var i = {
  1559. async: !1,
  1560. type: "GET",
  1561. success: n.success,
  1562. error: n.error
  1563. };
  1564. this.I_SendHTTPRequest(o.szIP + "_" + o.iCGIPort, e, i)
  1565. }
  1566. return s
  1567. }, this.findDeviceIndexByIP = function(e) {
  1568. if (e.indexOf("_") > -1) {
  1569. for (var t = 0, n = P.length; n > t; t++)
  1570. if (P[t].szDeviceIdentify == e) return t
  1571. } else
  1572. for (var t = 0, n = P.length; n > t; t++)
  1573. if (P[t].szIP == e) return t;
  1574. return -1
  1575. }, this.findWndIndexByIndex = function(e) {
  1576. for (var t = 0, n = I.length; n > t; t++)
  1577. if (I[t].iIndex == e) return t;
  1578. return -1
  1579. };
  1580. var ht = function() {
  1581. this.iIndex = 0, this.szIP = "", this.iCGIPort = 80, this.szDeviceIdentify = "", this.iChannelID = "", this.iPlayStatus = b, this.bSound = !1, this.bRecord = !1, this.bPTZAuto = !1, this.bEZoom = !1, this.b3DZoom = !1
  1582. },
  1583. Pt = function() {
  1584. this.options = {
  1585. type: "GET",
  1586. url: "",
  1587. auth: "",
  1588. timeout: 1e4,
  1589. data: "",
  1590. async: !0,
  1591. success: null,
  1592. error: null
  1593. }, this.m_szHttpHead = "", this.m_szHttpContent = "", this.m_szHttpData = ""
  1594. };
  1595. Pt.prototype.m_httpRequestSet = [], Pt.prototype.setRequestParam = function(e) {
  1596. S.extend(this.options, e)
  1597. }, Pt.prototype.submitRequest = function() {
  1598. var e = null,
  1599. t = this;
  1600. if (ct()) {
  1601. this.options.auth ? S.cookie("WebSession", this.options.auth) : S.cookie("WebSession", null);
  1602. var n = lt(this.options.url),
  1603. r = new window.XMLHttpRequest;
  1604. r.open(this.options.type, n, this.options.async);
  1605. var s = function(e) {
  1606. return /^(http|https):\/\/([^\/]+)(.+)$/.test(e) ? RegExp.$2 : ""
  1607. };
  1608. if (d.proxyAddress) {
  1609. r.withCredentials = !0;
  1610. var o = s(this.options.url);
  1611. r.setRequestHeader("deviceIdentify", o)
  1612. }
  1613. r.setRequestHeader("X-Requested-With", "XMLHttpRequest"), r.setRequestHeader("If-Modified-Since", "0"), r.send(this.options.data || null);
  1614. var i = function() {
  1615. if (4 === r.readyState) {
  1616. e = {
  1617. funSuccessCallback: t.options.success,
  1618. funErrorCallback: t.options.error
  1619. };
  1620. var n = r.status + r.responseText;
  1621. 0 === r.status && (n = ""), t.httpDataAnalyse(e, n)
  1622. }
  1623. };
  1624. this.options.async ? (r.timeout = this.options.timeout, r.onreadystatechange = function() {
  1625. i()
  1626. }) : i()
  1627. } else {
  1628. var a = this.getHttpMethod(this.options.type);
  1629. if (this.options.async) {
  1630. var u = p.HWP_SubmitHttpRequest(a, this.options.url, this.options.auth, this.options.data, this.options.timeout); - 1 != u && (e = {
  1631. iRequestID: u,
  1632. funSuccessCallback: this.options.success,
  1633. funErrorCallback: this.options.error
  1634. }, this.m_httpRequestSet.push(e))
  1635. } else {
  1636. var c = p.HWP_SendHttpSynRequest(a, this.options.url, this.options.auth, this.options.data, this.options.timeout);
  1637. e = {
  1638. funSuccessCallback: this.options.success,
  1639. funErrorCallback: this.options.error
  1640. }, this.httpDataAnalyse(e, c)
  1641. }
  1642. }
  1643. }, Pt.prototype.getHttpMethod = function(e) {
  1644. var t = {
  1645. GET: 1,
  1646. POST: 2,
  1647. PUT: 5,
  1648. DELETE: 6
  1649. },
  1650. n = t[e];
  1651. return n ? n : -1
  1652. }, Pt.prototype.processCallback = function(e, t) {
  1653. for (var n = null, r = 0; r < this.m_httpRequestSet.length; r++)
  1654. if (e == this.m_httpRequestSet[r].iRequestID) {
  1655. n = this.m_httpRequestSet[r], this.m_httpRequestSet.splice(r, 1);
  1656. break
  1657. }
  1658. null != n && (this.httpDataAnalyse(n, t), delete n)
  1659. }, Pt.prototype.httpDataAnalyse = function(e, t) {
  1660. var n = "",
  1661. r = 0;
  1662. "" == t || U(t) ? e.funErrorCallback() : (r = parseInt(t.substring(0, 3)), n = t.substring(3, t.length), isNaN(r) ? e.funErrorCallback() : z == r ? this.options && this.options.url.indexOf("?format=json") > -1 ? e.funSuccessCallback(JSON.parse(n)) : e.funSuccessCallback(S.loadXML(n)) : e.funErrorCallback && e.funErrorCallback(r, S.loadXML(n)))
  1663. };
  1664. var It = function() {};
  1665. It.prototype.CGI = {
  1666. login: "%s%s:%s/ISAPI/Security/userCheck",
  1667. getAudioInfo: "%s%s:%s/ISAPI/System/TwoWayAudio/channels",
  1668. getDeviceInfo: "%s%s:%s/ISAPI/System/deviceInfo",
  1669. getAnalogChannelInfo: "%s%s:%s/ISAPI/System/Video/inputs/channels",
  1670. getDigitalChannel: "%s%s:%s/ISAPI/ContentMgmt/InputProxy/channels",
  1671. getDigitalChannelInfo: "%s%s:%s/ISAPI/ContentMgmt/InputProxy/channels/status",
  1672. getZeroChannelInfo: "%s%s:%s/ISAPI/ContentMgmt/ZeroVideo/channels",
  1673. getStreamChannels: {
  1674. analog: "%s%s:%s/ISAPI/Streaming/channels",
  1675. digital: "%s%s:%s/ISAPI/ContentMgmt/StreamingProxy/channels"
  1676. },
  1677. getStreamDynChannels: "%s%s:%s/PSIA/Custom/SelfExt/ContentMgmt/DynStreaming/channels",
  1678. startRealPlay: {
  1679. channels: "%s%s:%s/PSIA/streaming/channels/%s",
  1680. zeroChannels: "%s%s:%s/PSIA/Custom/SelfExt/ContentMgmt/ZeroStreaming/channels/%s"
  1681. },
  1682. startShttpRealPlay: {
  1683. channels: "%s%s:%s/SDK/play/%s/004",
  1684. zeroChannels: "%s%s:%s/SDK/play/100/004/ZeroStreaming"
  1685. },
  1686. startWsRealPlay: {
  1687. channels: "%s%s:%s/%s",
  1688. zeroChannels: "%s%s:%s/%s"
  1689. },
  1690. startVoiceTalk: {
  1691. open: "%s%s:%s/ISAPI/System/TwoWayAudio/channels/%s/open",
  1692. close: "%s%s:%s/ISAPI/System/TwoWayAudio/channels/%s/close",
  1693. audioData: "%s%s:%s/ISAPI/System/TwoWayAudio/channels/%s/audioData"
  1694. },
  1695. ptzControl: {
  1696. analog: "%s%s:%s/ISAPI/PTZCtrl/channels/%s/continuous",
  1697. digital: "%s%s:%s/ISAPI/ContentMgmt/PTZCtrlProxy/channels/%s/continuous"
  1698. },
  1699. ptzAutoControl: {
  1700. ipdome: "%s%s:%s/ISAPI/PTZCtrl/channels/%s/presets/%s/goto",
  1701. analog: "%s%s:%s/ISAPI/PTZCtrl/channels/%s/autoPan",
  1702. digital: "%s%s:%s/ISAPI/ContentMgmt/PTZCtrlProxy/channels/%s/autoPan"
  1703. },
  1704. setPreset: {
  1705. analog: "%s%s:%s/ISAPI/PTZCtrl/channels/%s/presets/%s",
  1706. digital: "%s%s:%s/ISAPI/ContentMgmt/PTZCtrlProxy/channels/%s/presets/%s"
  1707. },
  1708. goPreset: {
  1709. analog: "%s%s:%s/ISAPI/PTZCtrl/channels/%s/presets/%s/goto",
  1710. digital: "%s%s:%s/ISAPI/ContentMgmt/PTZCtrlProxy/channels/%s/presets/%s/goto"
  1711. },
  1712. ptzFocus: {
  1713. analog: "%s%s:%s/ISAPI/System/Video/inputs/channels/%s/focus",
  1714. digital: "%s%s:%s/ISAPI/ContentMgmt/InputProxy/channels/%s/video/focus",
  1715. ipc: "%s%s:%s/ISAPI/System/Video/inputs/channels/%s/focus"
  1716. },
  1717. ptzIris: {
  1718. analog: "%s%s:%s/ISAPI/System/Video/inputs/channels/%s/iris",
  1719. digital: "%s%s:%s/ISAPI/ContentMgmt/InputProxy/channels/%s/video/iris",
  1720. ipc: "%s%s:%s/ISAPI/System/Video/inputs/channels/%s/iris"
  1721. },
  1722. getNetworkBond: "%s%s:%s/ISAPI/System/Network/Bond",
  1723. getNetworkInterface: "%s%s:%s/ISAPI/System/Network/interfaces",
  1724. getUPnPPortStatus: "%s%s:%s/ISAPI/System/Network/UPnP/ports/status",
  1725. getPPPoEStatus: "%s%s:%s/ISAPI/System/Network/PPPoE/1/status",
  1726. getPortInfo: "%s%s:%s/ISAPI/Security/adminAccesses",
  1727. recordSearch: "%s%s:%s/ISAPI/ContentMgmt/search",
  1728. startPlayback: "%s%s:%s/PSIA/streaming/tracks/%s?starttime=%s&endtime=%s",
  1729. startWsPlayback: "%s%s:%s/%s",
  1730. startShttpPlayback: "%s%s:%s/SDK/playback/%s",
  1731. startShttpReversePlayback: "%s%s:%s/SDK/playback/%s/reversePlay",
  1732. startTransCodePlayback: "%s%s:%s/SDK/playback/%s/transcoding",
  1733. startDownloadRecord: "%s%s:%s/ISAPI/ContentMgmt/download",
  1734. downloaddeviceConfig: "%s%s:%s/ISAPI/System/configurationData",
  1735. uploaddeviceConfig: "%s%s:%s/ISAPI/System/configurationData",
  1736. restart: "%s%s:%s/ISAPI/System/reboot",
  1737. restore: "%s%s:%s/ISAPI/System/factoryReset?mode=%s",
  1738. startUpgrade: {
  1739. upgrade: "%s%s:%s/ISAPI/System/updateFirmware",
  1740. status: "%s%s:%s/ISAPI/System/upgradeStatus"
  1741. },
  1742. set3DZoom: {
  1743. analog: "%s%s:%s/ISAPI/PTZCtrl/channels/%s/position3D",
  1744. digital: "%s%s:%s/ISAPI/ContentMgmt/PTZCtrlProxy/channels/%s/position3D"
  1745. },
  1746. getSecurityVersion: "%s%s:%s/ISAPI/Security/capabilities?username=admin",
  1747. SDKCapabilities: "%s%s:%s/SDK/capabilities",
  1748. deviceCapture: {
  1749. channels: "%s%s:%s/ISAPI/Streaming/channels/%s/picture"
  1750. },
  1751. overlayInfo: {
  1752. analog: "%s%s:%s/ISAPI/System/Video/inputs/channels/%s/overlays/",
  1753. digital: "%s%s:%s/ISAPI/ContentMgmt/InputProxy/channels/%s/video/overlays"
  1754. },
  1755. sessionCap: "%s%s:%s/ISAPI/Security/sessionLogin/capabilities?username=%s",
  1756. sessionLogin: "%s%s:%s/ISAPI/Security/sessionLogin",
  1757. sessionHeartbeat: "%s%s:%s/ISAPI/Security/sessionHeartbeat",
  1758. sessionLogout: "%s%s:%s/ISAPI/Security/sessionLogout",
  1759. systemCapabilities: "%s%s:%s/ISAPI/System/capabilities"
  1760. }, It.prototype.login = function(e, t, n, r) {
  1761. var s = 2 == r.protocol ? "https://" : "http://",
  1762. o = F(this.CGI.login, s, e, t),
  1763. i = new Pt,
  1764. a = {
  1765. type: "GET",
  1766. url: o,
  1767. auth: n,
  1768. success: null,
  1769. error: null
  1770. };
  1771. S.extend(a, r), S.extend(a, {
  1772. success: function(e) {
  1773. r.success && r.success(e)
  1774. },
  1775. error: function(e, t) {
  1776. r.error && r.error(e, t)
  1777. }
  1778. }), i.setRequestParam(a), i.submitRequest()
  1779. }, It.prototype.getAudioInfo = function(e, t) {
  1780. var n = F(this.CGI.getAudioInfo, e.szHttpProtocol, e.szIP, e.iCGIPort),
  1781. r = new Pt,
  1782. s = {
  1783. type: "GET",
  1784. url: n,
  1785. auth: e.szAuth,
  1786. success: null,
  1787. error: null
  1788. };
  1789. S.extend(s, t), S.extend(s, {
  1790. success: function(e) {
  1791. t.success && t.success(e)
  1792. },
  1793. error: function(e, n) {
  1794. t.error && t.error(e, n)
  1795. }
  1796. }), r.setRequestParam(s), r.submitRequest()
  1797. }, It.prototype.getSecurityVersion = function(e, t) {
  1798. var n = F(this.CGI.getSecurityVersion, e.szHttpProtocol, e.szIP, e.iCGIPort),
  1799. r = new Pt,
  1800. s = {
  1801. type: "GET",
  1802. url: n,
  1803. auth: e.szAuth,
  1804. success: null,
  1805. error: null
  1806. };
  1807. S.extend(s, t), S.extend(s, {
  1808. success: function(e) {
  1809. t.success && t.success(e)
  1810. },
  1811. error: function(e, n) {
  1812. t.error && t.error(e, n)
  1813. }
  1814. }), r.setRequestParam(s), r.submitRequest()
  1815. }, It.prototype.getDeviceInfo = function(e, n) {
  1816. var r = F(this.CGI.getDeviceInfo, e.szHttpProtocol, e.szIP, e.iCGIPort),
  1817. s = new Pt,
  1818. o = {
  1819. type: "GET",
  1820. url: r,
  1821. auth: e.szAuth,
  1822. success: null,
  1823. error: null
  1824. };
  1825. S.extend(o, n), S.extend(o, {
  1826. success: function(e) {
  1827. var r = [];
  1828. r.push("<DeviceInfo>"), r.push("<deviceName>" + S.escape(t.$XML(e).find("deviceName").eq(0).text()) + "</deviceName>"), r.push("<deviceID>" + t.$XML(e).find("deviceID").eq(0).text() + "</deviceID>"), r.push("<deviceType>" + t.$XML(e).find("deviceType").eq(0).text() + "</deviceType>"), r.push("<model>" + t.$XML(e).find("model").eq(0).text() + "</model>"), r.push("<serialNumber>" + t.$XML(e).find("serialNumber").eq(0).text() + "</serialNumber>"), r.push("<macAddress>" + t.$XML(e).find("macAddress").eq(0).text() + "</macAddress>"), r.push("<firmwareVersion>" + t.$XML(e).find("firmwareVersion").eq(0).text() + "</firmwareVersion>"), r.push("<firmwareReleasedDate>" + t.$XML(e).find("firmwareReleasedDate").eq(0).text() + "</firmwareReleasedDate>"), r.push("<encoderVersion>" + t.$XML(e).find("encoderVersion").eq(0).text() + "</encoderVersion>"), r.push("<encoderReleasedDate>" + t.$XML(e).find("encoderReleasedDate").eq(0).text() + "</encoderReleasedDate>"), r.push("</DeviceInfo>"), e = S.loadXML(r.join("")), n.success && n.success(e)
  1829. },
  1830. error: function(e, t) {
  1831. n.error && n.error(e, t)
  1832. }
  1833. }), s.setRequestParam(o), s.submitRequest()
  1834. }, It.prototype.getAnalogChannelInfo = function(e, n) {
  1835. var r = F(this.CGI.getAnalogChannelInfo, e.szHttpProtocol, e.szIP, e.iCGIPort),
  1836. s = new Pt,
  1837. o = {
  1838. type: "GET",
  1839. url: r,
  1840. auth: e.szAuth,
  1841. success: null,
  1842. error: null
  1843. };
  1844. S.extend(o, n), S.extend(o, {
  1845. success: function(r) {
  1846. var s = [];
  1847. s.push("<VideoInputChannelList>");
  1848. var o = t.$XML(r).find("VideoInputChannel", !0);
  1849. e.iAnalogChannelNum = o.length;
  1850. for (var i = 0, a = o.length; a > i; i++) {
  1851. var u = o[i];
  1852. s.push("<VideoInputChannel>"), s.push("<id>" + t.$XML(u).find("id").eq(0).text() + "</id>"), s.push("<inputPort>" + t.$XML(u).find("inputPort").eq(0).text() + "</inputPort>"), s.push("<name>" + S.escape(t.$XML(u).find("name").eq(0).text()) + "</name>"), s.push("<videoFormat>" + t.$XML(u).find("videoFormat").eq(0).text() + "</videoFormat>"), s.push("</VideoInputChannel>")
  1853. }
  1854. s.push("</VideoInputChannelList>"), r = S.loadXML(s.join("")), n.success && n.success(r)
  1855. },
  1856. error: function(e, t) {
  1857. n.error && n.error(e, t)
  1858. }
  1859. }), s.setRequestParam(o), s.submitRequest()
  1860. }, It.prototype.getDigitalChannel = function(e, n) {
  1861. var r = F(this.CGI.getDigitalChannel, e.szHttpProtocol, e.szIP, e.iCGIPort),
  1862. s = new Pt,
  1863. o = {
  1864. type: "GET",
  1865. url: r,
  1866. auth: e.szAuth,
  1867. success: null,
  1868. error: null
  1869. };
  1870. S.extend(o, n), S.extend(o, {
  1871. success: function(e) {
  1872. var r = [];
  1873. r.push("<InputProxyChannelList>");
  1874. for (var s = t.$XML(e).find("InputProxyChannel", !0), o = 0, i = s.length; i > o; o++) {
  1875. var a = s[o];
  1876. r.push("<InputProxyChannel>"), r.push("<id>" + t.$XML(a).find("id").eq(0).text() + "</id>"), r.push("<name>" + S.escape(t.$XML(a).find("name").eq(0).text()) + "</name>"), r.push("</InputProxyChannel>")
  1877. }
  1878. r.push("</InputProxyChannelList>"), e = S.loadXML(r.join("")), n.success && n.success(e)
  1879. },
  1880. error: function(e, t) {
  1881. n.error && n.error(e, t)
  1882. }
  1883. }), s.setRequestParam(o), s.submitRequest()
  1884. }, It.prototype.getDigitalChannelInfo = function(e, n) {
  1885. var r = null,
  1886. s = {};
  1887. if (this.getDigitalChannel(e, {
  1888. async: !1,
  1889. success: function(e) {
  1890. r = e;
  1891. for (var n = t.$XML(r).find("InputProxyChannel", !0), o = 0, i = n.length; i > o; o++) {
  1892. var a = n[o],
  1893. u = t.$XML(a).find("id").eq(0).text(),
  1894. c = t.$XML(a).find("name").eq(0).text();
  1895. s[u] = c
  1896. }
  1897. },
  1898. error: function(e, t) {
  1899. n.error && n.error(e, t)
  1900. }
  1901. }), null !== r) {
  1902. var o = F(this.CGI.getDigitalChannelInfo, e.szHttpProtocol, e.szIP, e.iCGIPort),
  1903. i = new Pt,
  1904. a = {
  1905. type: "GET",
  1906. url: o,
  1907. auth: e.szAuth,
  1908. success: null,
  1909. error: null
  1910. };
  1911. S.extend(a, n), S.extend(a, {
  1912. success: function(e) {
  1913. var r = [];
  1914. r.push("<InputProxyChannelStatusList>");
  1915. for (var o = t.$XML(e).find("InputProxyChannelStatus", !0), i = 0, a = o.length; a > i; i++) {
  1916. var u = o[i],
  1917. c = t.$XML(u).find("id").eq(0).text();
  1918. r.push("<InputProxyChannelStatus>"), r.push("<id>" + c + "</id>"), r.push("<sourceInputPortDescriptor>"), r.push("<proxyProtocol>" + t.$XML(u).find("proxyProtocol").eq(0).text() + "</proxyProtocol>"), r.push("<addressingFormatType>" + t.$XML(u).find("addressingFormatType").eq(0).text() + "</addressingFormatType>"), r.push("<ipAddress>" + t.$XML(u).find("ipAddress").eq(0).text() + "</ipAddress>"), r.push("<managePortNo>" + t.$XML(u).find("managePortNo").eq(0).text() + "</managePortNo>"), r.push("<srcInputPort>" + t.$XML(u).find("srcInputPort").eq(0).text() + "</srcInputPort>"), r.push("<userName>" + S.escape(t.$XML(u).find("userName").eq(0).text()) + "</userName>"), r.push("<streamType>" + t.$XML(u).find("streamType").eq(0).text() + "</streamType>"), r.push("<online>" + t.$XML(u).find("online").eq(0).text() + "</online>"), r.push("<name>" + S.escape(s[c]) + "</name>"), r.push("</sourceInputPortDescriptor>"), r.push("</InputProxyChannelStatus>")
  1919. }
  1920. r.push("</InputProxyChannelStatusList>"), e = S.loadXML(r.join("")), n.success && n.success(e)
  1921. },
  1922. error: function(e, t) {
  1923. n.error && n.error(e, t)
  1924. }
  1925. }), i.setRequestParam(a), i.submitRequest()
  1926. }
  1927. }, It.prototype.getZeroChannelInfo = function(e, t) {
  1928. var n = F(this.CGI.getZeroChannelInfo, e.szHttpProtocol, e.szIP, e.iCGIPort),
  1929. r = new Pt,
  1930. s = {
  1931. type: "GET",
  1932. url: n,
  1933. auth: e.szAuth,
  1934. success: null,
  1935. error: null
  1936. };
  1937. S.extend(s, t), S.extend(s, {
  1938. success: function(e) {
  1939. t.success && t.success(e)
  1940. },
  1941. error: function(e, n) {
  1942. t.error && t.error(e, n)
  1943. }
  1944. }), r.setRequestParam(s), r.submitRequest()
  1945. }, It.prototype.getStreamChannels = function(e, t) {
  1946. if (0 != e.iAnalogChannelNum) var n = F(this.CGI.getStreamChannels.analog, e.szHttpProtocol, e.szIP, e.iCGIPort);
  1947. else var n = F(this.CGI.getStreamChannels.digital, e.szHttpProtocol, e.szIP, e.iCGIPort);
  1948. var r = new Pt,
  1949. s = {
  1950. type: "GET",
  1951. url: n,
  1952. auth: e.szAuth,
  1953. success: null,
  1954. error: null
  1955. };
  1956. S.extend(s, t), S.extend(s, {
  1957. success: function(e) {
  1958. t.success && t.success(e)
  1959. },
  1960. error: function(e, n) {
  1961. t.error && t.error(e, n)
  1962. }
  1963. }), r.setRequestParam(s), r.submitRequest()
  1964. }, It.prototype.getPPPoEStatus = function(e, t) {
  1965. var n = F(this.CGI.getPPPoEStatus, e.szHttpProtocol, e.szIP, e.iCGIPort),
  1966. r = new Pt,
  1967. s = {
  1968. type: "GET",
  1969. url: n,
  1970. auth: e.szAuth,
  1971. success: null,
  1972. error: null
  1973. };
  1974. S.extend(s, t), S.extend(s, {
  1975. success: function(e) {
  1976. t.success && t.success(e)
  1977. },
  1978. error: function(e, n) {
  1979. t.error && t.error(e, n)
  1980. }
  1981. }), r.setRequestParam(s), r.submitRequest()
  1982. }, It.prototype.getUPnPPortStatus = function(e, t) {
  1983. var n = F(this.CGI.getUPnPPortStatus, e.szHttpProtocol, e.szIP, e.iCGIPort),
  1984. r = new Pt,
  1985. s = {
  1986. type: "GET",
  1987. url: n,
  1988. auth: e.szAuth,
  1989. success: null,
  1990. error: null
  1991. };
  1992. S.extend(s, t), S.extend(s, {
  1993. success: function(e) {
  1994. t.success && t.success(e)
  1995. },
  1996. error: function(e, n) {
  1997. t.error && t.error(e, n)
  1998. }
  1999. }), r.setRequestParam(s), r.submitRequest()
  2000. }, It.prototype.getNetworkBond = function(e, t) {
  2001. var n = F(this.CGI.getNetworkBond, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2002. r = new Pt,
  2003. s = {
  2004. type: "GET",
  2005. url: n,
  2006. auth: e.szAuth,
  2007. success: null,
  2008. error: null
  2009. };
  2010. S.extend(s, t), S.extend(s, {
  2011. success: function(e) {
  2012. t.success && t.success(e)
  2013. },
  2014. error: function(e, n) {
  2015. t.error && t.error(e, n)
  2016. }
  2017. }), r.setRequestParam(s), r.submitRequest()
  2018. }, It.prototype.getNetworkInterface = function(e, t) {
  2019. var n = F(this.CGI.getNetworkInterface, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2020. r = new Pt,
  2021. s = {
  2022. type: "GET",
  2023. url: n,
  2024. auth: e.szAuth,
  2025. success: null,
  2026. error: null
  2027. };
  2028. S.extend(s, t), S.extend(s, {
  2029. success: function(e) {
  2030. t.success && t.success(e)
  2031. },
  2032. error: function(e, n) {
  2033. t.error && t.error(e, n)
  2034. }
  2035. }), r.setRequestParam(s), r.submitRequest()
  2036. }, It.prototype.getPortInfo = function(e, t) {
  2037. var n = F(this.CGI.getPortInfo, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2038. r = new Pt,
  2039. s = {
  2040. type: "GET",
  2041. url: n,
  2042. auth: e.szAuth,
  2043. success: null,
  2044. error: null
  2045. };
  2046. S.extend(s, t), S.extend(s, {
  2047. success: function(e) {
  2048. t.success && t.success(e)
  2049. },
  2050. error: function(e, n) {
  2051. t.error && t.error(e, n)
  2052. }
  2053. }), r.setRequestParam(s), r.submitRequest()
  2054. }, It.prototype.startRealPlay = function(e, t) {
  2055. var n = 100 * t.iChannelID + t.iStreamType,
  2056. r = "",
  2057. s = -1,
  2058. o = e.szIP;
  2059. if ("rtsp://" === t.urlProtocol && (o = V(o)), t.bZeroChannel ? (ct() && (n = 0), r = F(t.cgi.zeroChannels, t.urlProtocol, o, t.iPort, n)) : r = F(t.cgi.channels, t.urlProtocol, o, t.iPort, n), d.proxyAddress && ct()) {
  2060. S.cookie("webVideoCtrlProxy", o + ":" + t.iPort, {
  2061. raw: !0
  2062. }), r = F(t.cgi.zeroChannels, t.urlProtocol, d.proxyAddress.ip, d.proxyAddress.port, n);
  2063. var i = o + ":" + t.iPort;
  2064. r += r.indexOf("?") > -1 ? "&deviceIdentify=" + i : "?deviceIdentify=" + i
  2065. }
  2066. var a = function() {
  2067. var n = new ht;
  2068. n.iIndex = t.iWndIndex, n.szIP = e.szIP, n.iCGIPort = e.iCGIPort, n.szDeviceIdentify = e.szDeviceIdentify, n.iChannelID = t.iChannelID, n.iPlayStatus = T, I.push(n)
  2069. },
  2070. u = $.Deferred();
  2071. if (ct()) {
  2072. var c = {
  2073. sessionID: e.szAuth,
  2074. token: O(e, e.szDeviceIdentify)
  2075. };
  2076. r = dt(r), p.JS_Play(r, c, t.iWndIndex).then(function() {
  2077. a(), u.resolve()
  2078. }, function() {
  2079. u.reject()
  2080. })
  2081. } else s = p.HWP_Play(r, e.szAuth, t.iWndIndex, "", ""), 0 == s ? (a(), u.resolve()) : u.reject();
  2082. return u
  2083. }, It.prototype.startVoiceTalk = function(e, t) {
  2084. var n = F(this.CGI.startVoiceTalk.open, e.szHttpProtocol, e.szIP, e.iCGIPort, t),
  2085. r = F(this.CGI.startVoiceTalk.close, e.szHttpProtocol, e.szIP, e.iCGIPort, t),
  2086. s = F(this.CGI.startVoiceTalk.audioData, e.szHttpProtocol, e.szIP, e.iCGIPort, t),
  2087. o = p.HWP_StartVoiceTalkEx(n, r, s, e.szAuth, e.iAudioType, e.m_iAudioBitRate, e.m_iAudioSamplingRate);
  2088. return o
  2089. }, It.prototype.ptzAutoControl = function(e, t, n, r) {
  2090. var s = n.iChannelID,
  2091. o = "",
  2092. i = "";
  2093. if (r.iPTZSpeed = r.iPTZSpeed < 7 ? 15 * r.iPTZSpeed : 100, t && (r.iPTZSpeed = 0), e.szDeviceType != E) o = s <= e.iAnalogChannelNum ? F(this.CGI.ptzAutoControl.analog, e.szHttpProtocol, e.szIP, e.iCGIPort, n.iChannelID) : n.bShttpIPChannel ? F(this.CGI.ptzAutoControl.digital, e.szHttpProtocol, e.szIP, e.iCGIPort, n.iChannelID - e.oStreamCapa.iIpChanBase + 1 + e.iAnalogChannelNum) : F(this.CGI.ptzAutoControl.digital, e.szHttpProtocol, e.szIP, e.iCGIPort, n.iChannelID), i = "<?xml version='1.0' encoding='UTF-8'?><autoPanData><autoPan>" + r.iPTZSpeed + "</autoPan>" + "</autoPanData>";
  2094. else {
  2095. 0 === r.iPTZSpeed && (t = !0);
  2096. var a = 99;
  2097. t && (a = 96), o = F(this.CGI.ptzAutoControl.ipdome, e.szHttpProtocol, e.szIP, e.iCGIPort, n.iChannelID, a)
  2098. }
  2099. var u = new Pt,
  2100. c = {
  2101. type: "PUT",
  2102. url: o,
  2103. async: !1,
  2104. auth: e.szAuth,
  2105. data: i,
  2106. success: null,
  2107. error: null
  2108. },
  2109. l = this;
  2110. S.extend(c, r), S.extend(c, {
  2111. success: function(e) {
  2112. n.bPTZAuto = !n.bPTZAuto, r.success && r.success(e)
  2113. },
  2114. error: function(t, s) {
  2115. if (k == e.szDeviceType || Z == e.szDeviceType) {
  2116. o = n.bShttpIPChannel ? F(l.CGI.ptzControl.analog, e.szHttpProtocol, e.szIP, e.iCGIPort, n.iChannelID - e.oStreamCapa.iIpChanBase + 1 + e.iAnalogChannelNum) : F(l.CGI.ptzControl.analog, e.szHttpProtocol, e.szIP, e.iCGIPort, n.iChannelID), i = "<?xml version='1.0' encoding='UTF-8'?><PTZData><pan>" + r.iPTZSpeed + "</pan>" + "<tilt>" + 0 + "</tilt>" + "</PTZData>";
  2117. var a = new Pt,
  2118. u = {
  2119. type: "PUT",
  2120. url: o,
  2121. async: !1,
  2122. auth: e.szAuth,
  2123. data: i,
  2124. success: null,
  2125. error: null
  2126. };
  2127. S.extend(u, r), a.setRequestParam(u), a.submitRequest()
  2128. } else r.error && r.error(t, s)
  2129. }
  2130. }), u.setRequestParam(c), u.submitRequest()
  2131. }, It.prototype.ptzControl = function(e, t, n, r) {
  2132. var s = n.iChannelID,
  2133. o = "";
  2134. n.bPTZAuto && this.ptzAutoControl(e, !0, n, {
  2135. iPTZSpeed: 0
  2136. }), r.iPTZSpeed = t ? 0 : r.iPTZSpeed < 7 ? 15 * r.iPTZSpeed : 100;
  2137. var i = [{}, {
  2138. pan: 0,
  2139. tilt: r.iPTZSpeed
  2140. }, {
  2141. pan: 0,
  2142. tilt: -r.iPTZSpeed
  2143. }, {
  2144. pan: -r.iPTZSpeed,
  2145. tilt: 0
  2146. }, {
  2147. pan: r.iPTZSpeed,
  2148. tilt: 0
  2149. }, {
  2150. pan: -r.iPTZSpeed,
  2151. tilt: r.iPTZSpeed
  2152. }, {
  2153. pan: -r.iPTZSpeed,
  2154. tilt: -r.iPTZSpeed
  2155. }, {
  2156. pan: r.iPTZSpeed,
  2157. tilt: r.iPTZSpeed
  2158. }, {
  2159. pan: r.iPTZSpeed,
  2160. tilt: -r.iPTZSpeed
  2161. }, {}, {
  2162. speed: r.iPTZSpeed
  2163. }, {
  2164. speed: -r.iPTZSpeed
  2165. }, {
  2166. speed: r.iPTZSpeed
  2167. }, {
  2168. speed: -r.iPTZSpeed
  2169. }, {
  2170. speed: r.iPTZSpeed
  2171. }, {
  2172. speed: -r.iPTZSpeed
  2173. }],
  2174. a = "",
  2175. u = {};
  2176. switch (r.iPTZIndex) {
  2177. case 1:
  2178. case 2:
  2179. case 3:
  2180. case 4:
  2181. case 5:
  2182. case 6:
  2183. case 7:
  2184. case 8:
  2185. u = this.CGI.ptzControl, a = "<?xml version='1.0' encoding='UTF-8'?><PTZData><pan>" + i[r.iPTZIndex].pan + "</pan>" + "<tilt>" + i[r.iPTZIndex].tilt + "</tilt>" + "</PTZData>";
  2186. break;
  2187. case 10:
  2188. case 11:
  2189. u = this.CGI.ptzControl, a = "<?xml version='1.0' encoding='UTF-8'?><PTZData><zoom>" + i[r.iPTZIndex].speed + "</zoom>" + "</PTZData>";
  2190. break;
  2191. case 12:
  2192. case 13:
  2193. u = this.CGI.ptzFocus, a = "<?xml version='1.0' encoding='UTF-8'?><FocusData><focus>" + i[r.iPTZIndex].speed + "</focus>" + "</FocusData>";
  2194. break;
  2195. case 14:
  2196. case 15:
  2197. u = this.CGI.ptzIris, a = "<?xml version='1.0' encoding='UTF-8'?><IrisData><iris>" + i[r.iPTZIndex].speed + "</iris>" + "</IrisData>";
  2198. break;
  2199. default:
  2200. return r.error && r.error(), void 0
  2201. }
  2202. o = u != this.CGI.ptzFocus && u != this.CGI.ptzIris || e.szDeviceType != k && e.szDeviceType != E && e.szDeviceType != Z ? s <= e.iAnalogChannelNum ? F(u.analog, e.szHttpProtocol, e.szIP, e.iCGIPort, n.iChannelID) : n.bShttpIPChannel ? F(u.digital, e.szHttpProtocol, e.szIP, e.iCGIPort, n.iChannelID - e.oStreamCapa.iIpChanBase + 1 + e.iAnalogChannelNum) : F(u.digital, e.szHttpProtocol, e.szIP, e.iCGIPort, n.iChannelID) : F(u.ipc, e.szHttpProtocol, e.szIP, e.iCGIPort, n.iChannelID);
  2203. var c = new Pt,
  2204. l = {
  2205. type: "PUT",
  2206. url: o,
  2207. async: !1,
  2208. auth: e.szAuth,
  2209. data: a,
  2210. success: null,
  2211. error: null
  2212. };
  2213. S.extend(l, r), S.extend(l, {
  2214. success: function(e) {
  2215. r.success && r.success(e)
  2216. },
  2217. error: function(e, t) {
  2218. r.error && r.error(e, t)
  2219. }
  2220. }), c.setRequestParam(l), c.submitRequest()
  2221. }, It.prototype.setPreset = function(e, t, n) {
  2222. var r = t.iChannelID,
  2223. s = "",
  2224. o = "";
  2225. s = r <= e.iAnalogChannelNum ? F(this.CGI.setPreset.analog, e.szHttpProtocol, e.szIP, e.iCGIPort, t.iChannelID, n.iPresetID) : t.bShttpIPChannel ? F(this.CGI.setPreset.digital, e.szHttpProtocol, e.szIP, e.iCGIPort, t.iChannelID - e.oStreamCapa.iIpChanBase + 1 + e.iAnalogChannelNum, n.iPresetID) : F(this.CGI.setPreset.digital, e.szHttpProtocol, e.szIP, e.iCGIPort, t.iChannelID, n.iPresetID), o = "<?xml version='1.0' encoding='UTF-8'?>", o += "<PTZPreset>", o += "<id>" + n.iPresetID + "</id>", e.szDeviceType != E && (o += "<presetName>Preset" + n.iPresetID + "</presetName>"), o += "</PTZPreset>";
  2226. var i = new Pt,
  2227. a = {
  2228. type: "PUT",
  2229. url: s,
  2230. auth: e.szAuth,
  2231. data: o,
  2232. success: null,
  2233. error: null
  2234. };
  2235. S.extend(a, n), S.extend(a, {
  2236. success: function(e) {
  2237. n.success && n.success(e)
  2238. },
  2239. error: function(e, t) {
  2240. n.error && n.error(e, t)
  2241. }
  2242. }), i.setRequestParam(a), i.submitRequest()
  2243. }, It.prototype.goPreset = function(e, t, n) {
  2244. var r = t.iChannelID,
  2245. s = "";
  2246. s = r <= e.iAnalogChannelNum ? F(this.CGI.goPreset.analog, e.szHttpProtocol, e.szIP, e.iCGIPort, t.iChannelID, n.iPresetID) : t.bShttpIPChannel ? F(this.CGI.goPreset.digital, e.szHttpProtocol, e.szIP, e.iCGIPort, t.iChannelID - e.oStreamCapa.iIpChanBase + 1 + e.iAnalogChannelNum, n.iPresetID) : F(this.CGI.goPreset.digital, e.szHttpProtocol, e.szIP, e.iCGIPort, t.iChannelID, n.iPresetID);
  2247. var o = new Pt,
  2248. i = {
  2249. type: "PUT",
  2250. url: s,
  2251. auth: e.szAuth,
  2252. success: null,
  2253. error: null
  2254. };
  2255. S.extend(i, n), S.extend(i, {
  2256. success: function(e) {
  2257. n.success && n.success(e)
  2258. },
  2259. error: function(e, t) {
  2260. n.error && n.error(e, t)
  2261. }
  2262. }), o.setRequestParam(i), o.submitRequest()
  2263. }, It.prototype.overlayInfo = function() {
  2264. return szUrl = this.CGI.overlayInfo.analog
  2265. }, It.prototype.recordSearch = function(e, n) {
  2266. var r = "",
  2267. s = "",
  2268. i = n.iChannelID,
  2269. a = n.iStreamType,
  2270. u = n.szStartTime.replace(" ", "T") + "Z",
  2271. c = n.szEndTime.replace(" ", "T") + "Z";
  2272. r = F(this.CGI.recordSearch, e.szHttpProtocol, e.szIP, e.iCGIPort), s = "<?xml version='1.0' encoding='UTF-8'?><CMSearchDescription><searchID>" + new o + "</searchID>" + "<trackList><trackID>" + (100 * i + a) + "</trackID></trackList>" + "<timeSpanList>" + "<timeSpan>" + "<startTime>" + u + "</startTime>" + "<endTime>" + c + "</endTime>" + "</timeSpan>" + "</timeSpanList>" + "<maxResults>40</maxResults>" + "<searchResultPostion>" + n.iSearchPos + "</searchResultPostion>" + "<metadataList>" + "<metadataDescriptor>//metadata.ISAPI.org/VideoMotion</metadataDescriptor>" + "</metadataList>" + "</CMSearchDescription>";
  2273. var l = new Pt,
  2274. d = {
  2275. type: "POST",
  2276. url: r,
  2277. auth: e.szAuth,
  2278. data: s,
  2279. success: null,
  2280. error: null
  2281. };
  2282. S.extend(d, n), S.extend(d, {
  2283. success: function(e) {
  2284. var r = [];
  2285. r.push("<CMSearchResult>"), r.push("<responseStatus>" + t.$XML(e).find("responseStatus").eq(0).text() + "</responseStatus>"), r.push("<responseStatusStrg>" + t.$XML(e).find("responseStatusStrg").eq(0).text() + "</responseStatusStrg>"), r.push("<numOfMatches>" + t.$XML(e).find("numOfMatches").eq(0).text() + "</numOfMatches>"), r.push("<matchList>");
  2286. for (var s = t.$XML(e).find("searchMatchItem", !0), o = 0, i = s.length; i > o; o++) {
  2287. var a = s[o];
  2288. r.push("<searchMatchItem>"), r.push("<trackID>" + t.$XML(a).find("trackID").eq(0).text() + "</trackID>"), r.push("<startTime>" + t.$XML(a).find("startTime").eq(0).text() + "</startTime>"), r.push("<endTime>" + t.$XML(a).find("endTime").eq(0).text() + "</endTime>"), r.push("<playbackURI>" + S.escape(t.$XML(a).find("playbackURI").eq(0).text()) + "</playbackURI>"), r.push("<metadataDescriptor>" + t.$XML(a).find("metadataDescriptor").eq(0).text().split("/")[1] + "</metadataDescriptor>"), r.push("</searchMatchItem>")
  2289. }
  2290. r.push("</matchList>"), r.push("</CMSearchResult>"), e = S.loadXML(r.join("")), n.success && n.success(e)
  2291. },
  2292. error: function(e, t) {
  2293. n.error && n.error(e, t)
  2294. }
  2295. }), l.setRequestParam(d), l.submitRequest()
  2296. }, It.prototype.startPlayback = function(e, t) {
  2297. var n = t.iWndIndex,
  2298. r = "",
  2299. s = t.szStartTime,
  2300. o = t.szEndTime,
  2301. i = e.szIP;
  2302. if ("rtsp://" === t.urlProtocol && (i = V(i)), ct())
  2303. if (d.proxyAddress) {
  2304. S.cookie("webVideoCtrlProxy", i + ":" + t.iPort, {
  2305. raw: !0
  2306. }), r = F(t.cgi, t.urlProtocol, d.proxyAddress.ip, d.proxyAddress.port, t.iChannelID);
  2307. var a = i + ":" + t.iPort;
  2308. r += r.indexOf("?") > -1 ? "&deviceIdentify=" + a : "?deviceIdentify=" + a
  2309. } else r = F(t.cgi, t.urlProtocol, i, t.iPort, t.iChannelID, s, o);
  2310. else r = F(t.cgi, t.urlProtocol, i, t.iPort, t.iChannelID, s, o);
  2311. if (!U(t.oTransCodeParam)) {
  2312. var u = ut(t.oTransCodeParam);
  2313. if ("" == u) return -1;
  2314. p.HWP_SetTrsPlayBackParam(n, u)
  2315. }
  2316. var c = function() {
  2317. var r = new ht;
  2318. r.iIndex = n, r.szIP = e.szIP, r.iCGIPort = e.iCGIPort, r.szDeviceIdentify = e.szDeviceIdentify, r.iChannelID = t.iChannelID, r.iPlayStatus = A, I.push(r)
  2319. },
  2320. l = $.Deferred();
  2321. if (ct()) {
  2322. var f = {
  2323. sessionID: e.szAuth,
  2324. token: O(e, e.szDeviceIdentify)
  2325. };
  2326. p.JS_Play(r, f, n, s, o).then(function() {
  2327. c(), l.resolve()
  2328. }, function() {
  2329. l.reject()
  2330. })
  2331. } else {
  2332. var h = p.HWP_Play(r, e.szAuth, n, s, o);
  2333. 0 == h ? (c(), l.resolve()) : l.reject()
  2334. }
  2335. return l
  2336. }, It.prototype.reversePlayback = function(e, t) {
  2337. var n = t.iWndIndex,
  2338. r = t.szStartTime,
  2339. s = t.szEndTime,
  2340. o = e.szIP;
  2341. "rtsp://" === t.urlProtocol && (o = V(o));
  2342. var i = F(t.cgi, t.urlProtocol, o, t.iPort, t.iChannelID, r, s),
  2343. a = p.HWP_ReversePlay(i, e.szAuth, n, r, s);
  2344. if (0 == a) {
  2345. var u = new ht;
  2346. u.iIndex = n, u.szIP = e.szIP, u.iCGIPort = e.iCGIPort, u.szDeviceIdentify = e.szDeviceIdentify, u.iChannelID = t.iChannelID, u.iPlayStatus = q, I.push(u)
  2347. }
  2348. return a
  2349. }, It.prototype.startDownloadRecord = function(e, t) {
  2350. var n = -1,
  2351. r = F(this.CGI.startDownloadRecord, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2352. s = "<?xml version='1.0' encoding='UTF-8'?><downloadRequest><playbackURI> " + S.escape(t.szPlaybackURI) + "</playbackURI>" + "</downloadRequest>";
  2353. return ct() ? (r = lt(r), n = p.JS_StartDownload(r, e.szAuth, t.szFileName, s)) : n = p.HWP_StartDownload(r, e.szAuth, t.szFileName, s, t.bDateDir), n
  2354. }, It.prototype.exportDeviceConfig = function(e, t) {
  2355. var n = F(this.CGI.downloaddeviceConfig, e.szHttpProtocol, e.szIP, e.iCGIPort);
  2356. if (ct()) {
  2357. var r = {
  2358. type: "PUT",
  2359. url: n,
  2360. auth: e.szAuth,
  2361. success: function() {},
  2362. error: function() {}
  2363. },
  2364. s = new Pt;
  2365. return s.setRequestParam(r), s.submitRequest(), n = lt(n), t && (n = S.exportPasswordDeviceConfig(n, t)), p.JS_ExportDeviceConfig(n)
  2366. }
  2367. return t && (n = S.exportPasswordDeviceConfig(n, t)), p.HWP_ExportDeviceConfig(n, e.szAuth, "", 0)
  2368. }, It.prototype.importDeviceConfig = function(e, t, n) {
  2369. var r = F(this.CGI.uploaddeviceConfig, e.szHttpProtocol, e.szIP, e.iCGIPort);
  2370. if (ct()) {
  2371. var s = {
  2372. type: "PUT",
  2373. url: r,
  2374. auth: e.szAuth,
  2375. success: function() {},
  2376. error: function() {}
  2377. },
  2378. o = new Pt;
  2379. return o.setRequestParam(s), o.submitRequest(), r = lt(r), n && (r = S.exportPasswordDeviceConfig(r, n)), p.JS_UploadFile(r)
  2380. }
  2381. return n && (r = S.exportPasswordDeviceConfig(r, n)), p.HWP_ImportDeviceConfig(r, e.szAuth, t.szFileName, 0)
  2382. }, It.prototype.restart = function(e, t) {
  2383. var n = F(this.CGI.restart, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2384. r = new Pt,
  2385. s = {
  2386. type: "PUT",
  2387. url: n,
  2388. auth: e.szAuth,
  2389. success: null,
  2390. error: null
  2391. };
  2392. S.extend(s, t), S.extend(s, {
  2393. success: function(e) {
  2394. t.success && t.success(e)
  2395. },
  2396. error: function(e, n) {
  2397. t.error && t.error(e, n)
  2398. }
  2399. }), r.setRequestParam(s), r.submitRequest()
  2400. }, It.prototype.restore = function(e, t, n) {
  2401. var r = F(this.CGI.restore, e.szHttpProtocol, e.szIP, e.iCGIPort, t),
  2402. s = new Pt,
  2403. o = {
  2404. type: "PUT",
  2405. url: r,
  2406. auth: e.szAuth,
  2407. success: null,
  2408. error: null
  2409. };
  2410. S.extend(o, n), S.extend(o, {
  2411. success: function(e) {
  2412. n.success && n.success(e)
  2413. },
  2414. error: function(e, t) {
  2415. n.error && n.error(e, t)
  2416. }
  2417. }), s.setRequestParam(o), s.submitRequest()
  2418. }, It.prototype.startUpgrade = function(e, t) {
  2419. $.Deferred();
  2420. var n = F(this.CGI.startUpgrade.upgrade, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2421. r = F(this.CGI.startUpgrade.status, e.szHttpProtocol, e.szIP, e.iCGIPort);
  2422. return szRet = p.HWP_StartUpgrade(n, r, e.szAuth, t.szFileName)
  2423. }, It.prototype.asyncstartUpgrade = function(e, t) {
  2424. var n = $.Deferred(),
  2425. r = F(this.CGI.startUpgrade.upgrade, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2426. s = F(this.CGI.startUpgrade.status, e.szHttpProtocol, e.szIP, e.iCGIPort);
  2427. if (ct()) r = lt(r), s = lt(s), p.JS_StartUpgradeEx(r, s).then(function(e) {
  2428. n.resolve(e)
  2429. }, function() {
  2430. n.reject(o)
  2431. });
  2432. else {
  2433. var o = p.HWP_StartUpgrade(r, s, e.szAuth, t.szFileName);
  2434. 0 === o ? n.resolve(o) : n.reject(o)
  2435. }
  2436. return n
  2437. }, It.prototype.set3DZoom = function(e, n, r, s) {
  2438. var o = n.iChannelID,
  2439. i = "";
  2440. if (i = o <= e.iAnalogChannelNum ? F(this.CGI.set3DZoom.analog, e.szHttpProtocol, e.szIP, e.iCGIPort, n.iChannelID) : n.bShttpIPChannel ? F(this.CGI.set3DZoom.digital, e.szHttpProtocol, e.szIP, e.iCGIPort, n.iChannelID - e.oStreamCapa.iIpChanBase + 1 + e.iAnalogChannelNum) : F(this.CGI.set3DZoom.digital, e.szHttpProtocol, e.szIP, e.iCGIPort, n.iChannelID), ct()) var c = S.loadXML(r),
  2441. l = parseInt(255 * (r.startPos[0] / a), 10),
  2442. d = parseInt(255 * (r.startPos[1] / u), 10),
  2443. p = parseInt(255 * (r.endPos[0] / a), 10),
  2444. f = parseInt(255 * (r.endPos[1] / u), 10);
  2445. else var c = S.loadXML(r),
  2446. l = parseInt(t.$XML(c).find("StartPoint").eq(0).find("positionX").eq(0).text(), 10),
  2447. d = parseInt(t.$XML(c).find("StartPoint").eq(0).find("positionY").eq(0).text(), 10),
  2448. p = parseInt(t.$XML(c).find("EndPoint").eq(0).find("positionX").eq(0).text(), 10),
  2449. f = parseInt(t.$XML(c).find("EndPoint").eq(0).find("positionY").eq(0).text(), 10);
  2450. var h = "<?xml version='1.0' encoding='UTF-8'?><Position3D><StartPoint><positionX>" + l + "</positionX>" + "<positionY>" + (255 - d) + "</positionY>" + "</StartPoint>" + "<EndPoint>" + "<positionX>" + p + "</positionX>" + "<positionY>" + (255 - f) + "</positionY>" + "</EndPoint>" + "</Position3D>",
  2451. P = new Pt,
  2452. I = {
  2453. type: "PUT",
  2454. url: i,
  2455. data: h,
  2456. auth: e.szAuth,
  2457. success: null,
  2458. error: null
  2459. };
  2460. S.extend(I, s), S.extend(I, {
  2461. success: function(e) {
  2462. s.success && s.success(e)
  2463. },
  2464. error: function(e, t) {
  2465. s.error && s.error(e, t)
  2466. }
  2467. }), P.setRequestParam(I), P.submitRequest()
  2468. }, It.prototype.getSDKCapa = function(e, t) {
  2469. var n = F(this.CGI.SDKCapabilities, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2470. r = new Pt,
  2471. s = {
  2472. type: "GET",
  2473. url: n,
  2474. async: !1,
  2475. auth: e.szAuth,
  2476. success: null,
  2477. error: null
  2478. };
  2479. S.extend(s, t), S.extend(s, {
  2480. success: function(e) {
  2481. t.success && t.success(e)
  2482. },
  2483. error: function(e, n) {
  2484. t.error && t.error(e, n)
  2485. }
  2486. }), r.setRequestParam(s), r.submitRequest()
  2487. }, It.prototype.deviceCapturePic = function(e, t, n, r) {
  2488. var t = 100 * t + 1,
  2489. s = -1,
  2490. o = F(this.CGI.deviceCapture.channels, e.szHttpProtocol, e.szIP, e.iCGIPort, t),
  2491. i = [];
  2492. if (S.isInt(r.iResolutionWidth) && i.push("videoResolutionWidth=" + r.iResolutionWidth), S.isInt(r.iResolutionHeight) && i.push("videoResolutionHeight=" + r.iResolutionHeight), i.length > 0 && (o += "?" + i.join("&")), ct()) {
  2493. var a = function(e, t) {
  2494. var n = ".jpg";
  2495. return $("body").append('<a id="jsplugin_download_a" href="' + e + '" download=' + t + n + '><li id="jsplugin_download_li"></li></a>'), $("#jsplugin_download_li").trigger("click"), $("#jsplugin_download_a").remove(), 0
  2496. };
  2497. o = lt(o), s = a(o, n)
  2498. } else s = p.HWP_DeviceCapturePic(o, e.szAuth, n, r.bDateDir);
  2499. return s
  2500. }, It.prototype.getSessionV2Cap = function(e, t, n, r, s, o) {
  2501. var i = "";
  2502. i = 2 == n ? "https://" : "http://";
  2503. var a = F(this.CGI.sessionCap, i, t, r, encodeURIComponent(s));
  2504. a = a + "&random:" + e;
  2505. var u = new Pt,
  2506. c = {
  2507. type: "GET",
  2508. url: a,
  2509. auth: "",
  2510. success: null,
  2511. error: null
  2512. };
  2513. S.extend(c, o), S.extend(c, {
  2514. success: function(e) {
  2515. o.success && o.success(e)
  2516. },
  2517. error: function(e, t) {
  2518. o.error && o.error(e, t)
  2519. }
  2520. }), u.setRequestParam(c), u.submitRequest()
  2521. }, It.prototype.getSessionCap = function(e, t, n, r, s) {
  2522. var o = "";
  2523. o = 2 == t ? "https://" : "http://";
  2524. var i = F(this.CGI.sessionCap, o, e, n, encodeURIComponent(r)),
  2525. a = new Pt,
  2526. u = {
  2527. type: "GET",
  2528. url: i,
  2529. auth: "",
  2530. success: null,
  2531. error: null
  2532. };
  2533. S.extend(u, s), S.extend(u, {
  2534. success: function(e) {
  2535. s.success && s.success(e)
  2536. },
  2537. error: function(e, t) {
  2538. s.error && s.error(e, t)
  2539. }
  2540. }), a.setRequestParam(u), a.submitRequest()
  2541. }, It.prototype.sessionV2Login = function(e, n, r, s, o, i, a, u) {
  2542. var c = "";
  2543. c = 2 == r ? "https://" : "http://";
  2544. var l = parseInt(t.$XML(a).find("sessionIDVersion").eq(0).text(), 10),
  2545. d = "true" === t.$XML(a).find("isSessionIDValidLongTerm").eq(0).text(),
  2546. p = F(this.CGI.sessionLogin, c, n, s),
  2547. f = t.$XML(a).find("sessionID").eq(0).text(),
  2548. h = t.$XML(a).find("challenge").eq(0).text(),
  2549. P = parseInt(t.$XML(a).find("iterations").eq(0).text(), 10),
  2550. I = !1,
  2551. m = "";
  2552. t.$XML(a).find("isIrreversible", !0).length > 0 && (I = "true" === t.$XML(a).find("isIrreversible").eq(0).text(), m = t.$XML(a).find("salt").eq(0).text()), this.m_oInfoForLocalPlgin = {
  2553. szRandom: e,
  2554. sessionID: f,
  2555. iterations: P,
  2556. challenge: h,
  2557. user: o
  2558. };
  2559. var v = S.encodePwd(i, {
  2560. challenge: h,
  2561. userName: o,
  2562. salt: m,
  2563. iIterate: P
  2564. }, I),
  2565. C = "<SessionLogin>";
  2566. C += "<userName>" + S.escape(o) + "</userName>", C += "<password>" + v + "</password>", C += "<sessionID>" + f + "</sessionID>", C += "<isSessionIDValidLongTerm>" + d + "</isSessionIDValidLongTerm>", C += "<sessionIDVersion>" + l + "</sessionIDVersion>", C += "</SessionLogin>";
  2567. var y = new Pt,
  2568. g = {
  2569. type: "POST",
  2570. url: p,
  2571. data: C,
  2572. auth: "",
  2573. success: null,
  2574. error: null
  2575. };
  2576. S.extend(g, u), S.extend(g, {
  2577. success: function(e) {
  2578. u.success && u.success(e)
  2579. },
  2580. error: function(e, t) {
  2581. u.error && u.error(e, t)
  2582. }
  2583. }), y.setRequestParam(g), y.submitRequest()
  2584. }, It.prototype.sessionLogin = function(e, n, r, s, o, i, a) {
  2585. var u = "";
  2586. u = 2 == n ? "https://" : "http://";
  2587. var c = F(this.CGI.sessionLogin, u, e, r),
  2588. l = t.$XML(i).find("sessionID").eq(0).text(),
  2589. d = t.$XML(i).find("challenge").eq(0).text(),
  2590. p = parseInt(t.$XML(i).find("iterations").eq(0).text(), 10),
  2591. f = !1,
  2592. h = "";
  2593. t.$XML(i).find("isIrreversible", !0).length > 0 && (f = "true" === t.$XML(i).find("isIrreversible").eq(0).text(), h = t.$XML(i).find("salt").eq(0).text());
  2594. var P = "";
  2595. if (f) {
  2596. P = S.sha256(s + h + o), P = S.sha256(P + d);
  2597. for (var I = 2; p > I; I++) P = S.sha256(P)
  2598. } else {
  2599. P = S.sha256(o) + d;
  2600. for (var I = 1; p > I; I++) P = S.sha256(P)
  2601. }
  2602. var m = "<SessionLogin>";
  2603. m += "<userName>" + S.escape(s) + "</userName>", m += "<password>" + P + "</password>", m += "<sessionID>" + l + "</sessionID>", m += "</SessionLogin>";
  2604. var v = new Pt,
  2605. C = {
  2606. type: "POST",
  2607. url: c,
  2608. data: m,
  2609. auth: "",
  2610. success: null,
  2611. error: null
  2612. };
  2613. S.extend(C, a), S.extend(C, {
  2614. success: function(e) {
  2615. a.success && a.success(e)
  2616. },
  2617. error: function(e, t) {
  2618. a.error && a.error(e, t)
  2619. }
  2620. }), v.setRequestParam(C), v.submitRequest()
  2621. }, It.prototype.sessionHeartbeat = function(e, t, n) {
  2622. var r = F(this.CGI.sessionHeartbeat, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2623. s = new Pt,
  2624. o = {
  2625. type: "PUT",
  2626. url: r,
  2627. auth: e.szAuth,
  2628. success: null,
  2629. error: null
  2630. };
  2631. S.extend(o, {
  2632. success: function(e) {
  2633. t && t(e)
  2634. },
  2635. error: function(e, t) {
  2636. n && n(e, t)
  2637. }
  2638. }), s.setRequestParam(o), s.submitRequest()
  2639. }, It.prototype.sessionLogout = function(e, t) {
  2640. var n = F(this.CGI.sessionLogout, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2641. r = new Pt,
  2642. s = {
  2643. type: "PUT",
  2644. url: n,
  2645. auth: e.szAuth,
  2646. success: null,
  2647. error: null
  2648. };
  2649. S.extend(s, t), S.extend(s, {
  2650. success: function(e) {
  2651. t.success && t.success(e)
  2652. },
  2653. error: function(e, n) {
  2654. t.error && t.error(e, n)
  2655. }
  2656. }), r.setRequestParam(s), r.submitRequest()
  2657. }, It.prototype.getSystemCapa = function(e, t) {
  2658. var n = F(this.CGI.systemCapabilities, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2659. r = new Pt,
  2660. s = {
  2661. type: "GET",
  2662. url: n,
  2663. async: !1,
  2664. auth: e.szAuth,
  2665. success: null,
  2666. error: null
  2667. };
  2668. S.extend(s, t), S.extend(s, {
  2669. success: function(e) {
  2670. t.success && t.success(e)
  2671. },
  2672. error: function(e, n) {
  2673. t.error && t.error(e, n)
  2674. }
  2675. }), r.setRequestParam(s), r.submitRequest()
  2676. };
  2677. var mt = function() {};
  2678. mt.prototype.CGI = {
  2679. login: "%s%s:%s/PSIA/Custom/SelfExt/userCheck",
  2680. getAudioInfo: "%s%s:%s/PSIA/Custom/SelfExt/TwoWayAudio/channels",
  2681. getDeviceInfo: "%s%s:%s/PSIA/System/deviceInfo",
  2682. getAnalogChannelInfo: "%s%s:%s/PSIA/System/Video/inputs/channels",
  2683. getDigitalChannel: "%s%s:%s/PSIA/Custom/SelfExt/ContentMgmt/DynVideo/inputs/channels",
  2684. getDigitalChannelInfo: "%s%s:%s/PSIA/Custom/SelfExt/ContentMgmt/DynVideo/inputs/channels/status",
  2685. getZeroChannelInfo: "%s%s:%s/PSIA/Custom/SelfExt/ContentMgmt/ZeroVideo/channels",
  2686. getStreamChannels: {
  2687. analog: "%s%s:%s/PSIA/Streaming/channels",
  2688. digital: "%s%s:%s/PSIA/Custom/SelfExt/ContentMgmt/DynStreaming/channels"
  2689. },
  2690. getStreamDynChannels: "%s%s:%s/PSIA/Custom/SelfExt/ContentMgmt/DynStreaming/channels",
  2691. startRealPlay: {
  2692. channels: "%s%s:%s/PSIA/streaming/channels/%s",
  2693. zeroChannels: "%s%s:%s/PSIA/Custom/SelfExt/ContentMgmt/ZeroStreaming/channels/%s"
  2694. },
  2695. startVoiceTalk: {
  2696. open: "%s%s:%s/PSIA/Custom/SelfExt/TwoWayAudio/channels/%s/open",
  2697. close: "%s%s:%s/PSIA/Custom/SelfExt/TwoWayAudio/channels/%s/close",
  2698. audioData: "%s%s:%s/PSIA/Custom/SelfExt/TwoWayAudio/channels/%s/audioData"
  2699. },
  2700. ptzControl: "%s%s:%s/PSIA/PTZ/channels/%s/continuous",
  2701. ptzAutoControl: "%s%s:%s/PSIA/Custom/SelfExt/PTZ/channels/%s/autoptz",
  2702. setPreset: "%s%s:%s/PSIA/PTZ/channels/%s/presets/%s",
  2703. goPreset: "%s%s:%s/PSIA/PTZ/channels/%s/presets/%s/goto",
  2704. ptzFocus: "%s%s:%s/PSIA/System/Video/inputs/channels/%s/focus",
  2705. ptzIris: "%s%s:%s/PSIA/System/Video/inputs/channels/%s/iris",
  2706. getNetworkBond: "%s%s:%s/PSIA/Custom/SelfExt/Bond",
  2707. getNetworkInterface: "%s%s:%s/PSIA/System/Network/interfaces",
  2708. getUPnPPortStatus: "%s%s:%s/PSIA/Custom/SelfExt/UPnP/ports/status",
  2709. getPPPoEStatus: "%s%s:%s/PSIA/Custom/SelfExt/PPPoE/1/status",
  2710. getPortInfo: "%s%s:%s/PSIA/Security/AAA/adminAccesses",
  2711. recordSearch: "%s%s:%s/PSIA/ContentMgmt/search",
  2712. startPlayback: "%s%s:%s/PSIA/streaming/tracks/%s?starttime=%s&endtime=%s",
  2713. startDownloadRecord: "%s%s:%s/PSIA/Custom/SelfExt/ContentMgmt/download",
  2714. deviceConfig: "%s%s:%s/PSIA/System/configurationData",
  2715. restart: "%s%s:%s/PSIA/System/reboot",
  2716. restore: "%s%s:%s/PSIA/System/factoryReset?mode=%s",
  2717. startUpgrade: {
  2718. upgrade: "%s%s:%s/PSIA/System/updateFirmware",
  2719. status: "%s%s:%s/PSIA/Custom/SelfExt/upgradeStatus"
  2720. },
  2721. set3DZoom: "%s%s:%s/PSIA/Custom/SelfExt/PTZ/channels/%s/Set3DZoom",
  2722. deviceCapture: {
  2723. channels: "%s%s:%s/PSIA/Streaming/channels/%s/picture"
  2724. },
  2725. systemCapabilities: "%s%s:%s/PSIA/System/capabilities"
  2726. }, mt.prototype.login = function(e, n, r, s) {
  2727. var o = 2 == s.protocol ? "https://" : "http://",
  2728. i = F(this.CGI.login, o, e, n),
  2729. a = new Pt,
  2730. u = {
  2731. type: "GET",
  2732. url: i,
  2733. auth: r,
  2734. success: null,
  2735. error: null
  2736. };
  2737. S.extend(u, s), S.extend(u, {
  2738. success: function(e) {
  2739. "200" == t.$XML(e).find("statusValue").eq(0).text() ? s.success && s.success(e) : s.error && s.error(401, e)
  2740. },
  2741. error: function(e, t) {
  2742. s.error && s.error(e, t)
  2743. }
  2744. }), a.setRequestParam(u), a.submitRequest()
  2745. }, mt.prototype.getAudioInfo = function(e, t) {
  2746. var n = F(this.CGI.getAudioInfo, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2747. r = new Pt,
  2748. s = {
  2749. type: "GET",
  2750. url: n,
  2751. auth: e.szAuth,
  2752. success: null,
  2753. error: null
  2754. };
  2755. S.extend(s, t), S.extend(s, {
  2756. success: function(e) {
  2757. t.success && t.success(e)
  2758. },
  2759. error: function(e, n) {
  2760. t.error && t.error(e, n)
  2761. }
  2762. }), r.setRequestParam(s), r.submitRequest()
  2763. }, mt.prototype.getDeviceInfo = function(e, n) {
  2764. var r = F(this.CGI.getDeviceInfo, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2765. s = new Pt,
  2766. o = {
  2767. type: "GET",
  2768. url: r,
  2769. auth: e.szAuth,
  2770. success: null,
  2771. error: null
  2772. };
  2773. S.extend(o, n), S.extend(o, {
  2774. success: function(e) {
  2775. var r = [];
  2776. r.push("<DeviceInfo>"), r.push("<deviceName>" + S.escape(t.$XML(e).find("deviceName").eq(0).text()) + "</deviceName>"), r.push("<deviceID>" + t.$XML(e).find("deviceID").eq(0).text() + "</deviceID>"), r.push("<deviceType>" + t.$XML(e).find("deviceDescription").eq(0).text() + "</deviceType>"), r.push("<model>" + t.$XML(e).find("model").eq(0).text() + "</model>"), r.push("<serialNumber>" + t.$XML(e).find("serialNumber").eq(0).text() + "</serialNumber>"), r.push("<macAddress>" + t.$XML(e).find("macAddress").eq(0).text() + "</macAddress>"), r.push("<firmwareVersion>" + t.$XML(e).find("firmwareVersion").eq(0).text() + "</firmwareVersion>"), r.push("<firmwareReleasedDate>" + t.$XML(e).find("firmwareReleasedDate").eq(0).text() + "</firmwareReleasedDate>"), r.push("<encoderVersion>" + t.$XML(e).find("logicVersion").eq(0).text() + "</encoderVersion>"), r.push("<encoderReleasedDate>" + t.$XML(e).find("logicReleasedDate").eq(0).text() + "</encoderReleasedDate>"), r.push("</DeviceInfo>"), e = S.loadXML(r.join("")), n.success && n.success(e)
  2777. },
  2778. error: function(e, t) {
  2779. n.error && n.error(e, t)
  2780. }
  2781. }), s.setRequestParam(o), s.submitRequest()
  2782. }, mt.prototype.getSystemCapa = function(e, t) {
  2783. var n = F(this.CGI.systemCapabilities, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2784. r = new Pt,
  2785. s = {
  2786. type: "GET",
  2787. async: !1,
  2788. url: n,
  2789. auth: e.szAuth,
  2790. success: null,
  2791. error: null
  2792. };
  2793. S.extend(s, t), S.extend(s, {
  2794. success: function(e) {
  2795. t.success && t.success(e)
  2796. },
  2797. error: function(e, n) {
  2798. t.error && t.error(e, n)
  2799. }
  2800. }), r.setRequestParam(s), r.submitRequest()
  2801. }, mt.prototype.getAnalogChannelInfo = function(e, n) {
  2802. var r = F(this.CGI.getAnalogChannelInfo, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2803. s = new Pt,
  2804. o = {
  2805. type: "GET",
  2806. url: r,
  2807. auth: e.szAuth,
  2808. success: null,
  2809. error: null
  2810. };
  2811. S.extend(o, n), S.extend(o, {
  2812. success: function(e) {
  2813. var r = [];
  2814. r.push("<VideoInputChannelList>");
  2815. for (var s = t.$XML(e).find("VideoInputChannel", !0), o = 0, i = s.length; i > o; o++) {
  2816. var a = s[o];
  2817. r.push("<VideoInputChannel>"), r.push("<id>" + t.$XML(a).find("id").eq(0).text() + "</id>"), r.push("<inputPort>" + t.$XML(a).find("inputPort").eq(0).text() + "</inputPort>"), r.push("<name>" + S.escape(t.$XML(a).find("name").eq(0).text()) + "</name>"), r.push("<videoFormat>" + t.$XML(a).find("videoFormat").eq(0).text() + "</videoFormat>"), r.push("</VideoInputChannel>")
  2818. }
  2819. r.push("</VideoInputChannelList>"), e = S.loadXML(r.join("")), n.success && n.success(e)
  2820. },
  2821. error: function(e, t) {
  2822. n.error && n.error(e, t)
  2823. }
  2824. }), s.setRequestParam(o), s.submitRequest()
  2825. }, mt.prototype.getDigitalChannel = function(e, n) {
  2826. var r = F(this.CGI.getDigitalChannel, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2827. s = new Pt,
  2828. o = {
  2829. type: "GET",
  2830. url: r,
  2831. auth: e.szAuth,
  2832. success: null,
  2833. error: null
  2834. };
  2835. S.extend(o, n), S.extend(o, {
  2836. success: function(e) {
  2837. var r = [];
  2838. r.push("<InputProxyChannelList>");
  2839. for (var s = t.$XML(e).find("DynVideoInputChannel", !0), o = 0, i = s.length; i > o; o++) {
  2840. var a = s[o];
  2841. r.push("<InputProxyChannel>"), r.push("<id>" + t.$XML(a).find("id").eq(0).text() + "</id>"), r.push("<name>" + S.escape(t.$XML(a).find("name").eq(0).text()) + "</name>"), r.push("</InputProxyChannel>")
  2842. }
  2843. r.push("</InputProxyChannelList>"), e = S.loadXML(r.join("")), n.success && n.success(e)
  2844. },
  2845. error: function(e, t) {
  2846. n.error && n.error(e, t)
  2847. }
  2848. }), s.setRequestParam(o), s.submitRequest()
  2849. }, mt.prototype.getDigitalChannelInfo = function(e, n) {
  2850. var r = null,
  2851. s = {};
  2852. if (this.getDigitalChannel(e, {
  2853. async: !1,
  2854. success: function(e) {
  2855. r = e;
  2856. for (var n = t.$XML(r).find("InputProxyChannel", !0), o = 0, i = n.length; i > o; o++) {
  2857. var a = n[o],
  2858. u = t.$XML(a).find("id").eq(0).text(),
  2859. c = t.$XML(a).find("name").eq(0).text();
  2860. s[u] = c
  2861. }
  2862. },
  2863. error: function(e, t) {
  2864. n.error && n.error(e, t)
  2865. }
  2866. }), null !== r) {
  2867. var o = F(this.CGI.getDigitalChannelInfo, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2868. i = new Pt,
  2869. a = {
  2870. type: "GET",
  2871. url: o,
  2872. auth: e.szAuth,
  2873. success: null,
  2874. error: null
  2875. };
  2876. S.extend(a, n), S.extend(a, {
  2877. success: function(e) {
  2878. var r = [];
  2879. r.push("<InputProxyChannelStatusList>");
  2880. for (var o = t.$XML(e).find("DynVideoInputChannelStatus", !0), i = 0, a = o.length; a > i; i++) {
  2881. var u = o[i],
  2882. c = t.$XML(u).find("id").eq(0).text();
  2883. r.push("<InputProxyChannelStatus>"), r.push("<id>" + c + "</id>"), r.push("<sourceInputPortDescriptor>"), r.push("<proxyProtocol>" + t.$XML(u).find("adminProtocol").eq(0).text() + "</proxyProtocol>"), r.push("<addressingFormatType>" + t.$XML(u).find("addressingFormatType").eq(0).text() + "</addressingFormatType>"), r.push("<ipAddress>" + t.$XML(u).find("ipAddress").eq(0).text() + "</ipAddress>"), r.push("<managePortNo>" + t.$XML(u).find("adminPortNo").eq(0).text() + "</managePortNo>"), r.push("<srcInputPort>" + t.$XML(u).find("srcInputPort").eq(0).text() + "</srcInputPort>"), r.push("<userName>" + S.escape(t.$XML(u).find("userName").eq(0).text()) + "</userName>"), r.push("<streamType>" + t.$XML(u).find("streamType").eq(0).text() + "</streamType>"), r.push("<online>" + t.$XML(u).find("online").eq(0).text() + "</online>"), r.push("<name>" + S.escape(s[c]) + "</name>"), r.push("</sourceInputPortDescriptor>"), r.push("</InputProxyChannelStatus>")
  2884. }
  2885. r.push("</InputProxyChannelStatusList>"), e = S.loadXML(r.join("")), n.success && n.success(e)
  2886. },
  2887. error: function(e, t) {
  2888. n.error && n.error(e, t)
  2889. }
  2890. }), i.setRequestParam(a), i.submitRequest()
  2891. }
  2892. }, mt.prototype.getZeroChannelInfo = function(e, t) {
  2893. var n = F(this.CGI.getZeroChannelInfo, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2894. r = new Pt,
  2895. s = {
  2896. type: "GET",
  2897. url: n,
  2898. auth: e.szAuth,
  2899. success: null,
  2900. error: null
  2901. };
  2902. S.extend(s, t), S.extend(s, {
  2903. success: function(e) {
  2904. t.success && t.success(e)
  2905. },
  2906. error: function(e, n) {
  2907. t.error && t.error(e, n)
  2908. }
  2909. }), r.setRequestParam(s), r.submitRequest()
  2910. }, mt.prototype.getPPPoEStatus = function(e, t) {
  2911. var n = F(this.CGI.getPPPoEStatus, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2912. r = new Pt,
  2913. s = {
  2914. type: "GET",
  2915. url: n,
  2916. auth: e.szAuth,
  2917. success: null,
  2918. error: null
  2919. };
  2920. S.extend(s, t), S.extend(s, {
  2921. success: function(e) {
  2922. t.success && t.success(e)
  2923. },
  2924. error: function(e, n) {
  2925. t.error && t.error(e, n)
  2926. }
  2927. }), r.setRequestParam(s), r.submitRequest()
  2928. }, mt.prototype.getUPnPPortStatus = function(e, t) {
  2929. var n = F(this.CGI.getUPnPPortStatus, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2930. r = new Pt,
  2931. s = {
  2932. type: "GET",
  2933. url: n,
  2934. auth: e.szAuth,
  2935. success: null,
  2936. error: null
  2937. };
  2938. S.extend(s, t), S.extend(s, {
  2939. success: function(e) {
  2940. t.success && t.success(e)
  2941. },
  2942. error: function(e, n) {
  2943. t.error && t.error(e, n)
  2944. }
  2945. }), r.setRequestParam(s), r.submitRequest()
  2946. }, mt.prototype.getNetworkBond = function(e, t) {
  2947. var n = F(this.CGI.getNetworkBond, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2948. r = new Pt,
  2949. s = {
  2950. type: "GET",
  2951. url: n,
  2952. auth: e.szAuth,
  2953. success: null,
  2954. error: null
  2955. };
  2956. S.extend(s, t), S.extend(s, {
  2957. success: function(e) {
  2958. t.success && t.success(e)
  2959. },
  2960. error: function(e, n) {
  2961. t.error && t.error(e, n)
  2962. }
  2963. }), r.setRequestParam(s), r.submitRequest()
  2964. }, mt.prototype.getNetworkInterface = function(e, t) {
  2965. var n = F(this.CGI.getNetworkInterface, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2966. r = new Pt,
  2967. s = {
  2968. type: "GET",
  2969. url: n,
  2970. auth: e.szAuth,
  2971. success: null,
  2972. error: null
  2973. };
  2974. S.extend(s, t), S.extend(s, {
  2975. success: function(e) {
  2976. t.success && t.success(e)
  2977. },
  2978. error: function(e, n) {
  2979. t.error && t.error(e, n)
  2980. }
  2981. }), r.setRequestParam(s), r.submitRequest()
  2982. }, mt.prototype.getPortInfo = function(e, n) {
  2983. var r = F(this.CGI.getPortInfo, e.szHttpProtocol, e.szIP, e.iCGIPort),
  2984. s = new Pt,
  2985. o = {
  2986. type: "GET",
  2987. url: r,
  2988. auth: e.szAuth,
  2989. success: null,
  2990. error: null
  2991. };
  2992. S.extend(o, n), S.extend(o, {
  2993. success: function(r) {
  2994. var s = [];
  2995. s.push("<AdminAccessProtocolList>");
  2996. for (var o = t.$XML(r).find("AdminAccessProtocol", !0), i = 0, a = o.length; a > i; i++) o[i], s.push("<AdminAccessProtocol>"), s.push("<id>" + t.$XML(r).find("id").eq(0).text() + "</id>"), s.push("<enabled>" + t.$XML(r).find("enabled").eq(0).text() + "</enabled>"), s.push("<protocol>" + t.$XML(r).find("protocol").eq(0).text().toUpperCase() + "</protocol>"), s.push("<portNo>" + t.$XML(r).find("portNo").eq(0).text() + "</portNo>"), s.push("</AdminAccessProtocol>");
  2997. C.getStreamChannels(e, {
  2998. async: !1,
  2999. success: function(r) {
  3000. if (t.$XML(r).find("rtspPortNo", !0).length > 0) {
  3001. var o = parseInt(t.$XML(r).find("rtspPortNo").eq(0).text(), 10);
  3002. s.push("<AdminAccessProtocol>"), s.push("<id>4</id>"), s.push("<enabled>true</enabled>"), s.push("<protocol>RTSP</protocol>"), s.push("<portNo>" + o + "</portNo>"), s.push("</AdminAccessProtocol>"), s.push("</AdminAccessProtocolList>");
  3003. var i = S.loadXML(s.join(""));
  3004. n.success && n.success(i)
  3005. } else C.getStreamDynChannels(e, {
  3006. async: !1,
  3007. success: function(e) {
  3008. if (t.$XML(e).find("rtspPortNo", !0).length > 0) {
  3009. var r = parseInt(t.$XML(e).find("rtspPortNo").eq(0).text(), 10);
  3010. s.push("<AdminAccessProtocol>"), s.push("<id>4</id>"), s.push("<enabled>true</enabled>"), s.push("<protocol>RTSP</protocol>"), s.push("<portNo>" + r + "</portNo>"), s.push("</AdminAccessProtocol>"), s.push("</AdminAccessProtocolList>");
  3011. var o = S.loadXML(s.join(""));
  3012. n.success && n.success(o)
  3013. }
  3014. },
  3015. error: function() {
  3016. n.error && n.error()
  3017. }
  3018. })
  3019. },
  3020. error: function() {
  3021. n.error && n.error()
  3022. }
  3023. })
  3024. },
  3025. error: function() {
  3026. var r = [];
  3027. r.push("<AdminAccessProtocolList>"), C.getStreamChannels(e, {
  3028. async: !1,
  3029. success: function(s) {
  3030. if (t.$XML(s).find("rtspPortNo", !0).length > 0) {
  3031. var o = parseInt(t.$XML(s).find("rtspPortNo").eq(0).text(), 10);
  3032. r.push("<AdminAccessProtocol>"), r.push("<id>4</id>"), r.push("<enabled>true</enabled>"), r.push("<protocol>RTSP</protocol>"), r.push("<portNo>" + o + "</portNo>"), r.push("</AdminAccessProtocol>"), r.push("</AdminAccessProtocolList>");
  3033. var i = S.loadXML(r.join(""));
  3034. n.success && n.success(i)
  3035. } else C.getStreamDynChannels(e, {
  3036. async: !1,
  3037. success: function(e) {
  3038. if (t.$XML(e).find("rtspPortNo", !0).length > 0) {
  3039. var s = parseInt(t.$XML(e).find("rtspPortNo").eq(0).text(), 10);
  3040. r.push("<AdminAccessProtocol>"), r.push("<id>4</id>"), r.push("<enabled>true</enabled>"), r.push("<protocol>RTSP</protocol>"), r.push("<portNo>" + s + "</portNo>"), r.push("</AdminAccessProtocol>"), r.push("</AdminAccessProtocolList>");
  3041. var o = S.loadXML(r.join(""));
  3042. n.success && n.success(o)
  3043. }
  3044. },
  3045. error: function() {
  3046. n.error && n.error()
  3047. }
  3048. })
  3049. },
  3050. error: function() {
  3051. n.error && n.error()
  3052. }
  3053. })
  3054. }
  3055. }), s.setRequestParam(o), s.submitRequest()
  3056. }, mt.prototype.getStreamChannels = function(e, t) {
  3057. if (0 != e.iAnalogChannelNum) var n = F(this.CGI.getStreamChannels.analog, e.szHttpProtocol, e.szIP, e.iCGIPort);
  3058. else var n = F(this.CGI.getStreamChannels.digital, e.szHttpProtocol, e.szIP, e.iCGIPort);
  3059. var r = new Pt,
  3060. s = {
  3061. type: "GET",
  3062. url: n,
  3063. auth: e.szAuth,
  3064. success: null,
  3065. error: null
  3066. };
  3067. S.extend(s, t), S.extend(s, {
  3068. success: function(e) {
  3069. t.success && t.success(e)
  3070. },
  3071. error: function(e, n) {
  3072. t.error && t.error(e, n)
  3073. }
  3074. }), r.setRequestParam(s), r.submitRequest()
  3075. }, mt.prototype.getStreamDynChannels = function(e, t) {
  3076. var n = F(this.CGI.getStreamDynChannels, e.szHttpProtocol, e.szIP, e.iCGIPort),
  3077. r = new Pt,
  3078. s = {
  3079. type: "GET",
  3080. url: n,
  3081. auth: e.szAuth,
  3082. success: null,
  3083. error: null
  3084. };
  3085. S.extend(s, t), S.extend(s, {
  3086. success: function(e) {
  3087. t.success && t.success(e)
  3088. },
  3089. error: function(e, n) {
  3090. t.error && t.error(e, n)
  3091. }
  3092. }), r.setRequestParam(s), r.submitRequest()
  3093. }, mt.prototype.startRealPlay = function(e, t) {
  3094. var n = 100 * t.iChannelID + t.iStreamType,
  3095. r = "",
  3096. s = e.szIP;
  3097. "rtsp://" === t.urlProtocol && (s = V(s)), r = t.bZeroChannel ? F(t.cgi.zeroChannels, t.urlProtocol, s, t.iPort, n) : F(t.cgi.channels, t.urlProtocol, s, t.iPort, n);
  3098. var o = p.HWP_Play(r, e.szAuth, t.iWndIndex, "", "");
  3099. if (0 == o) {
  3100. var i = new ht;
  3101. i.iIndex = t.iWndIndex, i.szIP = e.szIP, i.iCGIPort = e.iCGIPort, i.szDeviceIdentify = e.szDeviceIdentify, i.iChannelID = t.iChannelID, i.iPlayStatus = T, I.push(i)
  3102. }
  3103. return o
  3104. }, mt.prototype.startVoiceTalk = function(e, t) {
  3105. var n = F(this.CGI.startVoiceTalk.open, e.szHttpProtocol, e.szIP, e.iCGIPort, t),
  3106. r = F(this.CGI.startVoiceTalk.close, e.szHttpProtocol, e.szIP, e.iCGIPort, t),
  3107. s = F(this.CGI.startVoiceTalk.audioData, e.szHttpProtocol, e.szIP, e.iCGIPort, t),
  3108. o = p.HWP_StartVoiceTalkEx(n, r, s, e.szAuth, e.iAudioTypeoDeviceInfo.m_iAudioBitRate, e.m_iAudioSamplingRate);
  3109. return o
  3110. }, mt.prototype.ptzAutoControl = function(e, t, n, r) {
  3111. var s = n.iChannelID,
  3112. o = "",
  3113. i = "";
  3114. if (r.iPTZSpeed = r.iPTZSpeed < 7 ? 15 * r.iPTZSpeed : 100, t && (r.iPTZSpeed = 0), e.szDeviceType != E) o = F(this.CGI.ptzAutoControl, e.szHttpProtocol, e.szIP, e.iCGIPort, s), i = "<?xml version='1.0' encoding='UTF-8'?><PTZData><pan>" + r.iPTZSpeed + "</pan>" + "<tilt>0</tilt>" + "</PTZData>";
  3115. else {
  3116. var a = 99;
  3117. t && (a = 96), o = F(this.CGI.goPreset, e.szHttpProtocol, e.szIP, e.iCGIPort, s, a)
  3118. }
  3119. var u = new Pt,
  3120. c = {
  3121. type: "PUT",
  3122. url: o,
  3123. async: !1,
  3124. auth: e.szAuth,
  3125. data: i,
  3126. success: null,
  3127. error: null
  3128. },
  3129. l = this;
  3130. S.extend(c, r), S.extend(c, {
  3131. success: function(e) {
  3132. n.bPTZAuto = !n.bPTZAuto, r.success && r.success(e)
  3133. },
  3134. error: function(t, s) {
  3135. if (e.szDeviceType != E) {
  3136. o = F(l.CGI.ptzControl, e.szHttpProtocol, e.szIP, e.iCGIPort, n.iChannelID);
  3137. var a = new Pt,
  3138. u = {
  3139. type: "PUT",
  3140. url: o,
  3141. async: !1,
  3142. auth: e.szAuth,
  3143. data: i,
  3144. success: null,
  3145. error: null
  3146. };
  3147. S.extend(u, r), a.setRequestParam(u), a.submitRequest()
  3148. } else r.error && r.error(t, s)
  3149. }
  3150. }), u.setRequestParam(c), u.submitRequest()
  3151. }, mt.prototype.ptzControl = function(e, t, n, r) {
  3152. var s = (n.iChannelID, "");
  3153. n.bPTZAuto && this.ptzAutoControl(e, !0, n, {
  3154. iPTZSpeed: 0
  3155. }), r.iPTZSpeed = t ? 0 : r.iPTZSpeed < 7 ? 15 * r.iPTZSpeed : 100;
  3156. var o = [{}, {
  3157. pan: 0,
  3158. tilt: r.iPTZSpeed
  3159. }, {
  3160. pan: 0,
  3161. tilt: -r.iPTZSpeed
  3162. }, {
  3163. pan: -r.iPTZSpeed,
  3164. tilt: 0
  3165. }, {
  3166. pan: r.iPTZSpeed,
  3167. tilt: 0
  3168. }, {
  3169. pan: -r.iPTZSpeed,
  3170. tilt: r.iPTZSpeed
  3171. }, {
  3172. pan: -r.iPTZSpeed,
  3173. tilt: -r.iPTZSpeed
  3174. }, {
  3175. pan: r.iPTZSpeed,
  3176. tilt: r.iPTZSpeed
  3177. }, {
  3178. pan: r.iPTZSpeed,
  3179. tilt: -r.iPTZSpeed
  3180. }, {}, {
  3181. speed: r.iPTZSpeed
  3182. }, {
  3183. speed: -r.iPTZSpeed
  3184. }, {
  3185. speed: r.iPTZSpeed
  3186. }, {
  3187. speed: -r.iPTZSpeed
  3188. }, {
  3189. speed: r.iPTZSpeed
  3190. }, {
  3191. speed: -r.iPTZSpeed
  3192. }],
  3193. i = "",
  3194. a = {};
  3195. switch (r.iPTZIndex) {
  3196. case 1:
  3197. case 2:
  3198. case 3:
  3199. case 4:
  3200. case 5:
  3201. case 6:
  3202. case 7:
  3203. case 8:
  3204. a = this.CGI.ptzControl, i = "<?xml version='1.0' encoding='UTF-8'?><PTZData><pan>" + o[r.iPTZIndex].pan + "</pan>" + "<tilt>" + o[r.iPTZIndex].tilt + "</tilt>" + "</PTZData>";
  3205. break;
  3206. case 10:
  3207. case 11:
  3208. a = this.CGI.ptzControl, i = "<?xml version='1.0' encoding='UTF-8'?><PTZData><zoom>" + o[r.iPTZIndex].speed + "</zoom>" + "</PTZData>";
  3209. break;
  3210. case 12:
  3211. case 13:
  3212. a = this.CGI.ptzFocus, i = "<?xml version='1.0' encoding='UTF-8'?><FocusData><focus>" + o[r.iPTZIndex].speed + "</focus>" + "</FocusData>";
  3213. break;
  3214. case 14:
  3215. case 15:
  3216. a = this.CGI.ptzIris, i = "<?xml version='1.0' encoding='UTF-8'?><IrisData><iris>" + o[r.iPTZIndex].speed + "</iris>" + "</IrisData>";
  3217. break;
  3218. default:
  3219. return r.error && r.error(), void 0
  3220. }
  3221. s = F(a, e.szHttpProtocol, e.szIP, e.iCGIPort, n.iChannelID);
  3222. var u = new Pt,
  3223. c = {
  3224. type: "PUT",
  3225. url: s,
  3226. async: !1,
  3227. auth: e.szAuth,
  3228. data: i,
  3229. success: null,
  3230. error: null
  3231. };
  3232. S.extend(c, r), S.extend(c, {
  3233. success: function(e) {
  3234. r.success && r.success(e)
  3235. },
  3236. error: function(e, t) {
  3237. r.error && r.error(e, t)
  3238. }
  3239. }), u.setRequestParam(c), u.submitRequest()
  3240. }, mt.prototype.setPreset = function(e, t, n) {
  3241. var r = (t.iChannelID, ""),
  3242. s = "";
  3243. r = F(this.CGI.setPreset, e.szHttpProtocol, e.szIP, e.iCGIPort, t.iChannelID, n.iPresetID), s = "<?xml version='1.0' encoding='UTF-8'?>", s += "<PTZPreset>", s += "<id>" + n.iPresetID + "</id>", e.szDeviceType != E && (s += "<presetName>Preset" + n.iPresetID + "</presetName>"), s += "</PTZPreset>";
  3244. var o = new Pt,
  3245. i = {
  3246. type: "PUT",
  3247. url: r,
  3248. auth: e.szAuth,
  3249. data: s,
  3250. success: null,
  3251. error: null
  3252. };
  3253. S.extend(i, n), S.extend(i, {
  3254. success: function(e) {
  3255. n.success && n.success(e)
  3256. },
  3257. error: function(e, t) {
  3258. n.error && n.error(e, t)
  3259. }
  3260. }), o.setRequestParam(i), o.submitRequest()
  3261. }, mt.prototype.goPreset = function(e, t, n) {
  3262. var r = (t.iChannelID, "");
  3263. r = F(this.CGI.goPreset, e.szHttpProtocol, e.szIP, e.iCGIPort, t.iChannelID, n.iPresetID);
  3264. var s = new Pt,
  3265. o = {
  3266. type: "PUT",
  3267. url: r,
  3268. auth: e.szAuth,
  3269. success: null,
  3270. error: null
  3271. };
  3272. S.extend(o, n), S.extend(o, {
  3273. success: function(e) {
  3274. n.success && n.success(e)
  3275. },
  3276. error: function(e, t) {
  3277. n.error && n.error(e, t)
  3278. }
  3279. }), s.setRequestParam(o), s.submitRequest()
  3280. }, mt.prototype.recordSearch = function(e, n) {
  3281. var r = "",
  3282. s = "",
  3283. i = n.iChannelID,
  3284. a = n.iStreamType,
  3285. u = n.szStartTime.replace(" ", "T") + "Z",
  3286. c = n.szEndTime.replace(" ", "T") + "Z";
  3287. r = F(this.CGI.recordSearch, e.szHttpProtocol, e.szIP, e.iCGIPort), s = "<?xml version='1.0' encoding='UTF-8'?><CMSearchDescription><searchID>" + new o + "</searchID>" + "<trackList><trackID>" + (100 * i + a) + "</trackID></trackList>" + "<timeSpanList>" + "<timeSpan>" + "<startTime>" + u + "</startTime>" + "<endTime>" + c + "</endTime>" + "</timeSpan>" + "</timeSpanList>" + "<maxResults>40</maxResults>" + "<searchResultPostion>" + n.iSearchPos + "</searchResultPostion>" + "<metadataList>" + "<metadataDescriptor>//metadata.psia.org/VideoMotion</metadataDescriptor>" + "</metadataList>" + "</CMSearchDescription>";
  3288. var l = new Pt,
  3289. d = {
  3290. type: "POST",
  3291. url: r,
  3292. auth: e.szAuth,
  3293. data: s,
  3294. success: null,
  3295. error: null
  3296. };
  3297. S.extend(d, n), S.extend(d, {
  3298. success: function(e) {
  3299. var r = [];
  3300. r.push("<CMSearchResult>"), r.push("<responseStatus>" + t.$XML(e).find("responseStatus").eq(0).text() + "</responseStatus>"), r.push("<responseStatusStrg>" + t.$XML(e).find("responseStatusStrg").eq(0).text() + "</responseStatusStrg>"), r.push("<numOfMatches>" + t.$XML(e).find("numOfMatches").eq(0).text() + "</numOfMatches>"), r.push("<matchList>");
  3301. for (var s = t.$XML(e).find("searchMatchItem", !0), o = 0, i = s.length; i > o; o++) {
  3302. var a = s[o];
  3303. r.push("<searchMatchItem>"), r.push("<trackID>" + t.$XML(a).find("trackID").eq(0).text() + "</trackID>"), r.push("<startTime>" + t.$XML(a).find("startTime").eq(0).text() + "</startTime>"), r.push("<endTime>" + t.$XML(a).find("endTime").eq(0).text() + "</endTime>"), r.push("<playbackURI>" + S.escape(t.$XML(a).find("playbackURI").eq(0).text()) + "</playbackURI>"), r.push("<metadataDescriptor>" + t.$XML(a).find("metadataDescriptor").eq(0).text().split("/")[1] + "</metadataDescriptor>"), r.push("</searchMatchItem>")
  3304. }
  3305. r.push("</matchList>"), r.push("</CMSearchResult>"), e = S.loadXML(r.join("")), n.success && n.success(e)
  3306. },
  3307. error: function(e, t) {
  3308. n.error && n.error(e, t)
  3309. }
  3310. }), l.setRequestParam(d), l.submitRequest()
  3311. }, mt.prototype.startPlayback = function(e, t) {
  3312. var n = t.iWndIndex,
  3313. r = t.szStartTime,
  3314. s = t.szEndTime,
  3315. o = e.szIP;
  3316. "rtsp://" === t.urlProtocol && (o = V(o));
  3317. var i = F(t.cgi, t.urlProtocol, o, t.iPort, t.iChannelID, r, s),
  3318. a = p.HWP_Play(i, e.szAuth, n, r, s);
  3319. if (0 == a) {
  3320. var u = new ht;
  3321. u.iIndex = n, u.szIP = e.szIP, u.iCGIPort = e.iCGIPort, u.szDeviceIdentify = e.szDeviceIdentify, u.iChannelID = t.iChannelID, u.iPlayStatus = A, I.push(u)
  3322. }
  3323. return a
  3324. }, mt.prototype.reversePlayback = function(e, t) {
  3325. var n = t.iWndIndex,
  3326. r = t.szStartTime,
  3327. s = t.szEndTime,
  3328. o = e.szIP;
  3329. "rtsp://" === t.urlProtocol && (o = V(o));
  3330. var i = F(t.cgi, t.urlProtocol, o, t.iPort, t.iChannelID, r, s),
  3331. a = p.HWP_ReversePlay(i, e.szAuth, n, r, s);
  3332. if (0 == a) {
  3333. var u = new ht;
  3334. u.iIndex = n, u.szIP = e.szIP, u.iCGIPort = e.iCGIPort, u.szDeviceIdentify = e.szDeviceIdentify, u.iChannelID = t.iChannelID, u.iPlayStatus = q, I.push(u)
  3335. }
  3336. return a
  3337. }, mt.prototype.startDownloadRecord = function(e, t) {
  3338. var n = F(this.CGI.startDownloadRecord, e.szHttpProtocol, e.szIP, e.iCGIPort),
  3339. r = "<?xml version='1.0' encoding='UTF-8'?><downloadRequest><playbackURI> " + S.escape(t.szPlaybackURI) + "</playbackURI>" + "</downloadRequest>";
  3340. return p.HWP_StartDownload(n, e.szAuth, t.szFileName, r, t.bDateDir)
  3341. }, mt.prototype.exportDeviceConfig = function(e) {
  3342. var t = F(this.CGI.downloaddeviceConfig, e.szHttpProtocol, e.szIP, e.iCGIPort);
  3343. return ct() ? -1 : p.HWP_ExportDeviceConfig(t, e.szAuth, "", 0)
  3344. }, mt.prototype.importDeviceConfig = function(e, t) {
  3345. var n = F(this.CGI.uploaddeviceConfig, e.szHttpProtocol, e.szIP, e.iCGIPort);
  3346. return p.HWP_ImportDeviceConfig(n, e.szAuth, t.szFileName, 0)
  3347. }, mt.prototype.restart = function(e, t) {
  3348. var n = F(this.CGI.restart, e.szHttpProtocol, e.szIP, e.iCGIPort),
  3349. r = new Pt,
  3350. s = {
  3351. type: "PUT",
  3352. url: n,
  3353. auth: e.szAuth,
  3354. success: null,
  3355. error: null
  3356. };
  3357. S.extend(s, t), S.extend(s, {
  3358. success: function(e) {
  3359. t.success && t.success(e)
  3360. },
  3361. error: function(e, n) {
  3362. t.error && t.error(e, n)
  3363. }
  3364. }), r.setRequestParam(s), r.submitRequest()
  3365. }, mt.prototype.restore = function(e, t, n) {
  3366. var r = F(this.CGI.restore, e.szHttpProtocol, e.szIP, e.iCGIPort, t),
  3367. s = new Pt,
  3368. o = {
  3369. type: "PUT",
  3370. url: r,
  3371. auth: e.szAuth,
  3372. success: null,
  3373. error: null
  3374. };
  3375. S.extend(o, n), S.extend(o, {
  3376. success: function(e) {
  3377. n.success && n.success(e)
  3378. },
  3379. error: function(e, t) {
  3380. n.error && n.error(e, t)
  3381. }
  3382. }), s.setRequestParam(o), s.submitRequest()
  3383. }, mt.prototype.startUpgrade = function(e, t) {
  3384. var n = F(this.CGI.startUpgrade.upgrade, e.szHttpProtocol, e.szIP, e.iCGIPort),
  3385. r = F(this.CGI.startUpgrade.status, e.szHttpProtocol, e.szIP, e.iCGIPort);
  3386. return p.HWP_StartUpgrade(n, r, e.szAuth, t.szFileName)
  3387. }, mt.prototype.set3DZoom = function(e, t, n, r) {
  3388. var s = F(this.CGI.set3DZoom, e.szHttpProtocol, e.szIP, e.iCGIPort, t.iChannelID),
  3389. o = new Pt,
  3390. i = {
  3391. type: "PUT",
  3392. url: s,
  3393. data: n,
  3394. auth: e.szAuth,
  3395. success: null,
  3396. error: null
  3397. };
  3398. S.extend(i, r), S.extend(i, {
  3399. success: function(e) {
  3400. r.success && r.success(e)
  3401. },
  3402. error: function(e, t) {
  3403. r.error && r.error(e, t)
  3404. }
  3405. }), o.setRequestParam(i), o.submitRequest()
  3406. }, mt.prototype.deviceCapturePic = function(e, t, n, r) {
  3407. var t = 100 * t + 1,
  3408. s = F(this.CGI.deviceCapture.channels, e.szHttpProtocol, e.szIP, e.iCGIPort, t),
  3409. o = [];
  3410. return S.isInt(r.iResolutionWidth) && o.push("videoResolutionWidth=" + r.iResolutionWidth), S.isInt(r.iResolutionHeight) && o.push("videoResolutionHeight=" + r.iResolutionHeight), o.length > 0 && (s += "?" + o.join("&")), p.HWP_DeviceCapturePic(s, e.szAuth, n, r.bDateDir)
  3411. };
  3412. var vt = function() {};
  3413. vt.prototype._alert = function(e) {
  3414. d.bDebugMode && console.log(e)
  3415. },
  3416. function(e) {
  3417. var t = function(e) {
  3418. this.elems = [], this.length = 0, this.length = this.elems.push(e)
  3419. };
  3420. t.prototype.find = function(e, t) {
  3421. var n = this.elems[this.length - 1] ? this.elems[this.length - 1].getElementsByTagName(e) : [];
  3422. return this.length = this.elems.push(n), t ? n : this
  3423. }, t.prototype.eq = function(e, t) {
  3424. var n = this.elems[this.length - 1].length,
  3425. r = null;
  3426. return n > 0 && n > e && (r = this.elems[this.length - 1][e]), this.length = this.elems.push(r), t ? r : this
  3427. }, t.prototype.text = function(e) {
  3428. return this.elems[this.length - 1] ? e ? (window.DOMParser ? this.elems[this.length - 1].textContent = e : this.elems[this.length - 1].text = e, void 0) : window.DOMParser ? this.elems[this.length - 1].textContent : this.elems[this.length - 1].text : ""
  3429. }, t.prototype.attr = function(e) {
  3430. if (this.elems[this.length - 1]) {
  3431. var t = this.elems[this.length - 1].attributes.getNamedItem(e);
  3432. return t ? t.value : ""
  3433. }
  3434. }, e.$XML = function(e) {
  3435. return new t(e)
  3436. }
  3437. }(this);
  3438. var Ct = function() {};
  3439. Ct.prototype.extend = function() {
  3440. for (var e, t = arguments[0] || {}, n = 1, r = arguments.length; r > n; n++)
  3441. if (null != (e = arguments[n]))
  3442. for (var s in e) {
  3443. var o = (t[s], e[s]);
  3444. t !== o && ("object" == typeof o ? t[s] = this.extend({}, o) : void 0 !== o && (t[s] = o))
  3445. }
  3446. return t
  3447. }, Ct.prototype.browser = function() {
  3448. var e = /(chrome)[ \/]([\w.]+)/,
  3449. t = /(safari)[ \/]([\w.]+)/,
  3450. n = /(opera)(?:.*version)?[ \/]([\w.]+)/,
  3451. r = /(msie) ([\w.]+)/,
  3452. s = /(trident.*rv:)([\w.]+)/,
  3453. o = /(mozilla)(?:.*? rv:([\w.]+))?/,
  3454. i = navigator.userAgent.toLowerCase(),
  3455. a = e.exec(i) || t.exec(i) || n.exec(i) || r.exec(i) || s.exec(i) || i.indexOf("compatible") < 0 && o.exec(i) || ["unknow", "0"];
  3456. a.length > 0 && a[1].indexOf("trident") > -1 && (a[1] = "msie");
  3457. var u = {};
  3458. return u[a[1]] = !0, u.version = a[2], u
  3459. }, Ct.prototype.loadXML = function(e) {
  3460. if (null == e || "" == e) return null;
  3461. var t = null;
  3462. if (window.DOMParser) {
  3463. var n = new DOMParser;
  3464. t = n.parseFromString(e, "text/xml")
  3465. } else t = new ActiveXObject("Microsoft.XMLDOM"), t.async = !1, t.loadXML(e);
  3466. return t
  3467. }, Ct.prototype.toXMLStr = function(e) {
  3468. var t = "";
  3469. try {
  3470. var n = new XMLSerializer;
  3471. t = n.serializeToString(e)
  3472. } catch (r) {
  3473. try {
  3474. t = e.xml
  3475. } catch (r) {
  3476. return ""
  3477. }
  3478. }
  3479. return -1 == t.indexOf("<?xml") && (t = "<?xml version='1.0' encoding='utf-8'?>" + t), t
  3480. }, Ct.prototype.escape = function(e) {
  3481. return e ? e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;") : e
  3482. }, Ct.prototype.encodePwd = function(e, t, n) {
  3483. var r = "";
  3484. if (n) {
  3485. r = S.sha256(t.userName + t.salt + e), r = S.sha256(r + t.challenge);
  3486. for (var s = 2; s < t.iIterate; s++) r = S.sha256(r)
  3487. } else {
  3488. r = S.sha256(e) + t.challenge;
  3489. for (var s = 1; s < t.iIterate; s++) r = S.sha256(r)
  3490. }
  3491. return r
  3492. }, Ct.prototype.dateFormat = function(e, t) {
  3493. var n = {
  3494. "M+": e.getMonth() + 1,
  3495. "d+": e.getDate(),
  3496. "h+": e.getHours(),
  3497. "m+": e.getMinutes(),
  3498. "s+": e.getSeconds(),
  3499. "q+": Math.floor((e.getMonth() + 3) / 3),
  3500. S: e.getMilliseconds()
  3501. };
  3502. /(y+)/.test(t) && (t = t.replace(RegExp.$1, (e.getFullYear() + "").substr(4 - RegExp.$1.length)));
  3503. for (var r in n) new RegExp("(" + r + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? n[r] : ("00" + n[r]).substr(("" + n[r]).length)));
  3504. return t
  3505. }, Ct.prototype.Base64 = {
  3506. _keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
  3507. encode: function(e) {
  3508. var t, n, r, s, o, i, a, u = "",
  3509. c = 0;
  3510. for (e = Ct.prototype.Base64._utf8_encode(e); c < e.length;) t = e.charCodeAt(c++), n = e.charCodeAt(c++), r = e.charCodeAt(c++), s = t >> 2, o = (3 & t) << 4 | n >> 4, i = (15 & n) << 2 | r >> 6, a = 63 & r, isNaN(n) ? i = a = 64 : isNaN(r) && (a = 64), u = u + this._keyStr.charAt(s) + this._keyStr.charAt(o) + this._keyStr.charAt(i) + this._keyStr.charAt(a);
  3511. return u
  3512. },
  3513. decode: function(e) {
  3514. var t, n, r, s, o, i, a, u = "",
  3515. c = 0;
  3516. for (e = e.replace(/[^A-Za-z0-9\+\/\=]/g, ""); c < e.length;) s = this._keyStr.indexOf(e.charAt(c++)), o = this._keyStr.indexOf(e.charAt(c++)), i = this._keyStr.indexOf(e.charAt(c++)), a = this._keyStr.indexOf(e.charAt(c++)), t = s << 2 | o >> 4, n = (15 & o) << 4 | i >> 2, r = (3 & i) << 6 | a, u += String.fromCharCode(t), 64 != i && (u += String.fromCharCode(n)), 64 != a && (u += String.fromCharCode(r));
  3517. return u = Ct.prototype.Base64._utf8_decode(u)
  3518. },
  3519. _utf8_encode: function(e) {
  3520. e = e.replace(/\r\n/g, "\n");
  3521. for (var t = "", n = 0; n < e.length; n++) {
  3522. var r = e.charCodeAt(n);
  3523. 128 > r ? t += String.fromCharCode(r) : r > 127 && 2048 > r ? (t += String.fromCharCode(192 | r >> 6), t += String.fromCharCode(128 | 63 & r)) : (t += String.fromCharCode(224 | r >> 12), t += String.fromCharCode(128 | 63 & r >> 6), t += String.fromCharCode(128 | 63 & r))
  3524. }
  3525. return t
  3526. },
  3527. _utf8_decode: function(e) {
  3528. for (var t = "", n = 0, r = c1 = c2 = 0; n < e.length;) r = e.charCodeAt(n), 128 > r ? (t += String.fromCharCode(r), n++) : r > 191 && 224 > r ? (c2 = e.charCodeAt(n + 1), t += String.fromCharCode((31 & r) << 6 | 63 & c2), n += 2) : (c2 = e.charCodeAt(n + 1), c3 = e.charCodeAt(n + 2), t += String.fromCharCode((15 & r) << 12 | (63 & c2) << 6 | 63 & c3), n += 3);
  3529. return t
  3530. }
  3531. }, Ct.prototype.createEventScript = function(e, t, n) {
  3532. var r = document.createElement("script");
  3533. r.htmlFor = e, r.event = t, r.innerHTML = n, document.body.parentNode.appendChild(r)
  3534. }, Ct.prototype.isInt = function(e) {
  3535. return /^\d+$/.test(e)
  3536. }, Ct.prototype.getDirName = function() {
  3537. var e = "";
  3538. if ("" !== d.szBasePath) e = d.szBasePath;
  3539. else {
  3540. var t = /[^?#]*\//,
  3541. n = document.getElementById("videonode");
  3542. if (n) e = n.src.match(t)[0];
  3543. else {
  3544. for (var r = document.scripts, s = 0, o = r.length; o > s; s++)
  3545. if (r[s].src.indexOf("webVideoCtrl.js") > -1) {
  3546. n = r[s];
  3547. break
  3548. }
  3549. n && (e = n.src.match(t)[0])
  3550. }
  3551. }
  3552. return e
  3553. }, Ct.prototype.loadScript = function(e, t) {
  3554. var n = document.createElement("script");
  3555. n.type = "text/javascript", n.onload = function() {
  3556. t()
  3557. }, n.src = e, document.getElementsByTagName("head")[0].appendChild(n)
  3558. }, Ct.prototype.encodeString = function(e) {
  3559. return e ? e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;") : ""
  3560. }, Ct.prototype.getIrreversibleKey = function(e, t) {
  3561. var n = e;
  3562. if (oSecurityCap.oIrreversibleEncrypt.bSupport) {
  3563. var r = oSecurityCap.oIrreversibleEncrypt.salt;
  3564. return S.sha256(t + r + e)
  3565. }
  3566. return n
  3567. }, Ct.prototype.strToAESKey = function(e, t) {
  3568. var n = "";
  3569. if (oSecurityCap.iKeyIterateNum > 0) {
  3570. n = S.sha256(S.getIrreversibleKey(e, t) + "AaBbCcDd1234!@#$");
  3571. for (var r = 1; r < oSecurityCap.iKeyIterateNum; r++) n = S.sha256(n)
  3572. }
  3573. return n = n && n.substring(0, 32)
  3574. }, Ct.prototype.exportPasswordDeviceConfig = function(e, t) {
  3575. var n = MD5((new Date).getTime().toString()),
  3576. r = S.encodeAES(S.Base64.encode(S.encodeString(t)), szAESKey, n);
  3577. return e + "?secretkey=" + r + "&security=1&iv=" + n
  3578. }, Ct.prototype.encodeAES = function(e, t, n, r) {
  3579. var s = "";
  3580. if ("ecb" === r)
  3581. for (var o = e.length, i = 0; o > 0;) s += o > 16 ? aes_encrypt(e.substring(i, i + 16), t, !0) : aes_encrypt(e.substring(i), t, !0), o -= 16, i += 16;
  3582. else {
  3583. "undefined" == typeof n && (n = "6cd9616beb39d4034fdebe107df9a399");
  3584. var a = CryptoJS.enc.Hex.parse(t),
  3585. u = CryptoJS.enc.Hex.parse(n),
  3586. c = CryptoJS.AES.encrypt(e, a, {
  3587. mode: CryptoJS.mode.CBC,
  3588. iv: u,
  3589. padding: CryptoJS.pad.Pkcs7
  3590. });
  3591. s = c.ciphertext.toString()
  3592. }
  3593. return s
  3594. }, Ct.prototype.sha256 = function(e) {
  3595. function t(e, t) {
  3596. var n = (65535 & e) + (65535 & t);
  3597. return (e >> 16) + (t >> 16) + (n >> 16) << 16 | 65535 & n
  3598. }
  3599. function n(e, t) {
  3600. return e >>> t | e << 32 - t
  3601. }
  3602. return e = function(e) {
  3603. for (var e = e.replace(/\r\n/g, "\n"), t = "", n = 0; n < e.length; n++) {
  3604. var r = e.charCodeAt(n);
  3605. 128 > r ? t += String.fromCharCode(r) : (r > 127 && 2048 > r ? t += String.fromCharCode(192 | r >> 6) : (t += String.fromCharCode(224 | r >> 12), t += String.fromCharCode(128 | 63 & r >> 6)), t += String.fromCharCode(128 | 63 & r))
  3606. }
  3607. return t
  3608. }(e),
  3609. function(e) {
  3610. for (var t = "", n = 0; n < 4 * e.length; n++) t += "0123456789abcdef".charAt(15 & e[n >> 2] >> 8 * (3 - n % 4) + 4) + "0123456789abcdef".charAt(15 & e[n >> 2] >> 8 * (3 - n % 4));
  3611. return t
  3612. }(function(e, r) {
  3613. var s, o, i, a, u, c, l, d, p, f, h, P, I = [1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298],
  3614. m = [1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225],
  3615. v = Array(64);
  3616. for (e[r >> 5] |= 128 << 24 - r % 32, e[(r + 64 >> 9 << 4) + 15] = r, p = 0; p < e.length; p += 16) {
  3617. for (s = m[0], o = m[1], i = m[2], a = m[3], u = m[4], c = m[5], l = m[6], d = m[7], f = 0; 64 > f; f++) v[f] = 16 > f ? e[f + p] : t(t(t(n(v[f - 2], 17) ^ n(v[f - 2], 19) ^ v[f - 2] >>> 10, v[f - 7]), n(v[f - 15], 7) ^ n(v[f - 15], 18) ^ v[f - 15] >>> 3), v[f - 16]), h = t(t(t(t(d, n(u, 6) ^ n(u, 11) ^ n(u, 25)), u & c ^ ~u & l), I[f]), v[f]), P = t(n(s, 2) ^ n(s, 13) ^ n(s, 22), s & o ^ s & i ^ o & i), d = l, l = c, c = u, u = t(a, h), a = i, i = o, o = s, s = t(h, P);
  3618. m[0] = t(s, m[0]), m[1] = t(o, m[1]), m[2] = t(i, m[2]), m[3] = t(a, m[3]), m[4] = t(u, m[4]), m[5] = t(c, m[5]), m[6] = t(l, m[6]), m[7] = t(d, m[7])
  3619. }
  3620. return m
  3621. }(function(e) {
  3622. for (var t = [], n = 0; n < 8 * e.length; n += 8) t[n >> 5] |= (255 & e.charCodeAt(n / 8)) << 24 - n % 32;
  3623. return t
  3624. }(e), 8 * e.length))
  3625. }, Ct.prototype.cookie = function(e, t, n) {
  3626. if (arguments.length > 1 && (null === t || "object" != typeof t)) {
  3627. if (n = this.extend({}, n), null === t && (n.expires = -1), "number" == typeof n.expires) {
  3628. var r = n.expires,
  3629. s = n.expires = new Date;
  3630. s.setDate(s.getDate() + r)
  3631. }
  3632. return document.cookie = [encodeURIComponent(e), "=", n.raw ? String(t) : encodeURIComponent(String(t)), n.expires ? "; expires=" + n.expires.toUTCString() : "", n.path ? "; path=" + n.path : "; path=/", n.domain ? "; domain=" + n.domain : "", n.secure ? "; secure" : ""].join("")
  3633. }
  3634. n = t || {};
  3635. var o, i = n.raw ? function(e) {
  3636. return e
  3637. } : decodeURIComponent;
  3638. return (o = new RegExp("(?:^|; )" + encodeURIComponent(e) + "=([^;]*)").exec(document.cookie)) ? i(o[1]) : null
  3639. }, o.prototype.valueOf = function() {
  3640. return this.id
  3641. }, o.prototype.toString = function() {
  3642. return this.id
  3643. }, o.prototype.createUUID = function() {
  3644. var e = new Date(1582, 10, 15, 0, 0, 0, 0),
  3645. t = new Date,
  3646. n = t.getTime() - e.getTime(),
  3647. r = "-",
  3648. s = o.getIntegerBits(n, 0, 31),
  3649. i = o.getIntegerBits(n, 32, 47),
  3650. a = o.getIntegerBits(n, 48, 59) + "1",
  3651. u = o.getIntegerBits(o.rand(4095), 0, 7),
  3652. c = o.getIntegerBits(o.rand(4095), 0, 7),
  3653. l = o.getIntegerBits(o.rand(8191), 0, 7) + o.getIntegerBits(o.rand(8191), 8, 15) + o.getIntegerBits(o.rand(8191), 0, 7) + o.getIntegerBits(o.rand(8191), 8, 15) + o.getIntegerBits(o.rand(8191), 0, 15);
  3654. return s + r + i + r + a + r + u + c + r + l
  3655. }, o.getIntegerBits = function(e, t, n) {
  3656. var r = o.returnBase(e, 16),
  3657. s = new Array,
  3658. i = "",
  3659. a = 0;
  3660. for (a = 0; a < r.length; a++) s.push(r.substring(a, a + 1));
  3661. for (a = Math.floor(t / 4); a <= Math.floor(n / 4); a++) i += s[a] && "" != s[a] ? s[a] : "0";
  3662. return i
  3663. }, o.returnBase = function(e, t) {
  3664. var n = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
  3665. if (t > e) var r = n[e];
  3666. else {
  3667. var s = "" + Math.floor(e / t),
  3668. o = e - s * t;
  3669. if (s >= t) var r = this.returnBase(s, t) + n[o];
  3670. else var r = n[s] + n[o]
  3671. }
  3672. return r
  3673. }, o.rand = function(e) {
  3674. return Math.floor(Math.random() * e)
  3675. }, v = new It, C = new mt, m = new vt, S = new Ct;
  3676. var St = S.dateFormat(new Date, "yyyyMMddhhmmss");
  3677. return c = "webVideoCtrl" + St, l = "webVideoCtrl" + St, "object" != typeof window.attachEvent && S.browser().msie && (S.createEventScript(c, "GetSelectWndInfo(SelectWndInfo)", "GetSelectWndInfo(SelectWndInfo);"), S.createEventScript(c, "ZoomInfoCallback(szZoomInfo)", "ZoomInfoCallback(szZoomInfo);"), S.createEventScript(c, "GetHttpInfo(lID, lpInfo, lReverse)", "GetHttpInfo(lID, lpInfo, lReverse);"), S.createEventScript(c, "PluginEventHandler(iEventType, iParam1, iParam2)", "PluginEventHandler(iEventType, iParam1, iParam2);"), S.createEventScript(c, "RemoteConfigInfo(lID)", "RemoteConfigInfo(lID);"), S.createEventScript(c, "KeyBoardEventInfo(iKeyCode)", "KeyBoardEventInfo(iKeyCode);")), this
  3678. }(),
  3679. t = window.WebVideoCtrl = e;
  3680. t.version = "1.1.0"
  3681. }
  3682. }(this), "object" == typeof exports && "undefined" != typeof module || ("function" == typeof define && define.amd ? define(function() {
  3683. return WebVideoCtrl
  3684. }) : "function" == typeof define && define.cmd && define(function(e, t, n) {
  3685. n.exports = WebVideoCtrl
  3686. }));