Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved QMediaPlayer playback rate

    Mobile and Embedded
    2
    3
    966
    Loading More Posts
    • 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.
    • H
      Hung Tran last edited by

      I read: http://doc.qt.io/qt-5/qtmultimedia-multimediawidgets-player-example.html

      In files: playercontrols.cpp and playercontrols.h
      Qt define:
      void PlayerControls::setPlaybackRate(float rate) to set playback rate.
      I want to confirm: rate parameter is corresponding:
      qreal PlayerControls::playbackRate() const
      Values return from: qreal PlayerControls::playbackRate() const will be set for current playback rate.
      Mean:
      PlayerControls::setPlaybackRate(qreal PlayerControls::playbackRate())

      Is this correct ? If not, could you please explain in advance for set playback rate.

      Thank so much.

      1 Reply Last reply Reply Quote 0
      • tekojo
        tekojo last edited by

        Hi @Hung-Tran
        Yes, when you change the playback rate in the controls, this signal/slot pair happens:

         connect(rateBox, SIGNAL(activated(int)), SLOT(updateRate()));
        

        and that emits another signal:

        void PlayerControls::updateRate()
        {
            emit changeRate(playbackRate());
        }
        

        And that goes to player.cpp here:

        connect(controls, SIGNAL(changeRate(qreal)), player, SLOT(setPlaybackRate(qreal)));
        

        And that changes the playback rate.

        It is all done with signals and slots. I hope that helps.

        H 1 Reply Last reply Reply Quote 2
        • H
          Hung Tran @tekojo last edited by

          @tekojo WoW. I miss

          connect(controls, SIGNAL(changeRate(qreal)), player, SLOT(setPlaybackRate(qreal)));
          

          so I have misunderstand. Thank so much. I got this Idea

          1 Reply Last reply Reply Quote 1
          • First post
            Last post