Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QMediaPlayer::positionChanged causes delay on my progressBar
Forum Updated to NodeBB v4.3 + New Features

QMediaPlayer::positionChanged causes delay on my progressBar

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • devhobbyD Offline
    devhobbyD Offline
    devhobby
    wrote on last edited by devhobby
    #1

    Hello.

    I have connected the signal from QMediaPlayer::positionChanged to my MainWindow::trackPositionChanged

    // in the constructor
    QObject::connect(player, SIGNAL(durationChanged(qint64)), this, SLOT(trackDurationChanged(qint64)));
    QObject::connect(player, SIGNAL(positionChanged(qint64)), this, SLOT(trackPositionChanged(qint64)));
    
    //
    
    void MainWindow::trackDurationChanged(qint64 position)
    {
        ui->progressBar->setMaximum(position);
    }
    
    void MainWindow::trackPositionChanged(qint64 position)
    {
        ui->progressBar->setValue(position);
    }
    
    
    

    The problem with this is that the progressBar doesn't update in real-time.

    This is a screenshot of when I press play
    0_1509576094129_11.jpg

    And this is a screenshot after 3 seconds have passed
    0_1509576118318_22.jpg

    As you can see, the progressBar did a "jump" from being completely empty to one "green block".

    What I want, instead, is watching the progressBar filling up little by little, smoothly.

    (I know this happens in relation to the progressBar's lenght)

    How can I achieve this?
    Thanks in advance!

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      The default interval for change notifications is 1000ms (1 second). If you want a smooth update set it to something lower with setNotifyInterval().

      devhobbyD 1 Reply Last reply
      1
      • Chris KawaC Chris Kawa

        The default interval for change notifications is 1000ms (1 second). If you want a smooth update set it to something lower with setNotifyInterval().

        devhobbyD Offline
        devhobbyD Offline
        devhobby
        wrote on last edited by
        #3

        @Chris-Kawa said in QMediaPlayer::positionChanged causes delay on my progressBar:

        The default interval for change notifications is 1000ms (1 second). If you want a smooth update set it to something lower with setNotifyInterval().

        Thanks for the answer.

        Changing the notifyInterval (to 10 for example) is effective on my slider... but on the progressBar, the issue persists. There's a new green block popping up every X seconds.

        The slider is smoother

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved