html5 get the real-time progress of the player

Html5 video monitors real-time playback progress

Video objects can monitor real-time playback progress through ontimeupdate time

 var videoPlayer = document.getElementById("video");
 videoPlayer.ontimeupdate = function () { timeUpdate(); };
 function timeUpdate() {
       document.getElementById('time').innerHTML = video.currentTime;
 }

explain

给video添加ontimeupdate监听这个监听可以实时监控播放进度,然后在监听当中不断调用方法

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324891066&siteId=291194637