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. Play music with qt 5

Play music with qt 5

Scheduled Pinned Locked Moved General and Desktop
33 Posts 4 Posters 11.0k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    It's explained in the first code sample "here":http://qt-project.org/doc/qt-5/qmediaplayer.html#details

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • P Offline
      P Offline
      paul_espinosa
      wrote on last edited by
      #3

      thanks i can play music ...but now i need to add a list of song and play this list and i can change of song

      mi code is :
      this code only play the fisrt song ,when finish the song ,not change of song and begin to play again the first song
      @

      include <QMediaPlayer>

      include <QMediaPlaylist>

      int main()
      {
      QMediaPlaylist *music_paul = new QMediaPlaylist;
      music_paul->addMedia(QUrl("C:/Users/henrypaul/Music/qt/p3.mp3"));
      music_paul->addMedia(QUrl("C:/Users/henrypaul/Music/qt/p4.mp3"));
      music_paul->setCurrentIndex(1);

      QMediaPlayer *player = new QMediaPlayer;
      player->setPlaylist(music_paul);

      while(true)
      {
      player->play();
      }
      return 0;
      }
      @

      [andreyc EDIT] Added @

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andreyc
        wrote on last edited by
        #4

        Take a look on a "player example":http://qt-project.org/doc/qt-5/qtmultimediawidgets-player-example.html

        1 Reply Last reply
        0
        • P Offline
          P Offline
          paul_espinosa
          wrote on last edited by
          #5

          I need to load a list of songs from a specific location
          for example all songs of this directory "C:\Users\henrypaul\Music"

          but I do not want that I open any dialog window to select the files
          for example
          QStringList fileNames = QFileDialog::getOpenFileNames(this);
          I DONT NEED THAT

          I JUST NEED to write in my program the specific location and load this songs in a QStringList

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #6

            QDir is your friend then

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • P Offline
              P Offline
              paul_espinosa
              wrote on last edited by
              #7

              i try with QDir
              but i can not use it correctly
              do you help me with the specific code to use QDir please

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #8

                What do you mean by you can't use it correctly ?

                What did you try ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  jafarabadi.qt
                  wrote on last edited by
                  #9

                  [quote author="paul_espinosa" date="1410551827"]i try with QDir
                  but i can not use it correctly
                  do you help me with the specific code to use QDir please [/quote]

                  Hi paul_espinosa
                  if you want to get file(s) of a directory use from
                  @
                  QDir myDir(/ur directory path/);
                  QStringList FNames=myDir.entryList(QDir::Files);
                  @

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    paul_espinosa
                    wrote on last edited by
                    #10

                    Thank you for your help. I can build my project, but now I need to control my UI from internet from smarphone .. how could do that ??

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #11

                      Implement a web service that will talk to your player

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • P Offline
                        P Offline
                        paul_espinosa
                        wrote on last edited by
                        #12

                        some tutorial or example to implement a web service???

                        1 Reply Last reply
                        0
                        • A Offline
                          A Offline
                          andreyc
                          wrote on last edited by
                          #13

                          "Tufao":https://github.com/vinipsmaker/tufao is a Qt based web-framework and it has some examples.

                          1 Reply Last reply
                          0
                          • P Offline
                            P Offline
                            paul_espinosa
                            wrote on last edited by
                            #14

                            hello my dears friends i have a new problem :( ..i have an aplication of play music on QT ,My application works well in mi pc ...
                            now my problem
                            i am working whith raspberry pi b+ and i can compilate my aplicacion in the raspberry but not play music :(
                            am instaled qt5 on raspberry ...do i need to install some more ???
                            some aplication of qt run very well ..but the music not play

                            1 Reply Last reply
                            0
                            • P Offline
                              P Offline
                              paul_espinosa
                              wrote on last edited by
                              #15

                              hello my dears friends i have a new problem :( ..i have an aplication of play music on QT ,My application works well in mi pc ...
                              now my problem
                              i am working whith raspberry pi b+ and i can compilate my aplicacion in the raspberry but not play music :(
                              am instaled qt5 on raspberry ...do i need to install some more ???
                              some aplication of qt run very well ..but the music not play

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #16

                                Do you have any error message ?

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                1 Reply Last reply
                                0
                                • SGaistS Offline
                                  SGaistS Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #17

                                  Do you have any error message ?

                                  Interested in AI ? www.idiap.ch
                                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  1 Reply Last reply
                                  0
                                  • P Offline
                                    P Offline
                                    paul_espinosa
                                    wrote on last edited by
                                    #18

                                    un the terminal apear this
                                    GLFS: Unable to query physical screen size, defaulting to 100 dpi.
                                    EGLFS: To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
                                    EGLFS: Unable to query screen depth, defaulting to 32.
                                    EGLFS: To override, set QT_QPA_EGLFS_DEPTH.
                                    defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
                                    HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP
                                    This plugin does not support propagateSizeHints()

                                    1 Reply Last reply
                                    0
                                    • P Offline
                                      P Offline
                                      paul_espinosa
                                      wrote on last edited by
                                      #19

                                      un the terminal apear this
                                      GLFS: Unable to query physical screen size, defaulting to 100 dpi.
                                      EGLFS: To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
                                      EGLFS: Unable to query screen depth, defaulting to 32.
                                      EGLFS: To override, set QT_QPA_EGLFS_DEPTH.
                                      defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
                                      HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP
                                      This plugin does not support propagateSizeHints()

                                      1 Reply Last reply
                                      0
                                      • SGaistS Offline
                                        SGaistS Offline
                                        SGaist
                                        Lifetime Qt Champion
                                        wrote on last edited by
                                        #20

                                        Do it again but for define QT_DEBUG_PLUGINS=1

                                        Interested in AI ? www.idiap.ch
                                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                        1 Reply Last reply
                                        0
                                        • SGaistS Offline
                                          SGaistS Offline
                                          SGaist
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #21

                                          Do it again but for define QT_DEBUG_PLUGINS=1

                                          Interested in AI ? www.idiap.ch
                                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                          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