zoukankan      html  css  js  c++  java
  • LiveNVR监控RTSP web浏览器直播中集成开发jquery调用示例

    Onvif|RTSP流媒体服务

    搭建入口,解压启动即用:https://www.liveqing.com/docs/download/LiveNVR.html

    二次开发中如何调用接口

    下面是完整的 jquery 调用示例

    <html>
    <head>
        <title>LiveNVR 接口调用示例</title>
       <script src="jquery-2.2.4.js"></script>
    </head>
    <body>
    </body>
    <script>
    	 $.ajax({
            url: "http://nvr.liveqing.com:10800/api/v1/login",
            type: 'GET',
    		data: {
    			username:"test",
    			password:"098f6bcd4621d373cade4e832627b4f6"
    		},
    		xhrFields: { 
    			withCredentials: true
    		},
    		crossDomain: true, 
            success: function (ret) {
    			console.log(ret)
    			var token = ret.LiveQing.Body.Token;
    			alert(token)
    			getchannels(token)
            },
    		error: function(xhr,textStatus,errorThrown){
             alert(xhr.status)
    		}
    	 }
    	);
    	
    	
    	<!--携带token调用其他接口示例 -->	
    	function getchannels(token) {
    		$.ajax({
            url: "http://nvr.liveqing.com:10800/api/v1/getchannels",
            type: 'GET',
    		data: {
    			start:0,
    			limit:10
    		},
    		xhrFields: { 
    			withCredentials: true
    		},
    		crossDomain: true, 
            beforeSend: function (xhr) {
                xhr.setRequestHeader("cookie", "token="+token);
            },
            success: function (ret) {
    			console.log(ret)
    			alert(JSON.stringify(ret));
            },
    		error: function(xhr,textStatus,errorThrown){
             alert(xhr.status)
    		}
    	 }
    	);
    	}
    
    </script>
    </html>
    
  • 相关阅读:
    SDOI2019游记
    noi.ac309 Mas的童年
    51nod1237 最大公约数之和
    loj6074 子序列
    noi.ac89A 电梯
    51nod97B 异或约束和
    bzoj4490 随机数生成器Ⅱ加强版
    CF55D Beautiful numbers
    CF24D Broken robot
    CF226D The table
  • 原文地址:https://www.cnblogs.com/kumukim/p/14388536.html
Copyright © 2011-2022 走看看