Browse Source

Merge branch 'dev_trial' of https://gitea.anxinyun.cn/free-sun/FS-IOT into dev_trial

release_1.1.2
巴林闲侠 2 years ago
parent
commit
98dcbe6308
  1. 27
      code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoOperation.jsx
  2. 169
      code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoOperationHistroyTime.jsx
  3. 1
      code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoOperationTalk.jsx
  4. 342
      code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlay.jsx
  5. 12
      code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlayModal.jsx
  6. 22
      code/VideoAccess-VCMP/web/client/src/components/videoPlayer/voiceHeader.jsx
  7. 6
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cascadeCamera.jsx
  8. 1
      code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/camera.jsx
  9. 13
      code/VideoAccess-VCMP/web/client/src/sections/monitor/containers/videoPlayCross.jsx
  10. 3
      code/VideoAccess-VCMP/web/package.json

27
code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoOperation.jsx

@ -9,6 +9,7 @@ import VideoOperationHistroyTime from './videoOperationHistroyTime'
import VideoOperationHistroyProcess from "./videoOperationHistroyProcess";
import { IconPause, IconPlay } from '@douyinfe/semi-icons';
import './videoPlay.less';
import { log } from "ezuikit-js";
const timeFormat = 'YYYY-MM-DD HH:mm:ss'
@ -26,6 +27,9 @@ const VideoOperation = ({
videoObj,
setYingshiPrepare, yingshiPrepareRef,
slideDown,
player,
// setPlayer,
playState,
}) => {
const [showTimeSelect, setShowTimeSelect] = useState(false)
@ -36,14 +40,25 @@ const VideoOperation = ({
}
const changeResolution = () => {
if (yingshiPrepareRef.current) {
return
}
// if (yingshiPrepareRef.current) {
// return
// }
if (videoObj.type == 'yingshi') {
yingshiPrepareRef.current = 'yingshi'
setYingshiPrepare('play')
// yingshiPrepareRef.current = 'yingshi'
// setYingshiPrepare('play')
}
console.log(player);
player.stop().then((res) => {
if (resolution == 'sd') {
player.play({ url: videoObj?.playUrlHd, options: { hd: true } })
} else {
player.play({ url: videoObj?.playUrlSd, options: { hd: false } })
}
playState=false
})
setResolution(resolution == 'sd' ? 'hd' : 'sd')
// setPlayer({ url: resolution == 'sd' ? videoObj?.playUrlSd : videoObj?.playUrlHd })
}
const histroySelected = operationState && operationState.histroy.select
@ -52,7 +67,7 @@ const VideoOperation = ({
<>
{
operationState ?
operationState.control.select ?
operationState?.control?.select ?
<VideoOperationCloudControl videoObj={videoObj} /> :
operationState.talk.select ?
<VideoOperationTalk

169
code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoOperationHistroyTime.jsx

@ -7,96 +7,97 @@ import moment from "moment";
const timeFormat = 'YYYY-MM-DD HH:mm:ss'
const VideoOperationHistroyTime = ({ close, histroyTime, setHistroyTime, setProcessDisX }) => {
const [selectedTimeRange, setSelectedTimeRange] = useState(histroyTime)
const [selectedTimeRange, setSelectedTimeRange] = useState(histroyTime)
useEffect(() => {
if (!selectedTimeRange.length) {
setSelectedTimeRange([moment().subtract(72, 'hours').format(timeFormat), moment().format(timeFormat)])
}
}, [])
useEffect(() => {
if (!selectedTimeRange.length) {
setSelectedTimeRange([moment().subtract(72, 'hours').format(timeFormat), moment().format(timeFormat)])
}
}, [])
const ToastInCustomContainer = ToastFactory.create({
getPopupContainer: () => document.getElementById('vcmp_videoplay'),
});
const ToastInCustomContainer = ToastFactory.create({
getPopupContainer: () => document.getElementById('vcmp_videoplay'),
});
return (
<div style={{
position: 'absolute', top: 'calc(50% - 90px)', left: 'calc(50% - 260px)',
width: 520, height: 180, backgroundColor: '#000000A5', padding: '40px 30px',
display: 'flex', flexDirection: 'column', justifyContent: 'space-between'
}}>
<div style={{ display: 'flex', justifyContent: 'center' }}>
<DatePicker
density='compact'
type="dateTimeRange"
value={selectedTimeRange}
onChange={(t, timeRange) => {
setSelectedTimeRange(timeRange)
}}
style={{ width: '100%' }}
// disabledDate={(date, options) => {
// const { rangeStart, rangeEnd } = options;
// // console.log(date, options);
// if (!rangeStart && !rangeEnd) {
// return false
// }
// if (rangeStart) {
// return Math.abs(moment(date).diff(moment(rangeStart), 'days')) > 3
// }
// if (rangeEnd) {
// return Math.abs(moment(date).diff(moment(rangeEnd), 'days')) > 3
// }
// }}
// disabledTime={(date, type) => {
// console.log(date, type);
// }}
/>
</div>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', }}>
<span style={{ color: '#FF7100' }}>
<img src={`/assets/images/background/warning.png`} height={14} style={{ position: 'relative', top: 2, marginRight: 2 }} />
最长时间跨度不超过72小时
</span>
<span>
<Space>
<div
onClick={() => {
close()
}}
style={{
cursor: 'pointer', height: 32, width: 56, lineHeight: '32px', borderRadius: 2,
textAlign: 'center', background: '#fff', color: 'rgba(0, 0, 0, 0.65)'
}}
>取消</div>
<div
onClick={() => {
if (selectedTimeRange.length == 2 && selectedTimeRange.every(t => t)) {
if (Math.abs(moment(selectedTimeRange[0]).diff(moment(selectedTimeRange[1]), 'hours')) > 72) {
ToastInCustomContainer.destroyAll()
return ToastInCustomContainer.error('所选时间超过 72 小时')
}
setHistroyTime(selectedTimeRange)
setProcessDisX(0)
close()
}
}}
style={{
cursor: 'pointer', height: 32, width: 56, lineHeight: '32px', borderRadius: 2,
textAlign: 'center', background: '#1859C1', color: '#fff'
}}
>播放</div>
</Space>
</span>
</div>
</div>
)
return (
<div style={{
position: 'absolute', top: 'calc(50% - 90px)', left: 'calc(50% - 260px)',
width: 520, height: 180, backgroundColor: '#000000A5', padding: '40px 30px',
display: 'flex', flexDirection: 'column', justifyContent: 'space-between'
}}>
<div style={{ display: 'flex', justifyContent: 'center' }}>
<DatePicker
density='compact'
type="dateTimeRange"
value={selectedTimeRange}
onChange={(t, timeRange) => {
setSelectedTimeRange(timeRange)
}}
style={{ width: '100%' }}
// disabledDate={(date, options) => {
// const { rangeStart, rangeEnd } = options;
// // console.log(date, options);
// if (!rangeStart && !rangeEnd) {
// return false
// }
// if (rangeStart) {
// return Math.abs(moment(date).diff(moment(rangeStart), 'days')) > 3
// }
// if (rangeEnd) {
// return Math.abs(moment(date).diff(moment(rangeEnd), 'days')) > 3
// }
// }}
// disabledTime={(date, type) => {
// console.log(date, type);
// }}
/>
</div>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', }}>
<span style={{ color: '#FF7100' }}>
<img src={`/assets/images/background/warning.png`} height={14} style={{ position: 'relative', top: 2, marginRight: 2 }} />
最长时间跨度不超过72小时
</span>
<span>
<Space>
<div
onClick={() => {
close()
}}
style={{
cursor: 'pointer', height: 32, width: 56, lineHeight: '32px', borderRadius: 2,
textAlign: 'center', background: '#fff', color: 'rgba(0, 0, 0, 0.65)'
}}
>取消</div>
<div
onClick={() => {
if (selectedTimeRange.length == 2 && selectedTimeRange.every(t => t)) {
if (Math.abs(moment(selectedTimeRange[0]).diff(moment(selectedTimeRange[1]), 'hours')) > 72) {
ToastInCustomContainer.destroyAll()
return ToastInCustomContainer.error('所选时间超过 72 小时')
}
setHistroyTime(selectedTimeRange)
playBackTime.current = selectedTimeRange
setProcessDisX(0)
close()
}
}}
style={{
cursor: 'pointer', height: 32, width: 56, lineHeight: '32px', borderRadius: 2,
textAlign: 'center', background: '#1859C1', color: '#fff'
}}
>播放</div>
</Space>
</span>
</div>
</div>
)
}
function mapStateToProps (state) {
const { auth } = state;
return {
user: auth.user,
};
const { auth } = state;
return {
user: auth.user,
};
}
export default connect(mapStateToProps)(VideoOperationHistroyTime);

1
code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoOperationTalk.jsx

@ -58,7 +58,6 @@ const VideoOperationTalk = ({
}
}
const vcmpVideo = document.getElementById('vcmp_videoplay')?.offsetHeight;
console.log(vcmpVideo);
return (
<div style={{

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

@ -4,16 +4,19 @@ import screenfull from 'screenfull';
import moment from "moment";
import request from 'superagent'
import { VideoServeApi, IotVideoServerRequest, checkAudioVideo } from '$utils'
import { ToastFactory, } from '@douyinfe/semi-ui';
import { Button, ToastFactory, } from '@douyinfe/semi-ui';
import VideoHeader from './voiceHeader'
import VideoOperation from './videoOperation'
import './videoPlay.less';
import EZUIKit from 'ezuikit-js'
import { done } from "nprogress";
const timeFormat = 'YYYY-MM-DD HH:mm:ss'
const yingshiUrl = 'https://open.ys7.com/ezopen/h5/iframe'
const yingshiCloseSoundKey = 'closeSound'
const yingshiOpenSoundKey = 'openSound'
const VideoPlay = ({
height, width, containerId = 'myPlayer',
// playUrl,
@ -26,32 +29,45 @@ const VideoPlay = ({
slideDown, //
IsSize, //16:9
// videoObj = {
// type: 'yingshi',
// audio: false,
// serialNo: 'G75922040', //
// channelNo: 1, //
// yingshiToken: 'at.3j6eyqbn0g5xvcut73v0rzdu1nh0gnxx-4ua03m82o9-12u1t9g-rtzndpyds', //
// playUrlSd: 'ezopen://open.ys7.com/G75922040/1.live', //
// // playUrl: 'ws://221.230.55.27:8081/jessica/34020000001110000077/34020000001310000003',
// playUrlHd: 'ezopen://open.ys7.com/G75922040/1.hd.live',
// // replayUrl: 'ezopen://open.ys7.com/G75922040/1.rec',
// type: 'yingshi',
// audio: false,
// serialNo: 'G75922040', //
// channelNo: 1, //
// yingshiToken: 'at.6nn6duwz8g8gbd919as9a6ea82bmn31x-709fnp7s3k-13q3v7e-mlov7lysf', //
// playUrlSd: 'ezopen://open.ys7.com/G75922040/1.live', //
// // playUrl: 'ws://221.230.55.27:8081/jessica/34020000001110000077/34020000001310000003',
// playUrlHd: 'ezopen://open.ys7.com/G75922040/1.hd.live',
// replayUrl: 'ezopen://open.ys7.com/G75922040/1.hd.local.rec',
// },
// videoObj = {
// type: 'yingshi',
// audio: false,
// serialNo: 'G56385051', //
// channelNo: 1, //
// yingshiToken: 'at.6nn6duwz8g8gbd919as9a6ea82bmn31x-709fnp7s3k-13q3v7e-mlov7lysf', //
// playUrlSd: 'ezopen://open.ys7.com/G56384814/1.live', //
// // playUrl: 'ws://221.230.55.27:8081/jessica/34020000001110000077/34020000001310000003',
// playUrlHd: 'ezopen://open.ys7.com/G56384814/1.hd.live',
// replayUrl: 'ezopen://open.ys7.com/G56384814/1.hd.local.rec',
// },
// videoObj = {
// type: 'cascade',
// audio: false,
// serialNo: '34020000001310000001', //
// topSerialNo: '34020000001110000077', //
// playUrlSd: 'ws://221.230.55.27:8081/jessica/34020000001110000077/34020000001310000001', //
// // playUrlHd: 'ezopen://open.ys7.com/G75922040/1.hd.live',
// // replayUrl: 'ezopen://open.ys7.com/G75922040/1.rec',
// type: 'cascade',
// audio: false,
// serialNo: '34020000001310000001', //
// topSerialNo: '34020000001110000077', //
// playUrlSd: 'ws://221.230.55.27:8081/jessica/34020000001110000077/34020000001310000001', //
// // playUrlHd: 'ezopen://open.ys7.com/G75922040/1.hd.live',
// // replayUrl: 'ezopen://open.ys7.com/G75922040/1.rec',
// },
//
iotVideoServer,
local, //
}) => {
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 (
<>
<div className="vcmp_videoplay" style={{ width: IsSize == 'true' ? size?.parentWidth : width || '100%', height: IsSize == 'true' ? size?.parentHeight : height || '100%', backgroundColor: 'black', overflow: 'hidden', display: 'flex', alignItems: 'center', justifyContent: 'center', }}>
<div id="vcmp_videoplay" style={{ position: 'relative', height: IsSize == 'true' ? size?.height : height || '100%', width: IsSize == 'true' ? size?.width : width || '100%', minWidth: 400, minHeight: 225, overflow: 'hidden' }}>
<div className="vcmp_videoplay" style={{ width: size?.parentWidth || '100%', height: size?.parentHeight || '100%', backgroundColor: 'black', overflow: 'hidden', display: 'flex', alignItems: 'center', justifyContent: 'center', }}>
<div id="vcmp_videoplay" style={{ position: 'relative', height: size?.height || '100%', width: size?.width || '100%', minWidth: 240, minHeight: 135, overflow: 'hidden' }}>
{/* 顶部信息 */}
{<VideoHeader
{size?.parentWidth > 320 ? <VideoHeader
operationState={operationState} changeSelectState={changeSelectState}
histroyTime={histroyTime}
setoperationState={setoperationState} name={name}
roll={roll}
showTime={
videoObj.type == 'yingshi' && yingshiPrepare == 'play' ?
null : (histroyBegain || moment())
}
videoObj={videoObj}
showTime={histroyBegain || moment()}
setProcessDisX={setProcessDisX}
content={videoObj.content}
videoStyle={videoStyle}
/>}
player={player}
resolution={resolution}
playState={playState.current}
/> : ""}
{/* 视频内容 */}
{videoObj.type == 'yingshi' ?
<iframe
frameBorder="0"
allowFullScreen='true'
id={containerId}
src={
`${yingshiUrl}?audio=${videoObj.audio && operationState && !operationState.histroy.select ? '1' : '0'}&url=${operationState && operationState.histroy.select && histroyBegain ? `${videoObj.replayUrl}?begin=${moment(histroyBegain).format("YYYYMMDDHHmmss")}&end=${moment(histroyTime[1]).format("YYYYMMDDHHmmss")}` : resolution == 'sd' ? videoObj.playUrlSd : videoObj.playUrlHd}&autoplay=${'1'}&accessToken=${videoObj.yingshiToken}`
}
// https://open.ys7.com/doc/zh/book/index/live_proto.html
// {width: 400px;height: 300px;}
width={'100%'}
height={'100%'}
wmode="transparent"
style={{ pointerEvents: 'none' }}
/> :
<div
id={containerId}
style={{
height: '100%', width: '100%'
}}>
</div>
{
// <iframe
// frameBorder="0"
// allowFullScreen='true'
// id={containerId}
// src={
// `${yingshiUrl}?audio=${videoObj.audio && operationState && !operationState.histroy.select ? '1' : '0'}&url=${operationState && operationState.histroy.select && histroyBegain ? `${videoObj.replayUrl}?begin=${moment(histroyBegain).format("YYYYMMDDHHmmss")}&end=${moment(histroyTime[1]).format("YYYYMMDDHHmmss")}` : resolution == 'sd' ? videoObj.playUrlSd : videoObj.playUrlHd}&autoplay=${'1'}&accessToken=${videoObj.yingshiToken}`
// }
// // https://open.ys7.com/doc/zh/book/index/live_proto.html
// // {width: 400px;height: 300px;}
// width={'100%'}
// height={'100%'}
// wmode="transparent"
// style={{ pointerEvents: 'none' }}
// />
}
<div id={containerId} style={{ height: '100%', width: '100%', }}></div>
{videoMask ? <div style={{ height: size?.height || '100%', width: size?.width || '100%', minWidth: 400, minHeight: 225, overflow: 'hidden', position: 'absolute', top: '0', left: '0', zIndex: 99, backgroundColor: 'red' }}>hhktyjr6tyr5</div> : ''}
{/* 下方操作栏 */}
{/* 显示操作功能条件(宽高) */}
{size?.parentWidth > 400 ?
{size?.parentWidth > 320 ?
<VideoOperation
operationState={operationState} operation={operation}
voiceDisY={voiceDisY} setVoiceDisY={setVoiceDisY}
@ -416,6 +469,9 @@ const VideoPlay = ({
setYingshiPrepare={setYingshiPrepare}
yingshiPrepareRef={yingshiPrepareRef}
slideDown={slideDown}
setPlayer={setPlayer}
player={player}
playState={playState.current}
/> : ""
}
</div>

12
code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlayModal.jsx

@ -20,15 +20,17 @@ const VideoPlayModal = ({ visible, close, videoObj, name }) => {
>
<div id="video_local" style={{ width: '100%' }}>
<VideoPlay sizeWh={{
width: '100%',
height: 460,
parentWidth: '100%',
parentHeight: '100%',
width:'',
height: '',
parentWidth: 918,
parentHeight: 460,
}}
videoObj={videoObj}
name={name}
height={460}
local={true} />
local={true}
// IsSize='true' //
/>
</div>
</Modal>
)

22
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 ?
<div style={{
height: '12%', lineHeight: `${vcmp_videoplay * 0.12 > 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'
}}>
<Row>
@ -74,6 +74,20 @@ const VideoHeader = ({ operationState, changeSelectState, setProcessDisX, name,
<>
<IconReply style={{ marginRight: 12, cursor: 'pointer' }} onClick={() => {
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,
</Col>
<Col span={videoStyle == 'true' ? 24 : 15} style={{}}>
<div style={{ paddingRight: 12 }}>
<TextScroll content={content || []} duration={6} />
{content ? <TextScroll content={content || []} duration={6} /> : ""}
</div>
</Col>
</Row>

6
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/components/cascadeCamera.jsx

@ -238,13 +238,13 @@ function cascadeCamera ({ dRef, dispatch, actions, cameraData, parentCamera, tes
</Col>
<Col span={14}>
<Form.Select
label="SIP编号:"
label="设备编号:"
field="streamId"
disabled={cameraData.id ? true : false}
initValue={cameraData?.topSerialNo || ""}
placeholder="请选择SIP编号"
placeholder="请选择设备编号"
style={{ width: 307 }}
rules={[{ required: true, message: "请选择SIP编号" }]}
rules={[{ required: true, message: "请选择设备编号" }]}
>
{sip.map((item, index) => (
<Form.Select.Option key={index} value={item.streamid}>

1
code/VideoAccess-VCMP/web/client/src/sections/equipmentWarehouse/containers/camera.jsx

@ -239,7 +239,6 @@ const CameraHeader = (props) => {
})
}
setVideoPlay(true)
}}
>
播放

13
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) {

3
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",

Loading…
Cancel
Save