HTML5 视频 - 暂停加载/部分加载
有没有办法预加载视频的一部分,而不是整个视频?我注意到有一个“暂停”事件,表明视频预计不会下载,直到有进一步指示,但我不确定如何触发此事件?
我的目标是预加载视频的一部分而不占用所有用户的带宽。
谢谢!
Is there a way to preload a portion of a video, but not the entire thing? I noticed that there is a "suspend" event that indicates the video is expectedly not downloading until further instruction, but I'm unsure of how to trigger this event?
My goal is to preload a portion of a video without taking up all the users' bandwidth.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 XHR 预取任何 URL,但无法控制它从客户端预取的量。我认为您可以尝试以下操作:在 XHR 请求中设置一个标头,指示您想要预取多少数据,在服务器端读取此标头,然后仅将那么多数据提供给此请求。
You can pre-fetch any URL with XHR, but you can't control how much it pre-fetch from the client-side. I think you can try this: set a header in the XHR request indicating how much you want to pre-fetch, read this header on the server-side and only feed that much data to this request.