[英]add progress-bar before video loading
How to add loader before video loading? 如何在视频加载之前添加加载器? I have used video-slider on my site also add pagepilling.js for video scroll. 我在网站上使用过video-slider,还添加了pagepilling.js进行视频滚动。 My video slider and video scroll with pagepilling.js working well dynamically. 我的视频滑块和带有pagepilling.js的视频滚动条可以动态良好地运行。
Now I want to add before video loading showing a video progress-bar and an image, after video loading playing the video and hide image and progress-bar. 现在,我想在视频加载之前添加,以显示视频进度条和图像,在视频加载之后播放视频并隐藏图像和进度条。 I have found a site using this, but I don't know how to do that? 我已经找到一个使用此工具的网站,但我不知道该怎么做? Please see the demo site and suggest me what I will do? 请访问演示站点,并建议我该怎么做? I have not used any code because my code is working well. 我没有使用任何代码,因为我的代码运行良好。 I need to add video-loading progress bar like the demo. 我需要添加视频加载进度条,如演示。 How can I do that? 我怎样才能做到这一点?
The HTML5 Media API includes events that you can listen for and react to that allows you do things like this. HTML5 Media API包含您可以监听和响应的事件,这些事件使您可以执行以下操作。 The API is here: API在这里:
It includes the following which are of interest in your case (from the above link): 其中包括您感兴趣的以下内容(来自上面的链接):
You can use these to achieve your requirement, for example, by: 您可以使用这些来满足您的要求,例如,通过:
As an example, you can listen for the canplay event like this: 例如,您可以侦听canplay事件,如下所示:
var yourVideo = document.getElementById("yourVideo");
yourVideo.oncanplay = function() {
//Add your code here to remove the image,
//remove the progress bar and
//show and start the video
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.