首页 > 开发 > HTML > 正文

HTML5 如何判断网页中视频是否完全加载完毕?

2017-09-09 13:56:21  来源: 网友分享

视频是用html5的video标签放的

<div class="media">    <video autoplay="" loop="" id="videos">        <source src="http://stg.shinetech.likvm.com/sites/stg/files/video/Shinetech-Final_Compress.ogv">        <source src="http://stg.shinetech.likvm.com/sites/stg/files/video/Shinetech-Final_Compress.MP4">        Your browser does not support the Video tag.    </video></div>

解决方案

videoElem.addEventListener('canplaythrough',function(){});

http://www.w3schools.com/tags/av_event_canplaythrough.asp