1 回答
TA贡献1773条经验 获得超3个赞
您可以使用
没有异步的getBoundingClientRect
这是您如何使用https://www.pexels.com/videos/在最小的、可重现的示例中发布您的问题
const video = document.getElementById("remoteVideo");
video.addEventListener('play', () => {
console.log(video.getBoundingClientRect() );
});
html {
height: 100%;
}
body {
height: 100%;
margin: 0;
background: yellow;
text-align: center;
}
#remoteVideo {
height: 70%;
margin-top: 5%;
background: red;
}
#localVideo {
width: 20%;
position: absolute;
right: 1.1em;
bottom: 1em;
border: 1px solid #333;
background: pink;
}
#callButton {
position: absolute;
display: none;
left: 50%;
font-size: 2em;
bottom: 5%;
border-radius: 1em;
}
<video id="localVideo" src="https://player.vimeo.com/external/357005099.sd.mp4?s=a95b2118e2fa52097ad9933b56d50ebcc9f2f1c9&profile_id=139&oauth2_token_id=57447761" autoplay muted>Video</video>
<video id="remoteVideo" autoplay src="https://player.vimeo.com/external/340284081.sd.mp4?s=00350f6e127d8ac3777d74528fa439944f7d9f2c&profile_id=139&oauth2_token_id=57447761">Video</video>
<button id="callButton" onclick="createOffer()">Button ✆</button>
添加回答
举报
