I'm trying display video duration using videojs
Here's my code:
<div>
<span id="played">0</span> seconds out of
<span id="duration"></span> seconds. (only updates when the video pauses)
</div>
Call this function when click on pause button:
function getDuration() {
duration = video.duration;
document.getElementById("duration").appendChild(new Text(Math.round(duration)+""));
console.log("Duration: ", duration);
}
It works perfectly except in mobile devices.
In desktop: '26 seconds out of 225 seconds. (only updates when the video pauses)'
In mobile: '0 seconds out of seconds. (only updates when the video pauses)'