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);
}
});