Commit a05fd9f5 authored by 李纪文's avatar 李纪文

feat: 视频增加海康ISC-RTSP更新直播流

parent 7f4e3168
import React from 'react';
import ReactDOM from 'react-dom';
import { updateStream } from './apis';
import CloudPlate from './components/CloudPlate';
import style from './App.less';
......@@ -36,11 +37,15 @@ class App extends React.Component {
}
}
componentDidMount() {
this.createAll();
this.jessibuca.on('pause', function (data) {
// console.log('pause:', data);
});
const { VideoInfo } = this.props;
switch (VideoInfo?.protocol) {
case '海康ISC-RTSP':
this.updateISCStream();
break;
default:
this.createAll();
break;
}
}
componentWillUnmount() {
this.destroy();
......@@ -223,11 +228,30 @@ class App extends React.Component {
}
toQueryString(obj) {
return Object.keys(obj)
.map(key => encodeURIComponent(key) + '=' + encodeURIComponent(obj[key]))
.join('&');
}
toQueryString(obj) {
return Object.keys(obj)
.map(key => encodeURIComponent(key) + '=' + encodeURIComponent(obj[key]))
.join('&');
}
updateISCStream() {
// 更新海康ISC-RTSP协议直播流
const { VideoInfo } = this.props;
const navigatorAgent = /(iPhone|iOS|Android|Windows Phone)/i.test(navigator?.userAgent);
const userInfo = localStorage.getItem("userInfo") ? JSON.parse(localStorage.getItem("userInfo")) : {};
const code = !navigatorAgent ? window?.globalConfig?.userInfo?.LocalSite || window?.globalConfig?.userInfo?.site || '' : userInfo?.localSite || userInfo?.LocalSite || '';
const data = {
id: VideoInfo.id,
siteCode: code,
};
updateStream(data)
.then((res) => {
this.createAll();
})
.catch((error) => {
this.createAll();
});
}
render() {
return <div className={style.root} ref={this.domRef}>{this.renderCheckedArr()}</div>;
......
......@@ -41,4 +41,13 @@ export function hiswsUrl(data) {
method: REQUEST_METHOD_POST,
data,
});
}
// 更新海康ISC-RTSP协议直播流
export function updateStream(data) {
return request({
url: `${baseURI}${CommonPath}/pandavms/camera/isc/updatestream`,
method: REQUEST_METHOD_POST,
data,
});
}
\ No newline at end of file
......@@ -72,6 +72,30 @@ const Demo1 = (props) => {
address: '172.16.19.2',
};
VideoParam1 = {
id: '1CD26291-A19B-4709-8AEB-94CFC01CABBE',
name: '回龙水厂_回龙药房及水池',
protocol: '海康ISC-RTSP',
username: '27565776',
password: '4HUFPqij3igUJ0xkQ2gm',
dataRate: 'Sub', // Main 主码流 Sub 子码流
pandavmsHost: 'ws://222.179.7.166:8200/',
address: '183.64.178.118',
gateway: true,
};
VideoParam1 = {
id: '28AC17B5-EE3D-404F-B897-EE83078A5794',
name: '回龙水厂_回龙球机',
protocol: '海康ISC-RTSP',
username: '27565776',
password: '4HUFPqij3igUJ0xkQ2gm',
dataRate: 'Sub', // Main 主码流 Sub 子码流
pandavmsHost: 'ws://222.179.7.166:8200/',
address: '183.64.178.118',
gateway: true,
};
/*{
id: '11F102BC-CE03-4E32-AE60-F297934DFE3F', // 398993BB-A795-4237-BE75-B6A7EC9D675
name: '琼海电信小区', // 设备名称
......@@ -147,7 +171,7 @@ const Demo1 = (props) => {
return () => {
console.log('销毁。。。。。。。。。。。。。。。。。。。。。。。。。');
stopVideo();
// stopVideo();
};
}, []);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment