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. 96
      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": [
"-p 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-dev",
"-g postgres://postgres:123@10.8.30.166:5432/video-access",
// "-g postgres://postgres:123@10.8.30.166:5432/video_access-dev",
"--redisHost 10.8.30.112",
"--redisPort 6379",
"--axyApiUrl http://127.0.0.1:4100",
"--iotAuthApi http://127.0.0.1:4200",
"--pomsApiUrl http://127.0.0.1:4600",
"--godUrl https://restapi.amap.com/v3",
"--godKey 21c2d970e1646bb9a795900dd00093ce",
"--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) {
const createTime = moment().format('YYYY-MM-DD HH:mm:ss');
alarmRes = await models.CameraStatusAlarm.create({
statusId: statusRes.id,
description,
createTime: moment().format('YYYY-MM-DD HH:mm:ss'),
createTime: createTime,
serialNo,
channelNo,
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;

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

@ -122,6 +122,7 @@ async function edit (ctx) {
async function getStatusPushList (ctx) {
try {
const models = ctx.fs.dc.models;
const sequelize = ctx.fs.dc.ORM;
const { userId, token } = ctx.fs.api
const { limit, page, orderBy, orderDirection, name, pushWay } = ctx.query
@ -157,6 +158,7 @@ async function getStatusPushList (ctx) {
findOption.order = [
[orderBy || 'id', orderDirection || 'DESC']
]
findOption.include = [
{
model: models.CameraStatusPushMonitor,
@ -168,12 +170,6 @@ async function getStatusPushList (ctx) {
attributes: ['name'],
}]
},
{
model: models.CameraStatusPushLog,
attributes: ['id'],
duplicating: false,
required: false,
},
{
model: models.CameraStatusPushReceiver,
attributes: ['receiver'],
@ -189,9 +185,22 @@ async function getStatusPushList (ctx) {
delete findOption.where.id
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) {
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
}

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

@ -18,6 +18,7 @@ args.option('redisPswd', 'redisPassword');
args.option('axyApiUrl', '安心云 api');
args.option('iotAuthApi', 'IOT 鉴权 api');
args.option('pomsApiUrl', '运维平台 api')
args.option('godUrl', '高德地图API请求地址');
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;
// 安心云api
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';
@ -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_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 ||
!AXY_API_URL || !IOT_VIDEO_SERVER_URL || !IOT_AUTH_API ||
if (
!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
) {
console.log('缺少启动参数,异常退出');
@ -136,6 +140,9 @@ const product = {
}, {
name: 'axyRequest',
root: AXY_API_URL
}, {
name: 'pomsRequest',
root: POMS_API_URL
}, {
name: 'godRequest',
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 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">
<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>
</head>

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

@ -9,7 +9,7 @@ import VideoHeader from './voiceHeader'
import VideoOperation from './videoOperation'
import './videoPlay.less';
import EZUIKit, { log } from 'ezuikit-js'
import { done } from "nprogress";
import flvjs from 'flv.js'
const timeFormat = 'YYYY-MM-DD HH:mm:ss'
const yingshiUrl = 'https://open.ys7.com/ezopen/h5/iframe'
@ -26,7 +26,7 @@ const VideoPlay = ({ dispatch, actions,
global,
videoStyle,
changeData,
videoObj,
// videoObj,
sizeWh,
slideDown, //
IsSize, //16:9
@ -69,7 +69,6 @@ const VideoPlay = ({ dispatch, actions,
iotVideoPlayServer,
local, //
}) => {
// console.log('1754', videoObj);
if (videoObj.type == 'yingshi') {
videoObj = {
...videoObj,
@ -119,7 +118,7 @@ const VideoPlay = ({ dispatch, actions,
const playState = useRef(false) //
const yingshiPlayer = useRef(null)
const jessibucas = useRef(null)
const flvPlayer = useRef()
useEffect(() => {
setRoll(false)
@ -132,7 +131,6 @@ const VideoPlay = ({ dispatch, actions,
if (disappear || !videoMask) {
let duration = moment.duration(videoAfter?.diff(videoFront))._data.milliseconds;
setTimeout(() => {
// console.log(yingshiPlayer.current);
if (disappear || duration > 2000) {
setVideoMask(true)
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_); //
// }
document.addEventListener("visibilitychange", function () {
const buffered = flvPlayer.current.buffered.end(0) - 0.1
if (buffered - flvPlayer.current.currentTime > 1) {
flvPlayer.current.currentTime = buffered
}
})
return () => {
if (jessibucas.current) {
jessibucas.current.destroy()
// console.log(1111111111111111111111);
const bye = request.get(`${iotVideoServer}/api/gb28181/bye?id=${videoObj.topSerialNo}&channel=${videoObj.serialNo}`).then(v=>{
// console.log(1231313123);
const bye = request.get(`${iotVideoServer}/api/gb28181/bye?id=${videoObj.topSerialNo}&channel=${videoObj.serialNo}`).then(v => {
})
}
if (yingshiPlayer.current && videoObj.type == 'yingshi') {
yingshiPlayer.current.stop()
}
if (flvPlayer && flvPlayer.current) {
flvPlayer.current.destroy();
}
}
}, [])
@ -372,7 +379,6 @@ const VideoPlay = ({ dispatch, actions,
const createPlay = async () => {
if (videoObj.type != 'yingshi') {
// console.log(videoObj,iotVideoServer);
try {
// const inviteRes = await IotVideoServerRequest.get(VideoServeApi.invite, {
// id: '36011200002002021114',
@ -385,36 +391,55 @@ const VideoPlay = ({ dispatch, actions,
videoFront = new moment(); //
const inviteRes_ = await request.get(`${iotVideoServer}/api/gb28181/invite?id=${videoObj.topSerialNo}&channel=${videoObj.serialNo}`).then((res) => {
videoAfter = new moment(); //
console.log(11111, res)
})
} catch (error) {
console.log(123151);
console.log(error.response);
}
let $container = document.getElementById(containerId);
const jessibuca = new window.Jessibuca({
container: $container,
videoBuffer: 0.2, //
isResize: false,
text: "",
loadingText: "加载中",
debug: false,
showBandwidth: false, //
operateBtns: {
fullscreen: false,
screenshot: false,
play: false,
audio: false,
},
forceNoOffscreen: false,
controlAutoHide: true,
isNotMute: false,
let container = document.getElementById(containerId);
// 1
// const jessibuca = new window.Jessibuca({
// container: container,
// videoBuffer: 0.2, //
// isResize: false,
// text: "",
// loadingText: "",
// debug: true,
// showBandwidth: false, //
// operateBtns: {
// fullscreen: false,
// screenshot: false,
// play: false,
// audio: false,
// },
// forceNoOffscreen: 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)
jessibucas.current = jessibuca
play({ jessibuca })
flv.attachMediaElement(container);
flv.load();
flv.play();
flvPlayer.current = flv
} else {
videoFront = new moment(); //
const player = new EZUIKit.EZUIKitPlayer({
@ -557,7 +582,12 @@ const VideoPlay = ({ dispatch, actions,
// 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> : ''} */}
{/* 下方操作栏 */}

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

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

Loading…
Cancel
Save