HTML5视频 - 暂停加载/部分加载 [英] HTML5 Video - Suspend Loading / Partial Load

查看:263
本文介绍了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.

谢谢!

推荐答案

您可以使用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.

这篇关于HTML5视频 - 暂停加载/部分加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆