video视频限时观看

无聊写着玩的,不成熟,仅供参考,如有错误或疑问,请留言...


<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <script src="http://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> </head> <body> <video id="video" src="http://img.ksbbs.com/asset/Mon_1605/0ec8cc80112a2d6.mp4" controls type="video/mp4"></video> </div> </body> <script> $(function(){ // var a = $('#video'); var a = document.getElementById('video') console.log(a.currentTime) a.onplaying = function(){ var set = setInterval(function(){ var ing = a.currentTime; if(ing > 10){ a.pause(); a.currentTime = 0; window.clearInterval(set); } },1000); } }) </script> </html>

  

posted @ 2017-04-27 18:20  webarn  阅读(445)  评论(0编辑  收藏  举报