html页面video标签

1.video标签禁止下载

将属性改为controls="true" controlslist="nodownload"即可实现

2.禁止自动播放

html代码如下:

<video width="500" height="300" controls="controls" poster="../images/test.png" id="0">
<source src="../video/test.ogg" type="video/ogg">
<source src="../video/test.mp4" type="video/mp4">
</video>
<video  width="500" height="300"  controls="controls" poster="../images/test.png" id="1">
<source src="../video/test.ogg" type="video/ogg">
<source src="../video/test.mp4" type="video/mp4">
</video>
<video  width="500" height="300"  controls="controls" poster="../images/test.png" id="2">
<source src="../video/test.ogg" type="video/ogg">
<source src="../video/test.mp4" type="video/mp4">
</video>

js代码如下:

$(function() {

      var video = document.getElementsByTagName("video");
           for ( var i in video) {
           var e = video[i];
           (function(i) {
                $(e).bind('play', function() {
                      for ( var j in video) {
                          if (j != i) {
                             document.getElementById(j).pause();
                          }
                      }
                });
          })(i);
      }

});

猜你喜欢

转载自blog.csdn.net/sz_09/article/details/82625355