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>
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/258157.html
標籤:其他
下一篇:單片機事件架構
