日期:2014-05-19 浏览次数:20674 次
<HTML> <HEAD> <TITLE>视频调用</TITLE> <script language="javascript" for="NVS5000" event="OnLoginNVSResult(nResult)"> //ocx对象的OnLoginNVSResult事件触发时 OnLoginNVS(nResult); </script> <script type="text/javascript" language="javascript"> function $() { var elements = new Array(); for (var i = 0; i < arguments.length; i++) { var element = arguments[i]; if (typeof element == 'string') { element = document.getElementById(element); } if (arguments.length == 1) { return element; } elements.push(element); } return elements; } //初始化方法 function init() { try{ //为ocx对象属性赋值 $("NVS5000").URL = "192.168.15.153"; //前端设备地址 $("NVS5000").Port = 5200; //端口号 $("NVS5000").NVSName = "NVS"; $("NVS5000").UserName = "admin"; //用户名 $("NVS5000").UserPswd = "admin"; //密码 $("NVS5000").SetLoginMode(1); //设置登录模式 $("NVS5000").Tips_Off(); $("NVS5000").AlarmBox_Off(); $("NVS5000").FullWnd_Off(); $("NVS5000").SocketProtocol=0; //设置套接字协议 $("NVS5000").ChannelNum= 0; //频道号 //登录前端设备 $("NVS5000").LoginNVS(); //浏览器状态显示 window.status = $("NVS5000").URL+":"+$("NVS5000").Port+" , Account:"+$("NVS5000").UserName+"/"+$("NVS5000").UserPswd; }catch(e){} } //登录时触发方法 function OnLoginNVS(nResult) { try{ if(nResult < 2) { switch(nResult) { case -1: window.status = " 操作失败!"; break; case -2: window.status = " 请求被拒绝!"; break; case -3: window.status = " 登录用户已满!"; break; case -4: window.status = " 用户名或密码和系统不匹配!"; break; case -5: window.status = " 已经关闭IE!"; break; case -6: window.status = " 连接DDNS失败!"; break; case -7: window.status = " 获取设备信息失败!"; break; default: window.status = " 其他未知错误! " + nResult; break; } return false; }else{ //启动视频 $("NVS5000").StartView(); } }catch(e){} } </script> </HEAD> <BODY onLoad="init()"> <object name="NVS5000" ID="NVS5000" width="705" height="570" CLASSID="CLSID:08353A15-031B-4FE1-9BF5-5B4F721BA61A"> </object> </BODY> </HTML>
package com.mdbq.jni; import com.jacob.activeX.ActiveXComponent; import com.jacob.com.ComThread; import com.jacob.com.Dispatch; import com.jacob.com.Variant; public class XDViewDemo { public static void main(String[] args) { //初始化线程 ComThread.InitSTA();