大华视频实时调用视频

视频观看只能用360浏览器查看

webplugin.exe 在360浏览器中运行下列代码 就可以自动下载插件

<div id="login_install_dialog" class="malign-tl ">
  <div style="clear: both;zoom:1; border: 2px solid #373737;background: #D5D5D5;">
    <a id="login_btn_install" href="webplugin.exe" target="_download" onclick="instal()"
       style="background: rgb(255,0,0);">Instal</a>
    <a id="login_btn_cancel" href="javascript:;">Cancle</a>
  </div>
</div>
<div id="f_ocx" class="sbVideo malign-tl"></div>


<script>
 agent = navigator.userAgent.toLowerCase(),
 g_ocx,
 PLUGINS_CLASSID = '7F9063B6-E081-49DB-9FEC-D72422F2727F',
 VERSION_GUI = 'version=3,1,0,4', //注意:本地GUI上版本信息显示需要的字符串,修改版本的时候这个字符串也要修改
 Sys = {},
 isMac = navigator.userAgent.toLowerCase().indexOf("mac") != -1,
 ua = navigator.userAgent.toLowerCase(),
        s;
        (s = ua.match(/(msie\s|trident.*rv:)([\d.]+)/)) ? Sys.ie = s[2] :
        (s = ua.match(/firefox\/([\d.]+)/)) ? Sys.firefox = s[1] :
        (s = ua.match(/chrome\/([\d.]+)/)) ? Sys.chrome = s[1] :
        (s = ua.match(/opera.([\d.]+)/)) ? Sys.opera = s[1] :
        (s = ua.match(/version\/([\d.]+).*safari/)) ? Sys.safari = s[1] : 0;
 var PLUGINS_NAME = 'WebActiveEXE.Plugin.1';
var hasPlugin = checkPlugins();

var g_PlayTime;
var g_curSpeed = 4;//默认的正常速度
var htmlStChn1 = '';

/**
 * 检测浏览器是否存在视频插件
 * @return {Boolean}
 */
function checkPlugins(){
    var result;
    if (Sys.ie) {
        try {
            result = new ActiveXObject(PLUGINS_NAME);
            delete result;
        } catch (e) {
            return false;
        }
        return true;
    } else {
        navigator.plugins.refresh(false);
        result = navigator.mimeTypes["application/media-plugin-version-3.1.0.2"];
        return !!(result && result.enabledPlugin);
    }
}

function hideInstallDialog()
{
	document.getElementById('login_install_dialog').style.display = 'none';
	if(document.getElementById('username') && !g_isRemoteLogin)
	{
		if(document.getElementById('username').value != '')
		{
			document.getElementById('password').focus();
		}
		else
		{
			document.getElementById('username').focus();
		}
	}
}
function showInstallDialog()
{
	document.getElementById('login_install_dialog').style.display = '';
}
function instal(){
	hideInstallDialog();
	setTimeout('loadPlugins()',1000);
}
var mainOcxHtml = '';
if (Sys.ie)
{
	mainOcxHtml = '<object id="ocx" width="100%" height="100%" classid="CLSID:{'+PLUGINS_CLASSID+'}"codebase="/webrec.cab"></object>';
}
else
{
	mainOcxHtml = '<object id="ocx" width="100%" height="100%" type="application/media-plugin-version-3.1.0.2" VideoWindTextColor="9c9c9c" VideoWindBarColor="414141"></object>';
}

var handlerOcxEvents = {
	fireOcxEvent: function(jsonStr) {
		document.getElementById('downPos').value = jsonStr;
	}
}

function loadPlugins()
{
	if(checkPlugins())
	{
		hasPlugin = true;
		setTimeout('loadPageOcx()',2000);
	}
	else
	{
		setTimeout('loadPlugins()',1000);
	}
}

if (!hasPlugin )
{
	showInstallDialog();
}
else
{
	hideInstallDialog();
	loadPageOcx();
}

function loadPageOcx (){
		document.getElementById('f_ocx').innerHTML = mainOcxHtml;
		document.getElementById('Login').style.display = '';
		initPageOcx();

}

function initPageOcx() {
	g_ocx = document.getElementById('ocx');
	//g_ocx.AddEventListener('SetNetPlayRecordStatus', ShowRecInfo);
	g_ocx.AddEventListener('SetNetPlayFileInfo', ShowRecInfo);
	g_ocx.AddEventListener('NetPlayTimeInform', ShowPlayTime);
	g_ocx.AddEventListener('TransEvent', handlerOcxEvents.fireOcxEvent);
}

function RealPlay(){
	g_ocx.SetModuleMode(1); //监视模式
	g_ocx.ConnectRealVideo(0 ,1);
}

function ControlPtz(){
	g_ocx.ControlPtzEx(0, 1, 1, 8, 1, 0);
}

function LoginDevice(){
	var bRet = g_ocx.LoginDeviceEx("192.168.1.122",37777,"admin","zgsh666666", 0);
	console.info(bRet)
	if(bRet == 0){
		document.getElementById('LocalPlay').style.display = '';
		document.getElementById('Stop').style.display = '';
		document.getElementById('FullScreen').style.display = '';
		document.getElementById('Logout').style.display = '';
		document.getElementById('idQuery').style.display = '';
		document.getElementById('Ptzctrl').style.display = '';
		document.getElementById('Play').style.display = '';
	}
}

function LogoutDevice(){
	g_ocx.LogoutDevice();
	document.getElementById('Login').style.display = '';
	document.getElementById('PlayBack').style.display = 'none';
	document.getElementById('LocalPlay').style.display = 'none';
	document.getElementById('Stop').style.display = 'none';
	document.getElementById('FullScreen').style.display = 'none';
	document.getElementById('Play').style.display = 'none';
	document.getElementById('Logout').style.display = 'none';
	document.getElementById('PlayRec').style.display = 'none';
	document.getElementById('PauseRec').style.display = 'none';
	document.getElementById('FastPlay').style.display = 'none';
	document.getElementById('SlowPlay').style.display = 'none';
	document.getElementById('ShowPlayTime').style.display = 'none';
	document.getElementById('DwonLoadPos').style.display = 'none';
	document.getElementById('RecInfo').style.display = 'none';
}

function LocalPlay()
{
	g_ocx.QuickOperation(0);
}

function StopPlay()
{
	g_ocx.DisConnectRealVideo(0);
}

function FullScreen(){
	g_ocx.OnFullScreenClk();
}

function QueryRecord(){
	g_ocx.SetModuleMode(4);	//回放模式
	g_ocx.SetWinBindedChannel(1, 0, 63,64);
	g_ocx.SwitchMonth(2019,04,17);
	g_ocx.SwitchDay(2019,04,17);
	htmlStChn1 = '';
}

function PlayBack(){
	//ocx.SetSearchBeginTime('2019-4-13 00:00:00',true);
	g_ocx.PlayBackByTime(0, '01:00:00');
}

function FastPlay(){
	if(g_curSpeed >= 8){//达到最大速度以后再快放就回到正常速度,客户可以按照自己的意愿来处理此时是否灰显快放按钮
		g_curSpeed = 4;
	}
	else{
		g_curSpeed++;
	}
	ocx.SpeedPlayBack(g_curSpeed);
}

function SlowPlay(){
	if(g_curSpeed <= 0){//达到最小速度以后再慢放就回到正常速度,客户可以按照自己的意愿来处理此时是否灰显快放按钮
		g_curSpeed = 4;
	}
	else{
		g_curSpeed--;
	}
	ocx.SpeedPlayBack(g_curSpeed);
}

function Download(){
	g_ocx.DownloadRecordByTime(0, '2014-11-04 01:05:00','2014-11-04 01:18:00', 'C:\\RecordDownload', 'dav');
}

function PlayRec()
{
	g_ocx.PlayBack();
}

function PauseRec()
{
	g_ocx.PausePlayBack();
}

function ShowPlayTime(time)
{
	//时间的格式00020018|  |是通道分隔符
	g_PlayTime = time;
	document.getElementById('playtime').value = g_PlayTime;
}

function ShowRecInfo(nCh, strRecodInfo)
{
	document.getElementById('PlayBack').style.display = '';
	document.getElementById('PlayRec').style.display = '';
	document.getElementById('PauseRec').style.display = '';
	document.getElementById('FastPlay').style.display = '';
	document.getElementById('SlowPlay').style.display = '';
	document.getElementById('download').style.display = '';
	document.getElementById('RecInfo').style.display = '';
	document.getElementById('ShowPlayTime').style.display = '';
	document.getElementById('DwonLoadPos').style.display = '';
	g_PlayTime = "";
	var readtime = strRecodInfo.split(':');
	var num = readtime.length;
	for(var i=0; i<num ; i++){
		if(readtime[i]=='')
			continue;
		htmlStChn1 += '<li><a id="StChn'+(i)+'">' +'channel: '+nCh+' info: '+ readtime[i]+'</a></li>';
	}
	document.getElementById('RecInfoList').innerHTML = htmlStChn1;
}
</script>

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值