<video id="myVideo" style="width:100%" controls="" preload=""> <source src="video/echo-hereweare.mp4" type="video/mp4" codecs="avc1.42E01E,mp4a.40.2"> <!--[if IE 8]> <embed src="video/echo-hereweare.mp4" style="width:100%" autostart="false"/> <![endif]--></video>
//切换视频清晰度function videoSourceChoose(){ var myVideo = document.getElementById("myVideo"); var url = myVideo.currentSrc; var nums = url.length; url = url.substring(0,nums-4)+"_small.mp4"; //视频地址 var nowsTime = myVideo.currentTime; //视频播放时间 myVideo.load(); }
当点击按钮的时候调用此方法,切换为_small.mp4,别且从上次观看的时间继续播放。