|
@ -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' |
|
|