乐趣区

h5视频播放

<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>
退出移动版