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>
    
  • 相关阅读:
    Run Shell Commands in Python
    在Linux系统上查找文件
    Build a Beautiful oh-my-zsh Themes
    Build VM Cluster on CentOS Host
    色彩学笔记
    Pr PS 笔记
    pthread 笔记
    图片格式
    win DLL 笔记
    XVS 操作
  • 原文地址:https://www.cnblogs.com/kumukim/p/14388536.html
Copyright © 2011-2022 走看看