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 won't play music anymore

QMediaPlayer won't play music anymore

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 3 Posters 3.6k 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.
  • P Offline
    P Offline
    pchyolki
    wrote on last edited by pchyolki
    #1

    Hello, I've been writing an audio player using QT for a while, when suddenly QMediaPlayer stopped to play any kind of music files.
    I believe, it could be an update, that ruined my project. Current version of qt i'm using is 5.7.0-1. QtCreator version is 4.0.2-1.
    Project is compiled via qmake with

    QT += core gui multimedia
    

    I'm trying to push, for example, following button:

    void MainWindow::on_pushButton_clicked()
    {
        playlist->clear();
        playlist->addMedia(QUrl::fromLocalFile("/home/pchyolki/Music/vk/hiphop/d8bd63191367.mp3"));
        plr->play();
    }
    

    Where plr is an object of QMediaPlayer class and playlist is QMediaPlaylist.
    Nothing happens.
    My text labels, used to get track's duration and current position in seconds show 0:00 / 0:00.

    All I get in app's output is a following warning:

    QObject::startTimer: Timers can only be used with threads started with QThread
    

    but I'm not using any timers anywhere.
    I haven't seen this warning before player stopped working correctly.
    Perhaps there are some internal timers in QMediaPlayer class or smth.
    Anyway, the main feature of my project is now broken and I have no idea what happened though.
    Maybe here I could get some help?
    Thanks in advance!

    raven-worxR 1 Reply Last reply
    0
    • P pchyolki

      Hello, I've been writing an audio player using QT for a while, when suddenly QMediaPlayer stopped to play any kind of music files.
      I believe, it could be an update, that ruined my project. Current version of qt i'm using is 5.7.0-1. QtCreator version is 4.0.2-1.
      Project is compiled via qmake with

      QT += core gui multimedia
      

      I'm trying to push, for example, following button:

      void MainWindow::on_pushButton_clicked()
      {
          playlist->clear();
          playlist->addMedia(QUrl::fromLocalFile("/home/pchyolki/Music/vk/hiphop/d8bd63191367.mp3"));
          plr->play();
      }
      

      Where plr is an object of QMediaPlayer class and playlist is QMediaPlaylist.
      Nothing happens.
      My text labels, used to get track's duration and current position in seconds show 0:00 / 0:00.

      All I get in app's output is a following warning:

      QObject::startTimer: Timers can only be used with threads started with QThread
      

      but I'm not using any timers anywhere.
      I haven't seen this warning before player stopped working correctly.
      Perhaps there are some internal timers in QMediaPlayer class or smth.
      Anyway, the main feature of my project is now broken and I have no idea what happened though.
      Maybe here I could get some help?
      Thanks in advance!

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @pchyolki
      are you sure the multimedia backend plugins are loaded correctly?
      And if yes you have the correct filters/codecs installed?

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      P 1 Reply Last reply
      0
      • raven-worxR raven-worx

        @pchyolki
        are you sure the multimedia backend plugins are loaded correctly?
        And if yes you have the correct filters/codecs installed?

        P Offline
        P Offline
        pchyolki
        wrote on last edited by pchyolki
        #3

        @raven-worx Thanks for a reply!
        qt5-multimedia package is installed in my system. It was updated with bunch of other qt5-related packages.
        All the gstreamer modules are installed as well.
        I see no error output, when run qtcreator from terminal and then run my qt application from it...
        No errors anywhere.
        Is there's a way to check if modules are loaded when app starts?
        And can you tell me anything about this timers warning?

        raven-worxR 1 Reply Last reply
        0
        • jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Try to run your application with QT_DEBUG_PLUGINS=1, see http://doc.qt.io/qt-5/debug.html
          Maybe you have gstreamer 0.10, as far as I know Qt now requires 1.0 (but I'm not sure).

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          P raven-worxR 2 Replies Last reply
          0
          • P pchyolki

            @raven-worx Thanks for a reply!
            qt5-multimedia package is installed in my system. It was updated with bunch of other qt5-related packages.
            All the gstreamer modules are installed as well.
            I see no error output, when run qtcreator from terminal and then run my qt application from it...
            No errors anywhere.
            Is there's a way to check if modules are loaded when app starts?
            And can you tell me anything about this timers warning?

            raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by
            #5

            @pchyolki said:

            Is there's a way to check if modules are loaded when app starts?

            errors won't be generated for most plugins. You can use QT_DEBUG_PLUGINS (set to a non-zero value) env variable and if the corresponding plugin is loaded - in the console.
            Also you can check the QMediaPlayer's error()/errorString() methods. Maybe those give some hints.

            And can you tell me anything about this timers warning?

            No not really. This can be triggered from anywhere in your code. Easiest would be to set a breakpoint in the Qt sources at the position this message is written.

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            0
            • jsulmJ jsulm

              Try to run your application with QT_DEBUG_PLUGINS=1, see http://doc.qt.io/qt-5/debug.html
              Maybe you have gstreamer 0.10, as far as I know Qt now requires 1.0 (but I'm not sure).

              P Offline
              P Offline
              pchyolki
              wrote on last edited by
              #6

              @raven-worx Enabling debug gave me a lot of output, but not a single error.
              Timer warning message is not attached to any string in the code, it just appears at once after I run my project.

              @jsulm I'm using gstreamer0.10 for sure and there is no gstreamer 1.0 available in my distro's repos (arch linux).

              Do you think I need to build my own gstreamer from sources?
              Thanks!

              jsulmJ 1 Reply Last reply
              0
              • P pchyolki

                @raven-worx Enabling debug gave me a lot of output, but not a single error.
                Timer warning message is not attached to any string in the code, it just appears at once after I run my project.

                @jsulm I'm using gstreamer0.10 for sure and there is no gstreamer 1.0 available in my distro's repos (arch linux).

                Do you think I need to build my own gstreamer from sources?
                Thanks!

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @pchyolki I'm not an expert in this area, so I cannot tell you. Maybe somebody else knows more?

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • jsulmJ jsulm

                  Try to run your application with QT_DEBUG_PLUGINS=1, see http://doc.qt.io/qt-5/debug.html
                  Maybe you have gstreamer 0.10, as far as I know Qt now requires 1.0 (but I'm not sure).

                  raven-worxR Offline
                  raven-worxR Offline
                  raven-worx
                  Moderators
                  wrote on last edited by
                  #8

                  @pchyolki said:

                  Enabling debug gave me a lot of output, but not a single error.

                  it's not supposed to give an error. In the output you can check if the multimedia plugin is loaded or not. Look out for plugins loaded from the "mediaservice" folder.

                  Timer warning message is not attached to any string in the code, it just appears at once after I run my project.

                  as the message already says, i would take a look into QObject::startTimer()

                  @jsulm said:

                  Maybe you have gstreamer 0.10, as far as I know Qt now requires 1.0 (but I'm not sure).

                  The QtMultimedia requirements explicitly state that gstreamer 0.10 is supported.

                  --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                  If you have a question please use the forum so others can benefit from the solution in the future

                  P 1 Reply Last reply
                  0
                  • raven-worxR raven-worx

                    @pchyolki said:

                    Enabling debug gave me a lot of output, but not a single error.

                    it's not supposed to give an error. In the output you can check if the multimedia plugin is loaded or not. Look out for plugins loaded from the "mediaservice" folder.

                    Timer warning message is not attached to any string in the code, it just appears at once after I run my project.

                    as the message already says, i would take a look into QObject::startTimer()

                    @jsulm said:

                    Maybe you have gstreamer 0.10, as far as I know Qt now requires 1.0 (but I'm not sure).

                    The QtMultimedia requirements explicitly state that gstreamer 0.10 is supported.

                    P Offline
                    P Offline
                    pchyolki
                    wrote on last edited by pchyolki
                    #9

                    @raven-worx
                    There are many libraries loaded, upon them presents the following one:

                    loaded library "/usr/lib/qt/plugins/mediaservice/libgstmediaplayer.so"
                    
                    

                    I've found out that I currently have two versions of gstreamer installed.
                    Some apps in my system requires package named gstreamer0.10 (version 0.10.36-4) and plugins named like gstreamer0.10-{base,good,bad,ugly}, but some requires just gstreamer (version 1.8.2-1) and plugins named like gst-plugins-{base,good,bad,ugly}

                    package qt5-multimedia depends on:

                    Depends On      : qt5-base  gst-plugins-base-libs  libpulse  openal
                    

                    I've never had problems with that before.
                    I've tried to completely remove one version regardless on depends and then start qtcreator - no success.
                    Removing another version didn't solve the problem either, I've just started to run into different errors on qtcreator's startup and while app was running.
                    Now I'm where it all started, still unable to play any sound.
                    Can someone reproduce my issue with QT version 5.7, gstreamer and qtcreator?

                    PS: As I've already said, I have no timers in any .cpp or .h files.
                    No QObject::startTimer() at all!
                    That's why this message confuses me so much.

                    raven-worxR 1 Reply Last reply
                    0
                    • P pchyolki

                      @raven-worx
                      There are many libraries loaded, upon them presents the following one:

                      loaded library "/usr/lib/qt/plugins/mediaservice/libgstmediaplayer.so"
                      
                      

                      I've found out that I currently have two versions of gstreamer installed.
                      Some apps in my system requires package named gstreamer0.10 (version 0.10.36-4) and plugins named like gstreamer0.10-{base,good,bad,ugly}, but some requires just gstreamer (version 1.8.2-1) and plugins named like gst-plugins-{base,good,bad,ugly}

                      package qt5-multimedia depends on:

                      Depends On      : qt5-base  gst-plugins-base-libs  libpulse  openal
                      

                      I've never had problems with that before.
                      I've tried to completely remove one version regardless on depends and then start qtcreator - no success.
                      Removing another version didn't solve the problem either, I've just started to run into different errors on qtcreator's startup and while app was running.
                      Now I'm where it all started, still unable to play any sound.
                      Can someone reproduce my issue with QT version 5.7, gstreamer and qtcreator?

                      PS: As I've already said, I have no timers in any .cpp or .h files.
                      No QObject::startTimer() at all!
                      That's why this message confuses me so much.

                      raven-worxR Offline
                      raven-worxR Offline
                      raven-worx
                      Moderators
                      wrote on last edited by
                      #10

                      @pchyolki said:

                      PS: As I've already said, I have no timers in any .cpp or .h files.
                      No QObject::startTimer() at all!
                      That's why this message confuses me so much.

                      of course it doesn't mean that you explicitly call this method.
                      You should set a breakpoint on the warning in this method and when it gets hit you check the stack-trace to see where it comes from.

                      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                      If you have a question please use the forum so others can benefit from the solution in the future

                      P 1 Reply Last reply
                      0
                      • raven-worxR raven-worx

                        @pchyolki said:

                        PS: As I've already said, I have no timers in any .cpp or .h files.
                        No QObject::startTimer() at all!
                        That's why this message confuses me so much.

                        of course it doesn't mean that you explicitly call this method.
                        You should set a breakpoint on the warning in this method and when it gets hit you check the stack-trace to see where it comes from.

                        P Offline
                        P Offline
                        pchyolki
                        wrote on last edited by
                        #11

                        @raven-worx please, teach me, how to set a breakpoint on method, when I don't know what method is it!
                        Here's a screenshot of qtcreator's main window.
                        Thanks.

                        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