HI @Gerailly ,
To properly answer your question we really need a bit more information to work with. Please try to provide use with your goals, what you've already tried and how (approximately) you want to achieve your goal.
We really need more information to work with. At the minimum, provide:
Can you please point out where exactly you are having trouble with your code, and post your code in a way that makes it easier to read?
Also, could you please tell us if this article (https://www.w3schools.com/tags/av_prop_duration.asp) answers your question? It seems to cover what you are trying to achieve.