|
|
@ -6,27 +6,27 @@ import { useState } from 'react'; |
|
|
|
|
|
|
|
|
|
|
|
const Container = ({ videoObj, pageSize, showHeader, videoPlay, mould }) => { |
|
|
|
const [videoWidth, setVideoWidth] = useState(300) |
|
|
|
const [videoHeight, setVideoHeight] = useState(200) |
|
|
|
const [videoWidth, setVideoWidth] = useState() |
|
|
|
const [videoHeight, setVideoHeight] = useState() |
|
|
|
// console.log(videoObj); |
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
const resize_ = async () => { |
|
|
|
try { |
|
|
|
let video = document.getElementById('video' + videoObj.key) |
|
|
|
if (video) { |
|
|
|
await setVideoWidth(video.clientWidth) |
|
|
|
await setVideoHeight(video.clientHeight) |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.error(error) |
|
|
|
} |
|
|
|
} |
|
|
|
resize_() |
|
|
|
window.addEventListener('resize', resize_); //只要窗口殴大小发生像素变化就会触发 |
|
|
|
return () => { |
|
|
|
window.removeEventListener('resize', resize_); |
|
|
|
} |
|
|
|
// const resize_ = async () => { |
|
|
|
// try { |
|
|
|
// let video = document.getElementById('video' + videoObj.key) |
|
|
|
// if (video) { |
|
|
|
// await setVideoWidth(video.clientWidth) |
|
|
|
// await setVideoHeight(video.clientHeight) |
|
|
|
// } |
|
|
|
// } catch (error) { |
|
|
|
// console.error(error) |
|
|
|
// } |
|
|
|
// } |
|
|
|
// resize_() |
|
|
|
// window.addEventListener('resize', resize_); //只要窗口殴大小发生像素变化就会触发 |
|
|
|
// return () => { |
|
|
|
// window.removeEventListener('resize', resize_); |
|
|
|
// } |
|
|
|
|
|
|
|
}, []) |
|
|
|
useEffect(() => { |
|
|
|