Browse Source

解决冲突

dev_trial
wenlele 2 years ago
parent
commit
e9d8d1de7b
  1. 5
      code/VideoAccess-VCMP/api/.vscode/launch.json
  2. 18
      code/VideoAccess-VCMP/api/app/lib/controllers/status/alarm.js
  3. 23
      code/VideoAccess-VCMP/api/app/lib/controllers/status/push.js
  4. 11
      code/VideoAccess-VCMP/api/config.js
  5. 10
      code/VideoAccess-VCMP/web/client/assets/js/flv.min.js
  6. 3
      code/VideoAccess-VCMP/web/client/index.html
  7. 94
      code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlay.jsx
  8. 1
      code/VideoAccess-VCMP/web/package.json

5
code/VideoAccess-VCMP/api/.vscode/launch.json

@ -15,12 +15,13 @@
"args": [ "args": [
"-p 4000", "-p 4000",
"-f http://localhost:4000", "-f http://localhost:4000",
// "-g postgres://postgres:123@10.8.30.166:5432/video_access", "-g postgres://postgres:123@10.8.30.166:5432/video-access",
"-g postgres://postgres:123@10.8.30.166:5432/video_access-dev", // "-g postgres://postgres:123@10.8.30.166:5432/video_access-dev",
"--redisHost 10.8.30.112", "--redisHost 10.8.30.112",
"--redisPort 6379", "--redisPort 6379",
"--axyApiUrl http://127.0.0.1:4100", "--axyApiUrl http://127.0.0.1:4100",
"--iotAuthApi http://127.0.0.1:4200", "--iotAuthApi http://127.0.0.1:4200",
"--pomsApiUrl http://127.0.0.1:4600",
"--godUrl https://restapi.amap.com/v3", "--godUrl https://restapi.amap.com/v3",
"--godKey 21c2d970e1646bb9a795900dd00093ce", "--godKey 21c2d970e1646bb9a795900dd00093ce",
"--mqttVideoServer mqtt://10.8.30.71:30883", "--mqttVideoServer mqtt://10.8.30.71:30883",

18
code/VideoAccess-VCMP/api/app/lib/controllers/status/alarm.js

@ -63,14 +63,30 @@ async function record (ctx) {
} }
}) })
} else if (!isRestore) { } else if (!isRestore) {
const createTime = moment().format('YYYY-MM-DD HH:mm:ss');
alarmRes = await models.CameraStatusAlarm.create({ alarmRes = await models.CameraStatusAlarm.create({
statusId: statusRes.id, statusId: statusRes.id,
description, description,
createTime: moment().format('YYYY-MM-DD HH:mm:ss'), createTime: createTime,
serialNo, serialNo,
channelNo, channelNo,
platform, platform,
}) })
try {
ctx.app.fs.pomsRequest.post(`alarm/video/added_log`, {
data: {
serial_no: serialNo,
channel_no: channelNo,
create_time: createTime,
description: description,
status_id: statusRes.id,
}
})
} catch (error) {
ctx.fs.logger.error(` error: ${error}`);
}
} }
ctx.status = 204; ctx.status = 204;

23
code/VideoAccess-VCMP/api/app/lib/controllers/status/push.js

@ -122,6 +122,7 @@ async function edit (ctx) {
async function getStatusPushList (ctx) { async function getStatusPushList (ctx) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const sequelize = ctx.fs.dc.ORM;
const { userId, token } = ctx.fs.api const { userId, token } = ctx.fs.api
const { limit, page, orderBy, orderDirection, name, pushWay } = ctx.query const { limit, page, orderBy, orderDirection, name, pushWay } = ctx.query
@ -157,6 +158,7 @@ async function getStatusPushList (ctx) {
findOption.order = [ findOption.order = [
[orderBy || 'id', orderDirection || 'DESC'] [orderBy || 'id', orderDirection || 'DESC']
] ]
findOption.include = [ findOption.include = [
{ {
model: models.CameraStatusPushMonitor, model: models.CameraStatusPushMonitor,
@ -168,12 +170,6 @@ async function getStatusPushList (ctx) {
attributes: ['name'], attributes: ['name'],
}] }]
}, },
{
model: models.CameraStatusPushLog,
attributes: ['id'],
duplicating: false,
required: false,
},
{ {
model: models.CameraStatusPushReceiver, model: models.CameraStatusPushReceiver,
attributes: ['receiver'], attributes: ['receiver'],
@ -189,9 +185,22 @@ async function getStatusPushList (ctx) {
delete findOption.where.id delete findOption.where.id
const count = await models.CameraStatusPushConfig.count(findOption) const count = await models.CameraStatusPushConfig.count(findOption)
// 获取所有id
const pushLogCountRes = await models.CameraStatusPushLog.findAll({
attributes: [
'pushConfigId',
[sequelize.fn('COUNT', sequelize.col('id')), 'count']
],
where: {
pushConfigId: { $in: configIds }
},
group: ['pushConfigId']
})
for (let { dataValues: c } of configRes) { for (let { dataValues: c } of configRes) {
c.monitorCount = c.cameraStatusPushMonitors.length; c.monitorCount = c.cameraStatusPushMonitors.length;
c.logCount = c.cameraStatusPushLogs.length; let corLofCount = pushLogCountRes.find(p => p.dataValues.pushConfigId == c.id)
c.logCount = corLofCount ? corLofCount.dataValues.count : 0
delete c.cameraStatusPushLogs delete c.cameraStatusPushLogs
} }

11
code/VideoAccess-VCMP/api/config.js

@ -18,6 +18,7 @@ args.option('redisPswd', 'redisPassword');
args.option('axyApiUrl', '安心云 api'); args.option('axyApiUrl', '安心云 api');
args.option('iotAuthApi', 'IOT 鉴权 api'); args.option('iotAuthApi', 'IOT 鉴权 api');
args.option('pomsApiUrl', '运维平台 api')
args.option('godUrl', '高德地图API请求地址'); args.option('godUrl', '高德地图API请求地址');
args.option('godKey', '高德地图API key'); args.option('godKey', '高德地图API key');
@ -44,6 +45,8 @@ const IOTA_REDIS_SERVER_PWD = process.env.IOTA_REDIS_SERVER_PWD || flags.redisPs
const IOT_AUTH_API = process.env.IOT_AUTH_API || flags.iotAuthApi; const IOT_AUTH_API = process.env.IOT_AUTH_API || flags.iotAuthApi;
// 安心云api // 安心云api
const AXY_API_URL = process.env.AXY_API_URL || flags.axyApiUrl; const AXY_API_URL = process.env.AXY_API_URL || flags.axyApiUrl;
// 运维平台 api
const POMS_API_URL = process.env.POMS_API_URL || flags.pomsApiUrl;
// 高德地图的参数 // 高德地图的参数
const GOD_URL = process.env.GOD_URL || flags.godUrl || 'https://restapi.amap.com/v3'; const GOD_URL = process.env.GOD_URL || flags.godUrl || 'https://restapi.amap.com/v3';
@ -64,8 +67,9 @@ const CAMERA_PLAY_HLS_HOST = process.env.CAMERA_PLAY_HLS_HOST || flags.cameraPla
const CAMERA_PLAY_RTMP_HOST = process.env.CAMERA_PLAY_RTMP_HOST || flags.cameraPlayRtmpHost; const CAMERA_PLAY_RTMP_HOST = process.env.CAMERA_PLAY_RTMP_HOST || flags.cameraPlayRtmpHost;
const CAMERA_PLAY_RTSP_HOST = process.env.CAMERA_PLAY_RTSP_HOST || flags.cameraPlayRtspHost; const CAMERA_PLAY_RTSP_HOST = process.env.CAMERA_PLAY_RTSP_HOST || flags.cameraPlayRtspHost;
if (!IOT_VIDEO_ACCESS_DB || !IOTA_REDIS_SERVER_HOST || !IOTA_REDIS_SERVER_PORT || !GOD_KEY || !MQTT_VIDEO_SERVER || if (
!AXY_API_URL || !IOT_VIDEO_SERVER_URL || !IOT_AUTH_API || !IOT_VIDEO_ACCESS_DB || !IOTA_REDIS_SERVER_HOST || !IOTA_REDIS_SERVER_PORT || !GOD_KEY || !MQTT_VIDEO_SERVER ||
!AXY_API_URL || !IOT_VIDEO_SERVER_URL || !IOT_AUTH_API || !POMS_API_URL ||
!CAMERA_PLAY_WS_HOST || !CAMERA_PLAY_HTTP_FLV_HOST || !CAMERA_PLAY_HLS_HOST || !CAMERA_PLAY_RTMP_HOST || !CAMERA_PLAY_RTSP_HOST !CAMERA_PLAY_WS_HOST || !CAMERA_PLAY_HTTP_FLV_HOST || !CAMERA_PLAY_HLS_HOST || !CAMERA_PLAY_RTMP_HOST || !CAMERA_PLAY_RTSP_HOST
) { ) {
console.log('缺少启动参数,异常退出'); console.log('缺少启动参数,异常退出');
@ -136,6 +140,9 @@ const product = {
}, { }, {
name: 'axyRequest', name: 'axyRequest',
root: AXY_API_URL root: AXY_API_URL
}, {
name: 'pomsRequest',
root: POMS_API_URL
}, { }, {
name: 'godRequest', name: 'godRequest',
root: GOD_URL, root: GOD_URL,

10
code/VideoAccess-VCMP/web/client/assets/js/flv.min.js

File diff suppressed because one or more lines are too long

3
code/VideoAccess-VCMP/web/client/index.html

@ -5,10 +5,11 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width" /> <meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width" />
<meta content="upgrade-insecure-requests" http-equiv="Content-Security-Policy"> <!-- <meta content="upgrade-insecure-requests" http-equiv="Content-Security-Policy"> -->
<link rel="shortcut icon" href="/assets/images/favicon.ico"> <link rel="shortcut icon" href="/assets/images/favicon.ico">
<script src="/assets/js/jessibuca/jessibuca.js"></script> <script src="/assets/js/jessibuca/jessibuca.js"></script>
<script src="/assets/js/flv.min.js"></script>
<script src="https://lf1-cdn-tos.bytegoofy.com/obj/iconpark/icons_14797_10.b43556420cacd0119dedf94deff663bb.js"></script> <script src="https://lf1-cdn-tos.bytegoofy.com/obj/iconpark/icons_14797_10.b43556420cacd0119dedf94deff663bb.js"></script>
</head> </head>

94
code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlay.jsx

@ -9,7 +9,7 @@ import VideoHeader from './voiceHeader'
import VideoOperation from './videoOperation' import VideoOperation from './videoOperation'
import './videoPlay.less'; import './videoPlay.less';
import EZUIKit, { log } from 'ezuikit-js' import EZUIKit, { log } from 'ezuikit-js'
import { done } from "nprogress"; import flvjs from 'flv.js'
const timeFormat = 'YYYY-MM-DD HH:mm:ss' const timeFormat = 'YYYY-MM-DD HH:mm:ss'
const yingshiUrl = 'https://open.ys7.com/ezopen/h5/iframe' const yingshiUrl = 'https://open.ys7.com/ezopen/h5/iframe'
@ -26,7 +26,7 @@ const VideoPlay = ({ dispatch, actions,
global, global,
videoStyle, videoStyle,
changeData, changeData,
videoObj, // videoObj,
sizeWh, sizeWh,
slideDown, // slideDown, //
IsSize, //16:9 IsSize, //16:9
@ -69,7 +69,6 @@ const VideoPlay = ({ dispatch, actions,
iotVideoPlayServer, iotVideoPlayServer,
local, // local, //
}) => { }) => {
// console.log('1754', videoObj);
if (videoObj.type == 'yingshi') { if (videoObj.type == 'yingshi') {
videoObj = { videoObj = {
...videoObj, ...videoObj,
@ -119,7 +118,7 @@ const VideoPlay = ({ dispatch, actions,
const playState = useRef(false) // const playState = useRef(false) //
const yingshiPlayer = useRef(null) const yingshiPlayer = useRef(null)
const jessibucas = useRef(null) const jessibucas = useRef(null)
const flvPlayer = useRef()
useEffect(() => { useEffect(() => {
setRoll(false) setRoll(false)
@ -132,7 +131,6 @@ const VideoPlay = ({ dispatch, actions,
if (disappear || !videoMask) { if (disappear || !videoMask) {
let duration = moment.duration(videoAfter?.diff(videoFront))._data.milliseconds; let duration = moment.duration(videoAfter?.diff(videoFront))._data.milliseconds;
setTimeout(() => { setTimeout(() => {
// console.log(yingshiPlayer.current);
if (disappear || duration > 2000) { if (disappear || duration > 2000) {
setVideoMask(true) setVideoMask(true)
dispatch(openness.getErrorCode(videoObj.videoToken ? { status: numbers, platform: videoObj.type, token: videoObj.videoToken } : { status: numbers, platform: videoObj.type })).then((res) => { dispatch(openness.getErrorCode(videoObj.videoToken ? { status: numbers, platform: videoObj.type, token: videoObj.videoToken } : { status: numbers, platform: videoObj.type })).then((res) => {
@ -303,17 +301,26 @@ const VideoPlay = ({ dispatch, actions,
// window.addEventListener('resize', resize_); // // window.addEventListener('resize', resize_); //
// } // }
document.addEventListener("visibilitychange", function () {
const buffered = flvPlayer.current.buffered.end(0) - 0.1
if (buffered - flvPlayer.current.currentTime > 1) {
flvPlayer.current.currentTime = buffered
}
})
return () => { return () => {
if (jessibucas.current) { if (jessibucas.current) {
jessibucas.current.destroy() jessibucas.current.destroy()
// console.log(1111111111111111111111);
const bye = request.get(`${iotVideoServer}/api/gb28181/bye?id=${videoObj.topSerialNo}&channel=${videoObj.serialNo}`).then(v => { const bye = request.get(`${iotVideoServer}/api/gb28181/bye?id=${videoObj.topSerialNo}&channel=${videoObj.serialNo}`).then(v => {
// console.log(1231313123);
}) })
} }
if (yingshiPlayer.current && videoObj.type == 'yingshi') { if (yingshiPlayer.current && videoObj.type == 'yingshi') {
yingshiPlayer.current.stop() yingshiPlayer.current.stop()
} }
if (flvPlayer && flvPlayer.current) {
flvPlayer.current.destroy();
}
} }
}, []) }, [])
@ -372,7 +379,6 @@ const VideoPlay = ({ dispatch, actions,
const createPlay = async () => { const createPlay = async () => {
if (videoObj.type != 'yingshi') { if (videoObj.type != 'yingshi') {
// console.log(videoObj,iotVideoServer);
try { try {
// const inviteRes = await IotVideoServerRequest.get(VideoServeApi.invite, { // const inviteRes = await IotVideoServerRequest.get(VideoServeApi.invite, {
// id: '36011200002002021114', // id: '36011200002002021114',
@ -385,36 +391,55 @@ const VideoPlay = ({ dispatch, actions,
videoFront = new moment(); // videoFront = new moment(); //
const inviteRes_ = await request.get(`${iotVideoServer}/api/gb28181/invite?id=${videoObj.topSerialNo}&channel=${videoObj.serialNo}`).then((res) => { const inviteRes_ = await request.get(`${iotVideoServer}/api/gb28181/invite?id=${videoObj.topSerialNo}&channel=${videoObj.serialNo}`).then((res) => {
videoAfter = new moment(); // videoAfter = new moment(); //
console.log(11111, res)
}) })
} catch (error) { } catch (error) {
console.log(123151);
console.log(error.response); console.log(error.response);
} }
let $container = document.getElementById(containerId); let container = document.getElementById(containerId);
const jessibuca = new window.Jessibuca({ // 1
container: $container, // const jessibuca = new window.Jessibuca({
videoBuffer: 0.2, // // container: container,
isResize: false, // videoBuffer: 0.2, //
text: "", // isResize: false,
loadingText: "加载中", // text: "",
debug: false, // loadingText: "",
showBandwidth: false, // // debug: true,
operateBtns: { // showBandwidth: false, //
fullscreen: false, // operateBtns: {
screenshot: false, // fullscreen: false,
play: false, // screenshot: false,
audio: false, // play: false,
}, // audio: false,
forceNoOffscreen: false, // },
controlAutoHide: true, // forceNoOffscreen: false,
isNotMute: false, // controlAutoHide: true,
// isNotMute: false,
// });
// setjessibuca(jessibuca)
// jessibucas.current = jessibuca
// play({ jessibuca })
// 2
const flv = flvjs.createPlayer({
type: 'flv',
// url: 'ws://10.8.30.42:8081/jessica/34020000001110000001/34020000001310000001.flv',
url: `${iotVideoServer}/jessica/${videoObj.topSerialNo}/${videoObj.serialNo}.flv`,
isLive: true,
hasAudio: false,
hasVideo: true,
enableWorker: false,
enalleStashBuffer: true,
stashInitialSize: 128,
lazyLoadMaxDuration: 3 * 60,
seekType: 'range',
autoCleanupSourceBuffer: true,
}); });
setjessibuca(jessibuca) flv.attachMediaElement(container);
jessibucas.current = jessibuca flv.load();
play({ jessibuca }) flv.play();
flvPlayer.current = flv
} else { } else {
videoFront = new moment(); // videoFront = new moment(); //
const player = new EZUIKit.EZUIKitPlayer({ const player = new EZUIKit.EZUIKitPlayer({
@ -557,7 +582,12 @@ const VideoPlay = ({ dispatch, actions,
// style={{ pointerEvents: 'none' }} // style={{ pointerEvents: 'none' }}
// /> // />
} }
<div id={containerId} style={{ height: '100%', width: '100%', }}></div> {
videoObj.type == 'yingshi' ?
<div id={containerId} style={{ height: '100%', width: '100%', }}></div> :
<video id={containerId} style={{ height: '100%', width: '100%', }}></video>
}
{/* {videoMask ? <div style={{ height: '100%', width: '100%', position: 'absolute', top: '0', left: '0', backgroundColor: 'black', color: "red", }}><div style={{ position: 'absolute', top: 'calc(60%)', left: 0, zIndex: 99, textAlign: 'center', width: '100%' }}>{written}</div></div> : ''} */} {/* {videoMask ? <div style={{ height: '100%', width: '100%', position: 'absolute', top: '0', left: '0', backgroundColor: 'black', color: "red", }}><div style={{ position: 'absolute', top: 'calc(60%)', left: 0, zIndex: 99, textAlign: 'center', width: '100%' }}>{written}</div></div> : ''} */}
{/* 下方操作栏 */} {/* 下方操作栏 */}

1
code/VideoAccess-VCMP/web/package.json

@ -60,6 +60,7 @@
"copy-to-clipboard": "^3.3.1", "copy-to-clipboard": "^3.3.1",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"ezuikit-js": "^0.6.1", "ezuikit-js": "^0.6.1",
"flv.js": "^1.6.2",
"fs-web-server-scaffold": "^1.0.6", "fs-web-server-scaffold": "^1.0.6",
"koa-better-http-proxy": "^0.2.5", "koa-better-http-proxy": "^0.2.5",
"koa-proxy": "^1.0.0-alpha.3", "koa-proxy": "^1.0.0-alpha.3",

Loading…
Cancel
Save