How to make media duration timer?
I am trying to make a media timer in QML but the problem is that the seconds are going past 60, how can I make the seconds timer reset whenever it hits 60?
I have the following.
Code:
Text{
property var pozitieActMin:
parseInt(utilMuz.position/60000)<10 ?
"0"+parseInt(utilMuz.position/60000) : parseInt(utilMuz.position/60000);
property var pozitieActSec:
parseInt(utilMuz.position/1000)<10 ?
"0"+parseInt(utilMuz.position/1000) : parseInt(utilMuz.position/1000);
property var durataMin:
parseInt(utilMuz.duration/60000)<10 ?
"0"+parseInt(utilMuz.duration/60000) : parseInt(utilMuz.duration/60000);
property var durataSec:
parseInt(utilMuz.duration/1000)<10 ?
"0"+parseInt(utilMuz.duration/1000) : parseInt(utilMuz.duration/1000);
text:"Duration "+pozitieActMin+":"+pozitieActSec+"/"+durataMin+":"+durataSec;
}
Re: How to make media duration timer?
For me it looks like your problem is not the timer, but the way you are trying to calculate the result.
A simple example, 123 000 ms =
Code:
[(123 000/60 000) min + (3 000 / 1000) s = 2 min + 3 s]
, but in your code it is
Code:
[(123 000 / 60 000) min + (123 000 / 1000) s = 2 min + 123 s]
Do you see where is the problem ?
Re: How to make media duration timer?
Quote:
Originally Posted by
stampede
For me it looks like your problem is not the timer, but the way you are trying to calculate the result.
A simple example, 123 000 ms =
Code:
[(123 000/60 000) min + (3 000 / 1000) s = 2 min + 3 s]
, but in your code it is
Code:
[(123 000 / 60 000) min + (123 000 / 1000) s = 2 min + 123 s]
Do you see where is the problem ?
I figured it out, thank you.