Js monitors video playback events and prints logs. js monitors video playback logs.
Html code:
1 <!DOCTYPE html> 2
Js Code:
1 <script type = "text/javascript"> 2 window. addEventListener ("load", getVideoEvent); 3 function getVideoEvent () {4 var videoes = document. getElementsByTagName ("video"); 5 for (var I = 0; I <videoes. length; I ++) {6 showEventLog ("video" + (I + 1), videoes [I]); 7} 8} 9 10 function showEventLog (videoNum, Media) {11 eventTester = function (e) {12 Media. addEventListener (e, function () {13 console. log (videoNum + ":" + e); 14}); 15} 16 eventTester ("loadstart"); // The client starts to request data 17 eventTester ("progress "); // The client is requesting data 18 eventTester ("suspend"); // The client proactively terminates the download (not due to an error ), 20 eventTester ("error"); // error 21 eventTester ("stalled") during data request; // eventTester 22 ("play"); // play () and trigger 23 eventTester ("pause") When autoplay starts playing; // pause () trigger 24 eventTester ("loadedmetadata "); // The resource length is 25 eventTester ("loadeddata"); // 26 eventTester ("waiting"); // wait for data, not error 27 eventTester ("playing "); // start playing back 28 eventTester ("canplay"); // you can play back the video, but 29 eventTester ("canplaythrough") may be paused due to loading; // you can play back the video, 30 eventTester ("seeking"); // search for 31 eventTester ("seeked"); // 32 eventTester ("timeupdate "); // change the playback time to 33 eventTester ("ended"); // play end 34 eventTester ("ratechange"); // change the playback speed to 35 eventTester ("durationchange "); // resource Length Change 36 eventTester ("volumechange"); // volume change 37} 38 </script>