GB28181流媒体服务搭建
搭建入口,解压启动即用:https://www.liveqing.com/docs/download/LiveGBS.html
JS调用遇到跨域解决示例
添加 xhrFields: { withCredentials: true},crossDomain: true,
$.ajax({
type: "GET",
url: "http://other-domain:10000/api/v1/login",
xhrFields: {
withCredentials: true
},
crossDomain: true,
data: {
username: 'test',
password: 'test'
},
success: function(data) {
console.log(data);
}
})
axios请求接口遇到跨域问题
添加 withCredentials: true
post请求
axios.post("http://ip:10000/api/v1/test", {
param1: 'test',
param2: 'test'
}, {
withCredentials: true
}).then(res => {
console.log(res)
}).catch(err => {
console.log(err);
})
get请求
axios.get("http://ip:10000/api/v1/test", {
params:{start:0,limit:10},
withCredentials: true
}).then(res => {
console.log(res)
}).catch(err => {
console.log(err);
})