Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QMediaPlayer playback rate

QMediaPlayer playback rate

Scheduled Pinned Locked Moved Solved Mobile and Embedded
3 Posts 2 Posters 1.3k Views
  • 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 Offline
    H Offline
    Hung Tran
    wrote on last edited by
    #1

    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
    0
    • tekojoT Offline
      tekojoT Offline
      tekojo
      wrote on last edited by
      #2

      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
      2
      • tekojoT tekojo

        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 Offline
        H Offline
        Hung Tran
        wrote on last edited by
        #3

        @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
        1

        • Login

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