A Video playback page has been created recently. The HTML5 Video object is used. This is a new object in HTML5. It supports online playback of videos in different formats and has powerful functions, in addition, many events are extended, and video playback can be controlled through JavaScript scripts. Refer to the following two links:
Http://msdn.microsoft.com/en-us/library/windows/apps/hh465962.aspx
Http://www.w3school.com.cn/html5/tag_video.asp
You can useOntimeupdateEvent to report the current playback progress. You can also use this event to control other elements on the page based on the video playback status, for example, you can switch chapters and display additional information as the video playback progresses. The following is an example:
Time: 0 of 0 seconds.
Of course, you can also dynamically add attributes or upload events to the Video object like using other elements on the page, such:
video.ontimeupdate = function () { getCurrentVideoPosition(); };
However, the above line of code seems to be invalid on Chrome. You can useAddEventListenerTo replace it:
videoPlayer.addEventListener("timeupdate", function () { getCurrentVideoPosition(); }, false);
I don't know why Chrome cannot directlyOntimeupdateThe event is mounted on the Video element, but must passAddEventListenerMethod to add events. HoweverAddEventListenerIt is also compatible with IE and Firefox browsers, so it should be passed.