4 lines
97 KiB
JavaScript
4 lines
97 KiB
JavaScript
|
!function(e){if(!e.WebVideoCtrl){var t=function(){function t(){this.id=this.createUUID()}var r="100%",s="100%",o="",i="",a={szContainerID:"",szColorProperty:"",szOcxClassId:"clsid:FDF0038A-CF64-4634-81AB-80F0A7946D6C",szMimeTypes:"application/webvideo-plugin-kit",szBasePath:"",iWndowType:1,iPlayMode:2,bWndFull:!0,iPackageType:2,bDebugMode:!1,bNoPlugin:!0,cbSelWnd:null,cbDoubleClickWnd:null,cbEvent:null,cbRemoteConfig:null,cbInitPluginComplete:null},c=null,u=0,l=!1,d=[],p=[],P=null,h=null,I=null,f=null,m=this,C=null,S=1,v=2,y=200,g=0,x=1,D=2,z=3,T=4,b=5,A=6,M=0,R=2,L=3,q=21,G=-1,W=0,X="IPCamera",w="IPDome",H="IPZoom",k="<?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>";e.GetSelectWndInfo=function(e){if(re()){u=e;var t=[];t.push("<RealPlayInfo>"),t.push("<SelectWnd>"+e+"</SelectWnd>"),t.push("</RealPlayInfo>"),a.cbSelWnd&&a.cbSelWnd(f.loadXML(t.join("")))}else{var r=f.loadXML(e);if(n.$XML(r).find("SelectWnd",!0).length>0){u=parseInt(n.$XML(r).find("SelectWnd").eq(0).text(),10),null===C&&U();var t=[];t.push("<RealPlayInfo>"),t.push("<SelectWnd>"+u+"</SelectWnd>"),t.push("</RealPlayInfo>"),a.cbSelWnd&&a.cbSelWnd(f.loadXML(t.join("")))}else if(n.$XML(r).find("DoubleClickWnd",!0).length>0){var s=parseInt(n.$XML(r).find("DoubleClickWnd").eq(0).text(),10);l="0"===n.$XML(r).find("IsFullScreen").eq(0).text(),a.cbDoubleClickWnd&&a.cbDoubleClickWnd(s,l)}}},e.WindowDblClick=function(e){l=e,a.cbDoubleClickWnd&&a.cbDoubleClickWnd(u,l)},e.ZoomInfoCallback=function(e){var t=m.findWndIndexByIndex(u);if(-1!=t){var n=p[t];if(t=m.findDeviceIndexByIP(n.szDeviceIdentify),-1!=t){var r=d[t];r.oProtocolInc.set3DZoom(r,n,e,{success:function(e){},error:function(){}})}}},e.PluginEventHandler=function(e,t,n){re()?a.cbEvent&&a.cbEvent(n,t,""):(_("插件事件:PluginEventHandler iEventType:%s iParam1: %s, iParam2: %s",e,t,n),M==e||R==e?m.I_Stop(t):q==e?m.I_StopRecord(t):L==e&&m.I_StopVoiceTalk(),a.cbEvent&&a.cbEvent(e,t,n))},e.GetHttpInfo=function(e,t,n){_("http响应返回:http状态:%s, http数据:%s",e,t),ue.prototype.processCallback(e,t)},e.RemoteConfigInfo=function(e){a.cbRemoteConfig&&a.cbRemoteConfig(e)},e.KeyBoardEventInfo=function(e){100===parseInt(e,10)&&(l=!1,a.cbDoubleClickWnd&&a.cbDoubleClickWnd(u,l))};var _=function(){if(a.bDebugMode){var e=E(arguments);P._alert(e)}},E=function(){for(var e=arguments[0],t=1;t<arguments.length;t++)e=e.replace("%s",arguments[t]);return e},Z=function(e){var t=e.indexOf(":");return t>-1?e.substring(0,t):e},B=function(e){return"undefined"==typeof e},N=function(e){return"[object Object]"===Object.prototype.toString.call(e)},F=function(){var e="";if(f.browser().msie)e="<object classid='"+a.szOcxClassId+"' codebase='' standby='Waiting...' id='"+o+"' width='"+r+"' height='"+s+"' align='center' ><param name='wndtype' value='"+a.iWndowType+"'><param name='playmode' value='"+a.iPlayMode+"'><param name='colors' value='"+a.szColorProperty+"'></object>";else for(var t=navigator.mimeTypes.length,n=0;t>n;n++)navigator.mimeTypes[n].type.toLowerCase()==a.szMimeTypes&&(e="<embed align='center' type='"+a.szMimeTypes+"' width='"+r+"' height='"+s+"' name='"+i+"' wndtype='"+a.iWndowType+"' playmode='"+a.iPlayMode+"' colors='"+a.szColorProperty+"'>");return e},U=function(){if(!re()&&null!==c){var e=c.HWP_GetLocalConfig();C=f.loadXML(e)}},V=function(e){m.I_GetDeviceInfo(e.szIP,{success:function(t){e.szDeviceType=n.$XML(t).find("deviceType").eq(0).text()}}),m.I_GetAnalogChannelInfo(e.szIP,{success:function(t){e.iAnalogChannelNum=n.$XML(t).find("VideoInputChannel",!0).length}}),m.I_GetAudioInfo(e.szIP,{success:function(t){var r=n.$XML(t).find("audioCompressionType",!0);if(r.length>0){var s=n.$XML(r).eq(0).text(),o=0;"G.711ulaw"==s?o=1:"G.711alaw"==s?o=2:"G.726"==s?o=3:"MP2L2"==s||"MPE
|
|||
|
},this.I_StopDownloadRecord=function(e){return re()?-1:c.HWP_StopDownload(e)},this.I_ExportDeviceConfig=function(e){var t=this.findDeviceIndexByIP(e),n=-1;if(-1!=t){var r=d[t];if(re())return n;n=r.oProtocolInc.exportDeviceConfig(r)}return n},this.I_ImportDeviceConfig=function(e,t){var n=this.findDeviceIndexByIP(e),r=-1;if(-1!=n){var s=d[n],o={szFileName:t};if(re())return r;r=s.oProtocolInc.importDeviceConfig(s,o)}return r},this.I_RestoreDefault=function(e,t,n){var r={success:null,error:null};f.extend(r,n);var s=this.findDeviceIndexByIP(e);if(-1!=s){var o=d[s];o.oProtocolInc.restore(o,t,r)}},this.I_Restart=function(e,t){var n=this.findDeviceIndexByIP(e),r={success:null,error:null};if(f.extend(r,t),-1!=n){var s=d[n];s.oProtocolInc.restart(s,r)}},this.I_Reconnect=function(e,t){var n=this.findDeviceIndexByIP(e),r={success:null,error:null};if(f.extend(r,t),-1!=n){var s=d[n];s.oProtocolInc.login(s.szIP,s.iCGIPort,s.szAuth,r)}},this.I_StartUpgrade=function(e,t){var n=this.findDeviceIndexByIP(e),r=-1;if(-1!=n){var s=d[n],o={szFileName:t};if(re())return r;r=s.oProtocolInc.startUpgrade(s,o)}return r},this.I_UpgradeStatus=function(){return re()?-1:c.HWP_UpgradeStatus()},this.I_UpgradeProgress=function(){return re()?-1:c.HWP_UpgradeProgress()},this.I_StopUpgrade=function(){return re()?-1:c.HWP_StopUpgrade()},this.I_CheckPluginInstall=function(){var e=-1,t=f.browser();if(re())e=0;else if(t.msie)try{new ActiveXObject("WebVideoKitActiveX.WebVideoKitActiveXCtrl.1");e=0}catch(n){}else for(var r=0,s=navigator.mimeTypes.length;s>r;r++)if("application/webvideo-plugin-kit"==navigator.mimeTypes[r].type.toLowerCase()){e=0;break}return e},this.I_CheckPluginVersion=function(){return re()?0:c.HWP_CheckPluginUpdate(k)?-1:0},this.I_SendHTTPRequest=function(e,t,n){var r=this.findDeviceIndexByIP(e);if(!(0>r)){var s=d[r],o=new ue,i=s.szHttpProtocol+s.szIP+":"+s.iCGIPort+"/"+t,a={type:"GET",url:i,auth:s.szAuth,success:null,error:null};f.extend(a,n),f.extend(a,{success:function(e){n.success&&n.success(e)},error:function(e,t){n.error&&n.error(e,t)}}),o.setRequestParam(a),o.submitRequest()}},this.I_RemoteConfig=function(e,t){var n=this.findDeviceIndexByIP(e),r=-1,s=-1;if(re())return r;var o={iLan:0,iDevicePort:-1,iType:0};if(f.extend(o,t),-1!=n){var i=d[n];if(-1==o.iDevicePort)if(-1==i.iDevicePort){if(i.iDevicePort=J(i).iDevicePort,s=i.iDevicePort,-1==s)return r}else s=i.iDevicePort;else s=o.iDevicePort;if(":"==f.Base64.decode(i.szAuth)[0])var a=f.Base64.decode(i.szAuth).split(":")[1],u=f.Base64.decode(i.szAuth).split(":")[2];else var a=f.Base64.decode(i.szAuth).split(":")[0],u=f.Base64.decode(i.szAuth).split(":")[1];var l="<RemoteInfo><DeviceInfo><DeviceType>"+o.iType+"</DeviceType><LanType>"+o.iLan+"</LanType><IP>"+i.szIP+"</IP><Port>"+s+"</Port><UName>"+a+"</UName><PWD>"+f.Base64.encode(u)+"</PWD></DeviceInfo></RemoteInfo>";return c.HWP_ShowRemConfig(l)}return r},this.I_ChangeWndNum=function(e){return isNaN(parseInt(e,10))?-1:(re()?c.JS_ArrangeWindow(e):c.HWP_ArrangeWindow(e),0)},this.I_GetLastError=function(){return re()?-1:c.HWP_GetLastError()},this.I_GetWindowStatus=function(e){if(B(e)){var t=[];return f.extend(t,p),t}var n=this.findWndIndexByIndex(e);if(-1!=n){var t={};return f.extend(t,p[n]),t}return null},this.I_GetIPInfoByMode=function(e,t,n,r){return re()?"":c.HWP_GetIpInfoByMode(e,t,n,r)},this.I_SetPlayModeType=function(e){return re()?-1:c.HWP_SetPlayModeType(e)},this.I_SetSnapDrawMode=function(e,t){return re()?-1:c.HWP_SetSnapDrawMode(e,t)},this.I_SetSnapPolygonInfo=function(e,t){if(re())return-1;var r,s,o,i,a,u,l,d,p,P,h,I,m,C=c.HWP_GetSnapPolygonInfo(e);r=f.loadXML(C),s=n.$XML(r).find("SnapPolygon",!0);var S=s.length,v=[];for(o=0,i=s.length;i>o;o++)a=s[o],v.push(n.$XML(a).find("id").eq(0).text());var y=v.join(",");if(y=","+y+",",r=f.loadXML(t),s=n.$XML(r).find("SnapPolygon",!0),S+s.length>32)return-3;for(o=0,i=s.length;i>o;o++){if(a=s[o],u=n.$XML(a).find("id").eq(0).text(),!f.isInt(u))return-2;if(l=parseInt(u,10),1>l||l>32)return-2;if(y.indexOf(","+u+",")>-1)return-4;if(d=n.$XML(a).find("tips").eq(0).text(),d.length>32)return-2;if(h="true"
|
|||
|
f.isInt(r.iResolutionHeight)&&i.push("videoResolutionHeight="+r.iResolutionHeight),i.length>0&&(o+="?"+i.join("&")),re()){var a=function(e,t){var n=".jpg";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};o=se(o),s=a(o,n)}else s=c.HWP_DeviceCapturePic(o,e.szAuth,n,r.bDateDir);return s},le.prototype.getSessionCap=function(e,t,n,r,s){var o="";o=2==t?"https://":"http://";var i=E(this.CGI.sessionCap,o,e,n,encodeURIComponent(r)),a=new ue,c={type:"GET",url:i,auth:"",success:null,error:null};f.extend(c,s),f.extend(c,{success:function(e){s.success&&s.success(e)},error:function(e,t){s.error&&s.error(e,t)}}),a.setRequestParam(c),a.submitRequest()},le.prototype.sessionLogin=function(e,t,r,s,o,i,a){var c="";c=2==t?"https://":"http://";var u=E(this.CGI.sessionLogin,c,e,r),l=n.$XML(i).find("sessionID").eq(0).text(),d=n.$XML(i).find("challenge").eq(0).text(),p=parseInt(n.$XML(i).find("iterations").eq(0).text(),10),P=!1,h="";n.$XML(i).find("isIrreversible",!0).length>0&&(P="true"===n.$XML(i).find("isIrreversible").eq(0).text(),h=n.$XML(i).find("salt").eq(0).text());var I="";if(P){I=f.sha256(s+h+o),I=f.sha256(I+d);for(var m=2;p>m;m++)I=f.sha256(I)}else{I=f.sha256(o)+d;for(var m=1;p>m;m++)I=f.sha256(I)}var C="<SessionLogin>";C+="<userName>"+f.escape(s)+"</userName>",C+="<password>"+I+"</password>",C+="<sessionID>"+l+"</sessionID>",C+="</SessionLogin>";var S=new ue,v={type:"POST",url:u,data:C,auth:"",success:null,error:null};f.extend(v,a),f.extend(v,{success:function(e){a.success&&a.success(e)},error:function(e,t){a.error&&a.error(e,t)}}),S.setRequestParam(v),S.submitRequest()},le.prototype.sessionHeartbeat=function(e,t){var n=E(this.CGI.sessionHeartbeat,e.szHttpProtocol,e.szIP,e.iCGIPort),r=new ue,s={type:"PUT",url:n,auth:e.szAuth,success:null,error:null};f.extend(s,t),f.extend(s,{success:function(e){t.success&&t.success(e)},error:function(e,n){t.error&&t.error(e,n)}}),r.setRequestParam(s),r.submitRequest()},le.prototype.sessionLogout=function(e,t){var n=E(this.CGI.sessionLogout,e.szHttpProtocol,e.szIP,e.iCGIPort),r=new ue,s={type:"PUT",url:n,auth:e.szAuth,success:null,error:null};f.extend(s,t),f.extend(s,{success:function(e){t.success&&t.success(e)},error:function(e,n){t.error&&t.error(e,n)}}),r.setRequestParam(s),r.submitRequest()},le.prototype.getSystemCapa=function(e,t){var n=E(this.CGI.systemCapabilities,e.szHttpProtocol,e.szIP,e.iCGIPort),r=new ue,s={type:"GET",url:n,auth:e.szAuth,success:null,error:null};f.extend(s,t),f.extend(s,{success:function(e){t.success&&t.success(e)},error:function(e,n){t.error&&t.error(e,n)}}),r.setRequestParam(s),r.submitRequest()};var de=function(){};de.prototype.CGI={login:"%s%s:%s/PSIA/Custom/SelfExt/userCheck",getAudioInfo:"%s%s:%s/PSIA/Custom/SelfExt/TwoWayAudio/channels",getDeviceInfo:"%s%s:%s/PSIA/System/deviceInfo",getAnalogChannelInfo:"%s%s:%s/PSIA/System/Video/inputs/channels",getDigitalChannel:"%s%s:%s/PSIA/Custom/SelfExt/ContentMgmt/DynVideo/inputs/channels",getDigitalChannelInfo:"%s%s:%s/PSIA/Custom/SelfExt/ContentMgmt/DynVideo/inputs/channels/status",getZeroChannelInfo:"%s%s:%s/PSIA/Custom/SelfExt/ContentMgmt/ZeroVideo/channels",getStreamChannels:{analog:"%s%s:%s/PSIA/Streaming/channels",digital:"%s%s:%s/PSIA/Custom/SelfExt/ContentMgmt/DynStreaming/channels"},getStreamDynChannels:"%s%s:%s/PSIA/Custom/SelfExt/ContentMgmt/DynStreaming/channels",startRealPlay:{channels:"%s%s:%s/PSIA/streaming/channels/%s",zeroChannels:"%s%s:%s/PSIA/Custom/SelfExt/ContentMgmt/ZeroStreaming/channels/%s"},startVoiceTalk:{open:"%s%s:%s/PSIA/Custom/SelfExt/TwoWayAudio/channels/%s/open",close:"%s%s:%s/PSIA/Custom/SelfExt/TwoWayAudio/channels/%s/close",audioData:"%s%s:%s/PSIA/Custom/SelfExt/TwoWayAudio/channels/%s/audioData"},ptzControl:"%s%s:%s/PSIA/PTZ/channels/%s/continuous",ptzAutoControl:"%s%s:%s/PSIA/Custom/SelfExt/PTZ/channels/%s/autoptz",setPreset:"%s%s:%s/PSIA/PTZ/channels/%s/presets/%s",goPreset:"%s%s:%s/PSIA/PTZ/channels/%s/presets/%s/goto",ptzFocus:"%s
|
|||
|
I=t(n(s,2)^n(s,13)^n(s,22),s&o^s&i^o&i),d=l,l=u,u=c,c=t(a,h),a=i,i=o,o=s,s=t(h,I);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(c,m[4]),m[5]=t(u,m[5]),m[6]=t(l,m[6]),m[7]=t(d,m[7])}return m}(function(e){for(var t=[],n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<24-n%32;return t}(e),8*e.length))},Pe.prototype.cookie=function(e,t,n){if(arguments.length>1&&(null===t||"object"!=typeof t)){if(n=this.extend({},n),null===t&&(n.expires=-1),"number"==typeof n.expires){var r=n.expires,s=n.expires=new Date;s.setDate(s.getDate()+r)}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("")}n=t||{};var o,i=n.raw?function(e){return e}:decodeURIComponent;return(o=new RegExp("(?:^|; )"+encodeURIComponent(e)+"=([^;]*)").exec(document.cookie))?i(o[1]):null},t.prototype.valueOf=function(){return this.id},t.prototype.toString=function(){return this.id},t.prototype.createUUID=function(){var e=new Date(1582,10,15,0,0,0,0),n=new Date,r=n.getTime()-e.getTime(),s="-",o=t.getIntegerBits(r,0,31),i=t.getIntegerBits(r,32,47),a=t.getIntegerBits(r,48,59)+"1",c=t.getIntegerBits(t.rand(4095),0,7),u=t.getIntegerBits(t.rand(4095),0,7),l=t.getIntegerBits(t.rand(8191),0,7)+t.getIntegerBits(t.rand(8191),8,15)+t.getIntegerBits(t.rand(8191),0,7)+t.getIntegerBits(t.rand(8191),8,15)+t.getIntegerBits(t.rand(8191),0,15);return o+s+i+s+a+s+c+u+s+l},t.getIntegerBits=function(e,n,r){var s=t.returnBase(e,16),o=new Array,i="",a=0;for(a=0;a<s.length;a++)o.push(s.substring(a,a+1));for(a=Math.floor(n/4);a<=Math.floor(r/4);a++)i+=o[a]&&""!=o[a]?o[a]:"0";return i},t.returnBase=function(e,t){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"];if(t>e)var r=n[e];else{var s=""+Math.floor(e/t),o=e-s*t;if(s>=t)var r=this.returnBase(s,t)+n[o];else var r=n[s]+n[o]}return r},t.rand=function(e){return Math.floor(Math.random()*e)},h=new le,I=new de,P=new pe,f=new Pe;var he=f.dateFormat(new Date,"yyyyMMddhhmmss");return o="webVideoCtrl"+he,i="webVideoCtrl"+he,"object"!=typeof e.attachEvent&&f.browser().msie&&(f.createEventScript(o,"GetSelectWndInfo(SelectWndInfo)","GetSelectWndInfo(SelectWndInfo);"),f.createEventScript(o,"ZoomInfoCallback(szZoomInfo)","ZoomInfoCallback(szZoomInfo);"),f.createEventScript(o,"GetHttpInfo(lID, lpInfo, lReverse)","GetHttpInfo(lID, lpInfo, lReverse);"),f.createEventScript(o,"PluginEventHandler(iEventType, iParam1, iParam2)","PluginEventHandler(iEventType, iParam1, iParam2);"),f.createEventScript(o,"RemoteConfigInfo(lID)","RemoteConfigInfo(lID);"),f.createEventScript(o,"KeyBoardEventInfo(iKeyCode)","KeyBoardEventInfo(iKeyCode);")),this}(),n=e.WebVideoCtrl=t;n.version="1.1.0"}}(this),"object"==typeof exports&&"undefined"!=typeof module||("function"==typeof define&&define.amd?define(function(){return WebVideoCtrl}):"function"==typeof define&&define.cmd&&define(function(e,t,n){n.exports=WebVideoCtrl}));
|