if the address of the video is a local file, you can"t trigger the oncanplay event to change the address to a URL. That"s why
related codes
/ / < video id= "video" controls width= "100% >
<source src="1.mp4" type="video/mp4">
<!-- <source src="https://media.w3.org/2010/05/sintel/trailer.mp4" type="video/mp4"> -->
</video>
<script>
window.onload = function() {
var video = document.getElementById("video");
video.addEventListener("canplay", function() {
console.log(video.duration);
})
}