Browse Source

ceshi

dev_trial
wenlele 2 years ago
parent
commit
155d292140
  1. 31
      code/VideoAccess-VCMP/web/client/src/sections/openness/components/container.jsx

31
code/VideoAccess-VCMP/web/client/src/sections/openness/components/container.jsx

@ -12,8 +12,12 @@ const Container = ({ videoObj, pageSize, showHeader, videoPlay, mould }) => {
useEffect(() => { useEffect(() => {
const resize_ = async () => { const resize_ = async () => {
// await setVideoWidth(document.getElementById('video' + videoObj.key).clientWidth) let video = document.getElementById('video' + videoObj.key)
// await setVideoHeight(document.getElementById('video' + videoObj.key).clientHeight) if (video) {
await setVideoWidth(video.clientWidth)
await setVideoHeight(video.clientHeight)
}
} }
resize_() resize_()
window.addEventListener('resize', resize_); // window.addEventListener('resize', resize_); //
@ -23,22 +27,25 @@ const Container = ({ videoObj, pageSize, showHeader, videoPlay, mould }) => {
}, []) }, [])
useEffect(() => { useEffect(() => {
// setVideoWidth(document.getElementById('video' + videoObj.key).clientWidth) let video = document.getElementById('video' + videoObj.key)
// setVideoHeight(document.getElementById('video' + videoObj.key).clientHeight) if(video){
setVideoWidth(video.clientWidth)
setVideoHeight(video.clientHeight)
}
}, [pageSize, showHeader]) }, [pageSize, showHeader])
// console.log(videoWidth, videoHeight); // console.log(videoWidth, videoHeight);
return ( return (
<div style={{ width: videoWidth || '100%', height: videoHeight || '100%', padding: 5 }}> <div style={{ width: videoWidth || '100%', height: videoHeight || '100%', padding: 5 }}>
{videoWidth && videoHeight ? videoPlay ? {videoWidth && videoHeight ? videoPlay ?
<VideoPlay sizeWh={{ <VideoPlay sizeWh={{
// width: videoWidth - 10, width: videoWidth - 10,
// height: videoHeight - 30, height: videoHeight - 30,
// parentWidth: videoWidth - 10, parentWidth: videoWidth - 10,
// parentHeight: videoHeight - 30, parentHeight: videoHeight - 30,
width: 500, // width: 300,
height: 500, // height: 200,
parentWidth: 500, // parentWidth: 300,
parentHeight: 500, // parentHeight: 200,
}} }}
videoObj={videoObj.camera} videoObj={videoObj.camera}
videoStyle='true' videoStyle='true'

Loading…
Cancel
Save