HTML5视频加载缓慢
我的网站上有很长时间的视频。
我不认为这是我的网络主机,因为它也发生在Localhost上。 每次仅向用户显示1个视频,具体取决于他们选择的类别。 (因此,它不会总是加载每个视频)。
加载需要更长的视频是更大的视频(最大的视频是大约351MB视频文件),
这是我的视频HTML代码:
<div class='video'><h2>$vidTitle</h2><video width='640' height='360' controls preload='metadata'><source src='$viddir' type='video/mp4'></video></div>
我还读到,视频索引可能是最终的,可以是这样吗?
我能做什么,我需要使用另一个播放器,而不是默认的HTML5播放器(我尝试过,但并没有真正帮助)|我需要使用CDN吗?
我该如何解决?
谢谢!
I have videos on my website that are taking very long to load.
I don't think it is my webhost since it also happens on localhost.
Each time there is only 1 video shown to the user, depending which category they chose. (So it is not loading each video always).
The videos that take longer to load are the bigger ones (the biggest one is about 351MB video file)
This is my html code for the video:
<div class='video'><h2>$vidTitle</h2><video width='640' height='360' controls preload='metadata'><source src='$viddir' type='video/mp4'></video></div>
I've also read that it could be that the video indexing could be at the end, could this be the case?
What can I do about this, do I need to use another player thann the default html5 player (I tried this but it didn't really help) | do I need to use a cdn?
How can I solve this?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的理解是,您的视频元素中的preload ='元数据'属性应该阻止视频加载。
您可以尝试测试preload ='none'。我知道这有效。
与往常一样,检查的好地方是MDN Web文档:
mdn网络文档:视频嵌入元素
My understanding is that the preload='metadata' attribute in your video element is supposed to prevent the video from loading.
You could try preload='none' to test. I know that works.
As always, a good place to check is MDN web docs:
mdn web docs : The Video Embed element
PRELOAD ='Metadata'
立即为我提供了很好的视频负载(大约需要8秒)preload='metadata'
worked great for me video loads instantly (was taking about 8 seconds)