简体   繁体   English

如何在WebRTC通话期间锁定视频大小?

[英]How to lock video size during WebRTC call?

I am working on this video broadcasting example. 我正在研究视频广播示例。

I have experienced something I dont know how to fix. 我遇到了一些我不知道如何解决的问题。 During the video call / broadcast the video size seems to be changed by Chrome over time quite often. 在视频通话/广播期间,Chrome似乎经常更改视频大小。 How can I make the video size / resolution constant? 如何使视频尺寸/分辨率恒定?

I dont know if this has an effect, but I commented out the video css styling in the css file (/public/main.css). 我不知道这是否有效果,但是我在css文件(/public/main.css)中注释了视频css样式。 I commented out this: 我对此评论:

video { width: 100%; 视频{宽度:100%; height: 100%; 高度:100%; position: absolute; 位置:绝对; display: block; 显示:块; top: 0; 最高:0; left: 0; 左:0; object-fit: cover;} 适合对象:封面;}

Can I lock the size with CSS? 我可以用CSS锁定尺寸吗? Or is this a WebRTC thing that I have no influence? 还是这是我没有影响力的WebRTC?

I know that WebRTC can reduce the resolution if for example there is not enough bandwith. 我知道,例如,如果带宽不足,WebRTC可以降低分辨率。 But how then to tell WebRTC not to resize video anyway? 但是,然后如何告诉WebRTC不要调整视频大小呢? Is this just a CSS trick after all (haven't tried it yet)? 毕竟这只是CSS技巧吗(还没有尝试过)?

You can set the size at which the video element is displayed using CSS. 您可以使用CSS设置显示视频元素的大小。 Note that you can (for good reasons, typically bandwidth or CPU limitations) not stop WebRTC implementations from reducing the resolution actually sent. 请注意,您可以(出于充分的原因,通常是带宽或CPU限制)不阻止WebRTC实施降低实际发送的分辨率。

Check either the video elements videoWidth and videoHeight attributes or use the RTCPeerConnection.getStats() API to get the actual resolution. 检查视频元素videoWidth和videoHeight属性,或使用RTCPeerConnection.getStats()API获取实际分辨率。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM