{
+ console.log(sizeWh);
const [jessibuca, setjessibuca] = useState(null)
+ const [player, setPlayer] = useState(null)
const [isPlaying, setIsPlaying] = useState(false)
const [operationState, setoperationState] = useState()
const [voiceDisY, setVoiceDisY] = useState(0)
@@ -60,22 +76,27 @@ const VideoPlay = ({
const [histroyTime, setHistroyTime] = useState([])
const [histroyBegain, setHistroyBegain] = useState()
const [roll, setRoll] = useState()//滚动备注
- const [size, setSize] = useState(sizeWh) //视频本身和父级尺寸
+ const [photo, setPhoto] = useState(1)//滚动备注
+ const [size, setSize] = useState({ parentWidth: sizeWh?.parentWidth, parentHeight: sizeWh?.parentHeight, width: width || sizeWh?.parentWidth, height: height || sizeWh?.parentHeight }) //视频本身和父级尺寸
const [resolution, setResolution] = useState('sd') // 标清 sd 高清 hd
- // const [frequency, setFrequency] = useState(true)
+ const [videoMask, setVideoMask] = useState(true) // 标清 sd 高清 hd
// 标记萤石操作中,等待ifream返回信息后清空
const [yingshiPrepare, setYingshiPrepare] = useState('')
const operationRef = useRef(null)
+ const Begain = useRef()
+ const playBackTime = useRef([])
+ const quanp = useRef()
const processChangeTimeoutRef = useRef(null)
// 标记萤石操作中,等待ifream返回信息后清空
const yingshiPrepareRef = useRef(null)
+ const playState = useRef(false) //播放状态
useEffect(() => {
setRoll(false)
- }, [resolution]);
+ }, [resolution,]);
useEffect(() => {
@@ -83,14 +104,15 @@ const VideoPlay = ({
}, [changeData?.hdChecked])
const changeSelectState = (key) => {
- if (videoObj.type == 'yingshi' && yingshiPrepareRef.current) {
- return
- }
+ // if (videoObj.type == 'yingshi' && yingshiPrepareRef.current) {
+ // return
+ // }
const nextOperationState = JSON.parse(JSON.stringify(operationRef.current))
if (key == 'histroy' && nextOperationState.histroy.select) {
// 取消历史播放
setProcessDisX(0)
setHistroyTime([])
+ playBackTime.current = []
}
for (let k in nextOperationState) {
@@ -104,6 +126,7 @@ const VideoPlay = ({
if (operationRef.current.histroy.select && histroyTime.length == 0) {
setHistroyTime([moment().subtract(72, 'hours').format(timeFormat), moment().format(timeFormat)])
+ playBackTime.current = [moment().subtract(72, 'hours').format(timeFormat), moment().format(timeFormat)]
}
setoperationState(nextOperationState)
}
@@ -124,14 +147,20 @@ const VideoPlay = ({
}, {
key: 'fullScreen',
click: () => {
- if (yingshiPrepareRef.current) {
- return
- }
changeSelectState('fullScreen')
- let player = document.getElementById('vcmp_videoplay')
- console.log(player);
+ let videoplay = document.getElementById('vcmp_videoplay')
if (screenfull.isEnabled) {
- screenfull.toggle(player);
+ screenfull.toggle(videoplay);
+ if (videoObj?.type == 'yingshi') {
+ console.log(operationRef.current);
+ if (operationRef.current?.fullScreen.select) {
+ player.reSize(screen.width, screen.height);
+ } else {
+ player.reSize(size?.width, size?.height);
+ }
+ }
+
+
}
}
}, {
@@ -139,18 +168,21 @@ const VideoPlay = ({
hide: !Boolean(videoObj.replayUrl),
click: () => {
changeSelectState('histroy')
- yingshiPrepareRef.current = 'play'
- setYingshiPrepare('play')
+ player.stop().then(() => {
+ if (operationRef.current?.histroy?.select && Begain.current) {
+ player.play({ url: `${videoObj.replayUrl}?begin=${moment(Begain.current).format("YYYYMMDDHHmmss")}&end=${moment(playBackTime.current[1]).format("YYYYMMDDHHmmss")}` })
+ }
+ playState.current = false
+ })
}
},]
+ // useEffect(() => {
+ // createPlay()
+ // }, [quanp.current])
+
useEffect(() => {
- if (videoObj.type == 'yingshi') {
- yingshiPrepareRef.current = 'play'
- setYingshiPrepare('play')
- } else {
- createJessibuca()
- }
+ createPlay()
let nextOperationState = {}
for (let p of operation) {
nextOperationState[p.key] = {
@@ -169,46 +201,40 @@ const VideoPlay = ({
changeSelectState('fullScreen')
}
});
-
- // 萤石 ifream 信息监听
- const listenYingshiMessage = async (e) => {
- const { data, origin } = e
- if (origin !== 'https://open.ys7.com') return
- if (data.type == "handleSuccess") {
- setRoll(true)
- if (yingshiPrepareRef.current == 'play') {
- setIsPlaying(true)
- }
- } else if (data.type == yingshiOpenSoundKey && data.code == 0) {
- if (yingshiPrepareRef.current == yingshiOpenSoundKey) {
- setVoiceDisY(30)
- }
- } if (data.type == yingshiCloseSoundKey && data.code == 0) {
- if (yingshiPrepareRef.current == yingshiCloseSoundKey) {
- setVoiceDisY(0)
- }
- }
- yingshiPrepareRef.current = null
- setYingshiPrepare(null)
- }
- if (videoObj.type == 'yingshi') {
- window.addEventListener('message', listenYingshiMessage);
- }
+ // const resize_ = () => {
+ // const VideoLocal = document.getElementById('vcmp_videoplay')
+ // setSize({ parentWidth: VideoLocal?.clientWidth, parentHeight: VideoLocal?.clientHeight, width: VideoLocal?.clientWidth, height: VideoLocal?.clientHeight })
+
+ // }
+ // if (local) {
+ // window.addEventListener('resize', resize_); //只要窗口殴大小发生像素变化就会触发
+ // }
return () => {
- window.removeEventListener('message', listenYingshiMessage);
+ if (jessibuca) {
+ jessibuca.destroy()
+ }
+ if (player && videoObj.type == 'yingshi' && player) {
+ console.log(11111111111);
+ player.stop()
+ }
+ // if (local) {
+ // window.removeEventListener('resize', resize_);
+ // }
}
}, [])
useEffect(() => {
if (histroyTime.length) {
setHistroyBegain(histroyTime[0])
+ Begain.current = histroyTime[0]
document.getElementById('process_point').style.left = 0 + 'px'; // 重置进度条的位置
if (videoObj.type == 'yingshi') {
- yingshiPrepareRef.current = 'play'
- setYingshiPrepare('play')
+ // yingshiPrepareRef.current = 'play'
+ // setYingshiPrepare('play')
}
} else {
setHistroyBegain(null)
+ Begain.current == null
}
}, [histroyTime])
useEffect(() => {
@@ -227,19 +253,32 @@ const VideoPlay = ({
)
.format(timeFormat)
)
+ Begain.current = moment(histroyTime[0])
+ .add(
+ Math.abs(moment(histroyTime[0]).diff(moment(histroyTime[1]), 'seconds')) * (processDisX / document.getElementById('process_point').parentElement.offsetWidth),
+ 'second'
+ )
+ .format(timeFormat)
if (videoObj.type == 'yingshi') {
- yingshiPrepareRef.current = 'play'
- setYingshiPrepare('play')
+ // yingshiPrepareRef.current = 'play'
+ // setYingshiPrepare('play')
}
}, 300)
+
+ player.stop().then(() => {
+ player.play({ url: `${videoObj.replayUrl}?begin=${moment(Begain.current).format("YYYYMMDDHHmmss")}&end=${moment(playBackTime.current[1]).format("YYYYMMDDHHmmss")}` })
+ playState.current = false
+ })
} else {
// 随播放时间变化更新进度条
document.getElementById('process_point').style.left = processDisX - 4.5 + 'px'
}
+
}
}, [processDisX])
- const createJessibuca = async () => {
+ const createPlay = async () => {
+ console.log(size);
if (videoObj.type != 'yingshi') {
try {
// const inviteRes = await IotVideoServerRequest.get(VideoServeApi.invite, {
@@ -247,11 +286,11 @@ const VideoPlay = ({
// channel: '36011200581314002900'
// }).then(res => {
// console.log(res);
- // }, err => {
+ // }, err => {.
// console.log(err);
// })
- const inviteRes_ = await request.get(`${iotVideoServer}/api/gb28181/invite?id=${videoObj.topSerialNo}&channel=${videoObj.serialNo}`)
+ const inviteRes_ = await request.get(`${iotVideoServer}/api/gb28181/invite?id=${videoObj.topSerialNo}&channel=${videoObj.serialNo}`)
} catch (error) {
console.log(error.response);
}
@@ -277,17 +316,29 @@ const VideoPlay = ({
});
setjessibuca(jessibuca)
play({ jessibuca })
+ } else {
+ const player = new EZUIKit.EZUIKitPlayer({
+ id: containerId, // 视频容器ID
+ accessToken: videoObj?.yingshiToken,
+ url: videoObj.playUrlSd,
+ width: size?.width,
+ height: size?.height,
+ handleSuccess: () => { //播放成功
+ setRoll(true)
+ setVideoMask(false)
+ playState.current = true
+ },
+ handleError: (e) => { //播放失败
+ console.log(e, '播放失败');
+ },
+ })
+ setPlayer(player)
}
}
- const yingshiOperation = (operation) => {
- document.getElementById(containerId).contentWindow.postMessage(operation, yingshiUrl)
- // setIsPlaying(operation == 'play')
- }
-
const play = (params) => {
if (videoObj.type == 'yingshi') {
- yingshiOperation('play')
+
} else if ((params.jessibuca || jessibuca) && videoObj.playUrlSd) {
const jes = params.jessibuca || jessibuca
jes.play(videoObj.playUrlSd);
@@ -296,8 +347,8 @@ const VideoPlay = ({
}
const pause = () => {
- if (videoObj.type == 'yingshi') {
- // yingshiOperation('stop')
+ if (videoObj.type == 'yingshi' && player) {
+ 5
} else if (jessibuca) {
jessibuca.pause();
setIsPlaying(false)
@@ -308,7 +359,7 @@ const VideoPlay = ({
if (videoObj.type == 'yingshi') {
yingshiPrepareRef.current = yingshiCloseSoundKey
setYingshiPrepare(yingshiCloseSoundKey)
- yingshiOperation(yingshiCloseSoundKey)
+ // yingshiOperation(yingshiCloseSoundKey)
}
}
@@ -316,92 +367,94 @@ const VideoPlay = ({
if (videoObj.type == 'yingshi') {
yingshiPrepareRef.current = yingshiOpenSoundKey
setYingshiPrepare(yingshiOpenSoundKey)
- yingshiOperation(yingshiOpenSoundKey)
+ // yingshiOperation(yingshiOpenSoundKey)
}
}
useEffect(() => {
- if (local) {
- //弹框视频自适应
- const VideoLocal = document.getElementById('video_local')
- setSize({ parentWidth: VideoLocal?.clientWidth, parentHeight: '100%', width: width, height: height })
- } else {
- setSize(sizeWh)
- }
- }, [sizeWh])
- useEffect(() => {
- if (size?.width || size?.height) {
- // if (size?.parentWidth >= size?.width && size?.parentHeight >= size?.height) {
- if (size?.width && size?.height) {
- if (size?.height / size?.width < 0.55 || size?.height / size?.width > 0.57) {
- if (size?.width / 16 > size?.height / 9) {
- setSize({ ...size, width: (size?.height / 9) * 16, })
- } else {
- setSize({ ...size, height: (size?.width / 16) * 9 })
- }
- }
- } else if (size?.width) {
- setSize({ ...size, height: (size?.width / 16) * 9, })
- } else if (size?.height) {
- setSize({ ...size, width: (size?.height / 9) * 16, })
- }
- // } else {
- // setSize({ ...size, width: size?.parentWidth, height: size?.parentHeight })
- // }
- } else {
- if (size && size?.width / 16 > size?.height / 9) {
- setSize({ ...size, height: size?.parentHeight })
- } else {
- setSize({ ...size, width: size?.parentWidth, })
+ if (!operationRef.current?.fullScreen.select) {
+ setSize({ parentWidth: sizeWh?.parentWidth, parentHeight: sizeWh?.parentHeight, width: width || sizeWh?.parentWidth, height: height || sizeWh?.parentHeight })
+ if (videoObj.type == 'yingshi' && player && IsSize == !'true') {
+ console.log(11111111111);
+ player.stop().then(() => {
+ player.play().then(() => {
+ player.reSize(width || sizeWh?.parentWidth, height || sizeWh?.parentHeight)
+ })
+
+ })
+
}
}
- }, [size])
+ }, [sizeWh])
+
+ // useEffect(() => {
+ // if (IsSize == 'true') {
+ // console.log(size?.parentWidth >= size?.width && size?.parentHeight >= size?.height);
+ // if (size?.parentWidth >= size?.width && size?.parentHeight >= size?.height) {
+ // if (size?.height / size?.width >= 0.55 && size?.height / size?.width <= 0.57) {
+
+ // } else {
+ // console.warn('宽高不符合尺寸要求,故返回合适的尺寸')
+ // if (size?.width / 16 > size?.height / 9) {
+ // setSize({ ...size, width: (size?.height / 9) * 16, })
+ // } else {
+ // setSize({ ...size, height: (size?.width / 16) * 9 })
+ // }
+ // }
+ // } else {
+ // console.warn('传递宽高参数有误,请确认容器大小范围内')
+ // if (size?.parentWidth / 16 > size?.parentHeight / 9) {
+ // setSize({ ...size, width: (size?.parentHeight / 9) * 16, height: size?.parentHeight })
+ // } else {
+ // setSize({ ...size, width: size?.parentWidth, height: (size?.parentWidth / 16) * 9 })
+ // }
+ // }
+ // }
+ // }, [sizeWh])
return (
<>
-
-
+
+
{/* 顶部信息 */}
- {
320 ? }
+ player={player}
+ resolution={resolution}
+ playState={playState.current}
+ /> : ""}
{/* 视频内容 */}
- {videoObj.type == 'yingshi' ?
- :
-
-
+ {
+ //
}
+
+ {videoMask ? hhktyjr6tyr5
: ''}
+
{/* 下方操作栏 */}
{/* 显示操作功能条件(宽高) */}
- {size?.parentWidth > 400 ?
+ {size?.parentWidth > 320 ?
: ""
}
diff --git a/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlayModal.jsx b/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlayModal.jsx
index a0064be..e620b4f 100644
--- a/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlayModal.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlayModal.jsx
@@ -20,15 +20,17 @@ const VideoPlayModal = ({ visible, close, videoObj, name }) => {
>
+ local={true}
+ // IsSize='true' //是否全屏
+ />
)
diff --git a/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/voiceHeader.jsx b/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/voiceHeader.jsx
index 6579ef7..ce04cb2 100644
--- a/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/voiceHeader.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/voiceHeader.jsx
@@ -5,14 +5,14 @@ import { Col, Row, } from "@douyinfe/semi-ui";
import { IconReply } from '@douyinfe/semi-icons';
import TextScroll from '../textScroll'
import './videoPlay.less';
+import { log } from "ezuikit-js";
const timeFormat = 'YYYY-MM-DD HH:mm:ss'
-const VideoHeader = ({ operationState, changeSelectState, setProcessDisX, name, showTime, histroyTime, content, roll, videoStyle }) => {
+const VideoHeader = ({ operationState, changeSelectState, setProcessDisX, name, videoObj, showTime, histroyTime, content, roll, videoStyle, player, resolution, playState }) => {
const time = useRef(moment(showTime || undefined))
const upTimeInterval = useRef(null)
const [showTime_, setShowTime] = useState(' ')
-
const updateTime = () => {
if (!showTime) {
setShowTime('')
@@ -59,7 +59,7 @@ const VideoHeader = ({ operationState, changeSelectState, setProcessDisX, name,
{roll ?
42 ? 42 : vcmp_videoplay * 0.12 < 30 ? 30 : vcmp_videoplay * 0.12}px`, background: videoStyle == 'true' ? '#467ACD' : '#00000026', maxHeight: 42, minHeight: 30,
- position: 'absolute', width: '100%', zIndex: 99,
+ position: 'absolute', width: '100%', zIndex: 80,
color: '#fff'
}}>
@@ -74,6 +74,20 @@ const VideoHeader = ({ operationState, changeSelectState, setProcessDisX, name,
<>
{
changeSelectState('histroy')
+ if (playState) {
+ player.stop().then(() => {
+ if (resolution == 'sd') {
+ player.play({ url: videoObj?.playUrlSd, })
+ } else {
+ player.play({ url: videoObj?.playUrlHd, })
+ }
+ playState = false
+ })
+ } else {
+ player.play({ url: resolution == 'sd' ? videoObj?.playUrlSd : videoObj?.playUrlHd, })
+ }
+
+
}} />
> : ''
}
@@ -81,7 +95,7 @@ const VideoHeader = ({ operationState, changeSelectState, setProcessDisX, name,
-
+ {content ? : ""}
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cascadeCamera.jsx b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cascadeCamera.jsx
index 759ff45..681031a 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cascadeCamera.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cascadeCamera.jsx
@@ -238,13 +238,13 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes
{sip.map((item, index) => (
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/camera.jsx b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/camera.jsx
index 5e0a0e9..043fd55 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/camera.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/camera.jsx
@@ -239,7 +239,6 @@ const CameraHeader = (props) => {
})
}
setVideoPlay(true)
-
}}
>
播放
diff --git a/code/VideoAccess-VCMP/web/client/src/sections/monitor/containers/videoPlayCross.jsx b/code/VideoAccess-VCMP/web/client/src/sections/monitor/containers/videoPlayCross.jsx
index 21b60f0..3a274cd 100644
--- a/code/VideoAccess-VCMP/web/client/src/sections/monitor/containers/videoPlayCross.jsx
+++ b/code/VideoAccess-VCMP/web/client/src/sections/monitor/containers/videoPlayCross.jsx
@@ -35,18 +35,7 @@ const VideoPlayCross = (props) => {
}
const resize_ = () => {
const params = qs.parse(props.location.search.slice(1))
- // if (params.local) {
- // //弹框视频自适应
- // const VideoLocal = document.getElementById('video_local')
- // setSizeWh({ parentWidth: VideoLocal?.clientWidth, parentHeight: '100%', width: width, height: height })
- // } else {
- if (params?.width || params?.height) {
- setSizeWh({ parentWidth: document.body.clientWidth, parentHeight: document.body.clientHeight, width: params.width, height: params.height })
- } else {
- setSizeWh({ parentWidth: document.body.clientWidth, parentHeight: document.body.clientHeight, width: document.body.clientWidth, height: document.body.clientHeight })
- }
- // }
-
+ setSizeWh({ parentWidth: document.body.clientWidth, parentHeight: document.body.clientHeight, width: params.width || document.body.clientWidth, height: params.height || document.body.clientHeight })
}
resize_()
if (window.parent) {
diff --git a/code/VideoAccess-VCMP/web/package.json b/code/VideoAccess-VCMP/web/package.json
index 23aa269..224ad8d 100644
--- a/code/VideoAccess-VCMP/web/package.json
+++ b/code/VideoAccess-VCMP/web/package.json
@@ -7,7 +7,7 @@
"test": "mocha",
"start-vite": "cross-env NODE_ENV=developmentVite npm run start-params",
"start": "cross-env NODE_ENV=development npm run start-params",
- "start-params": "node server -p 5000 -u http://10.8.30.7:4000 --apiVcmpUrl http://localhost:4000 --apiAuthUrl http://10.8.30.7:4200 --apiAnxinyunUrl http://10.8.30.7:4100 --iotAuthWeb http://localhost:5200 --iotVideoServer http://221.230.55.27:8081",
+ "start-params": "node server -p 5000 -u http://10.8.30.29:4000 --apiVcmpUrl http://localhost:4000 --apiAuthUrl http://10.8.30.29:4200 --apiAnxinyunUrl http://10.8.30.29:4100 --iotAuthWeb http://localhost:5200 --iotVideoServer ws://221.230.55.27:8081",
"deploy": "export NODE_ENV=production&& npm run build && node server",
"build-dev": "cross-env NODE_ENV=development&&webpack --config webpack.config.js",
"build": "export NODE_ENV=production&&webpack --config webpack.config.prod.js"
@@ -59,6 +59,7 @@
"babel-polyfill": "^6.26.0",
"copy-to-clipboard": "^3.3.1",
"cross-env": "^7.0.3",
+ "ezuikit-js": "^0.6.1",
"fs-web-server-scaffold": "^1.0.6",
"koa-better-http-proxy": "^0.2.5",
"koa-proxy": "^1.0.0-alpha.3",