js 监听音频视频控件是否播放
监听onplaying:
var myVideo=document.getElementById("video1"); myVideo.addEventListener("playing", function(){ console.log("playing"); // video(this.src); }); myVideo.addEventListener("pause", function(){/ console.log("paused") });
或
<video src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" width="550" height="400" loop="true" controls="" autobuffer="" id="video1" onplaying="getVideo()">