停止“加载”视频如果不在视口
假设我的页面上有30个高质量的视频,并且我的带宽有限。打开页面后,我迅速滚动到第20视频,然后尝试观看它。目前,该视频是我视频中唯一的视频。因此,现在,我不希望浏览器“加载”其他视频。因为否则它将浪费我的带宽,并且可能会在第20视频中引起缓冲问题。 (我现在想观看的视频)
但是,如果我可以以某种方式停止“加载”其他视频,那么浏览器可以在第20视频中使用它的所有带宽,然后我就可以观看视频而无需缓冲。
为了清楚地表明,我不是在谈论播放/暂停视频,而是在谈论“加载”播放。如果视频不在视口上,我希望它停止。
是否可以?
Let's say I have 30 high quality videos on my page and my bandwidth is limited. Once the page is opened, I quickly scroll to the 20th video and I'm trying to watch it. Currently, that video is the only video in my viewport. So right now, I don't want my browser to "load" other videos. Because otherwise it will waste my bandwidth, and it will probably cause buffering issues in the 20th video. (the video I'm trying to watch now)
But If I can somehow stop "loading" the other videos, then browser can use all it's bandwidth in the 20th video, and then I will be able to watch the video without buffering.
To make it clear, I'm not talking about playing/pausing videos, I'm talking about "loading" the playback. I want it to stop if the video is not in viewport.
Is it possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的视频标签中使用预加载属性并将其设置为无。
use preload attribute in your video tag and set it to none.