From f8bcc17e958d7481e77338edb5e72a4e5fd746ed Mon Sep 17 00:00:00 2001 From: wenlele Date: Fri, 9 Dec 2022 19:51:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=951?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/videoPlayer/videoPlay.jsx | 6 ++-- .../openness/components/container.jsx | 36 +++++++++---------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlay.jsx b/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlay.jsx index 884faa6..d9b4809 100644 --- a/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlay.jsx +++ b/code/VideoAccess-VCMP/web/client/src/components/videoPlayer/videoPlay.jsx @@ -457,7 +457,7 @@ const VideoPlay = ({ dispatch, actions, } else { videoFront = new moment(); //验证前时间 - setTimeout(() => { + // setTimeout(() => { const player = new EZUIKit.EZUIKitPlayer({ id: containerId, // 视频容器ID accessToken: videoObj?.yingshiToken, @@ -479,7 +479,7 @@ const VideoPlay = ({ dispatch, actions, }) setPlayer(player) yingshiPlayer.current = player - }, 0) + // }, 0) } } @@ -551,9 +551,11 @@ const VideoPlay = ({ dispatch, actions, player.reSize(videoWidth, videoHeight) } } else { + setTimeout(() => { if (videoObj.type == 'yingshi' && player?.pluginStatus) { player.reSize(videoWidth, videoHeight) } + }) } setSize({ parentWidth: containerWidth, parentHeight: containerHeight, width: videoWidth, height: videoHeight }) return data == 'width' ? videoWidth : data == 'height' ? videoHeight : '' diff --git a/code/VideoAccess-VCMP/web/client/src/sections/openness/components/container.jsx b/code/VideoAccess-VCMP/web/client/src/sections/openness/components/container.jsx index 7f0fb70..0f335ee 100644 --- a/code/VideoAccess-VCMP/web/client/src/sections/openness/components/container.jsx +++ b/code/VideoAccess-VCMP/web/client/src/sections/openness/components/container.jsx @@ -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(() => {