共计 604 个字符,预计需要花费 2 分钟才能阅读完成。
<video class=”ss” type=”video/mp4″ src=”https://ksv-video-publish.cdn…; ></video>
<div class="ctl">
<input type="button" value="播放" />
<input type="button" value="快进 *1" />
<input type="button" value="静音" />
</div>
<script>
var vd = document.querySelector("video")
var btns =document.querySelectorAll(".ctl input")
btns[0].onclick = function (){if(vd.paused){vd.play();
this.value = "暂停"
}else{vd.pause()
this.value = "播放"
}
}
btns[1].onclick = function (){if(vd.playbackRate >=8){vd.playbackRate =1}else{vd.playbackRate *=2}
this.value = "快进(X"+vd.playbackRate+")";
}
btns[2].onclick = function (){
vd.muted = !vd.muted;
this.value = vd.muted ? "取消静音" : "静音"
}
</script>
正文完
发表至: javascript
2019-06-09