Results 1 to 3 of 3

Thread: How to make media duration timer?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2013
    Posts
    142
    Thanks
    36
    Thanked 3 Times in 3 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default 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.

    Qt Code:
    1. Text{
    2. property var pozitieActMin:
    3. parseInt(utilMuz.position/60000)<10 ?
    4. "0"+parseInt(utilMuz.position/60000) : parseInt(utilMuz.position/60000);
    5. property var pozitieActSec:
    6. parseInt(utilMuz.position/1000)<10 ?
    7. "0"+parseInt(utilMuz.position/1000) : parseInt(utilMuz.position/1000);
    8. property var durataMin:
    9. parseInt(utilMuz.duration/60000)<10 ?
    10. "0"+parseInt(utilMuz.duration/60000) : parseInt(utilMuz.duration/60000);
    11. property var durataSec:
    12. parseInt(utilMuz.duration/1000)<10 ?
    13. "0"+parseInt(utilMuz.duration/1000) : parseInt(utilMuz.duration/1000);
    14. text:"Duration "+pozitieActMin+":"+pozitieActSec+"/"+durataMin+":"+durataSec;
    15. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default 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 =
    Qt Code:
    1. [(123 000/60 000) min + (3 000 / 1000) s = 2 min + 3 s]
    To copy to clipboard, switch view to plain text mode 
    , but in your code it is
    Qt Code:
    1. [(123 000 / 60 000) min + (123 000 / 1000) s = 2 min + 123 s]
    To copy to clipboard, switch view to plain text mode 
    Do you see where is the problem ?

  3. #3
    Join Date
    Oct 2013
    Posts
    142
    Thanks
    36
    Thanked 3 Times in 3 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: How to make media duration timer?

    Quote Originally Posted by stampede View Post
    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 =
    Qt Code:
    1. [(123 000/60 000) min + (3 000 / 1000) s = 2 min + 3 s]
    To copy to clipboard, switch view to plain text mode 
    , but in your code it is
    Qt Code:
    1. [(123 000 / 60 000) min + (123 000 / 1000) s = 2 min + 123 s]
    To copy to clipboard, switch view to plain text mode 
    Do you see where is the problem ?
    I figured it out, thank you.

Similar Threads

  1. Replies: 1
    Last Post: 26th November 2012, 19:09
  2. timer problem(timer does not work)
    By masuk in forum Newbie
    Replies: 6
    Last Post: 14th February 2011, 05:00
  3. How to get video file duration in Qt?
    By newtolinux in forum Qt Programming
    Replies: 2
    Last Post: 26th November 2010, 11:09
  4. How to make Media Player
    By v-6 in forum Newbie
    Replies: 3
    Last Post: 8th November 2010, 10:02

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.