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. Sound using QMediaPlayer on android
QtWS25 Last Chance

Sound using QMediaPlayer on android

Scheduled Pinned Locked Moved Solved Mobile and Embedded
qmediaplayerandroidmp3
6 Posts 2 Posters 3.1k 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.
  • X Offline
    X Offline
    Xicor
    wrote on 4 Feb 2016, 00:07 last edited by
    #1

    So i am working on a game that needs sound effects. i have gone through a bunch of different methods of playing sound, and i finally managed to play sounds using QMediaPlayer (on pc) with audio files in a resource. Unfortunately this doesn't seem to be working at all on android (there is no sound). any ideas?

    i did a lot of googling on this and i dont think anyone has come up with a real answer that just works.

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on 4 Feb 2016, 01:02 last edited by
      #2

      Hi, and welcome to the Qt forum! Have you tried QAudioOutput? Should be working on Android since Qt 5.2 (see: http://doc.qt.io/qt-5/whatsnew52.html).

      X 1 Reply Last reply 4 Feb 2016, 01:16
      0
      • ? A Former User
        4 Feb 2016, 01:02

        Hi, and welcome to the Qt forum! Have you tried QAudioOutput? Should be working on Android since Qt 5.2 (see: http://doc.qt.io/qt-5/whatsnew52.html).

        X Offline
        X Offline
        Xicor
        wrote on 4 Feb 2016, 01:16 last edited by
        #3

        @Wieland does it work with files in the resources? also it seems much more complicated than just passing a qrc url into a set function and then calling play.

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on 4 Feb 2016, 01:38 last edited by
          #4

          QMediaPlayer should also work (https://www.kdab.com/qt-on-android-episode-1/)... Are you sure your Android device has the necessary codecs installed?

          does it work with files in the resources?

          Can't test it right now but I don't see a reason why it shouldn't work as it operates on QIODevice.

          X 1 Reply Last reply 4 Feb 2016, 01:50
          0
          • ? A Former User
            4 Feb 2016, 01:38

            QMediaPlayer should also work (https://www.kdab.com/qt-on-android-episode-1/)... Are you sure your Android device has the necessary codecs installed?

            does it work with files in the resources?

            Can't test it right now but I don't see a reason why it shouldn't work as it operates on QIODevice.

            X Offline
            X Offline
            Xicor
            wrote on 4 Feb 2016, 01:50 last edited by
            #5

            @Wieland okay, i read up on the topic a little more, it seems like there is some sort of bug with setting the volume using setVolume on QMediaPlayer. i had to manually set the volume on a different program. is there a way to classify your qt app as a media program so it knows to change media volume? if i hit the volume rocker it increases my notification sound but not media sound.

            ? 1 Reply Last reply 4 Feb 2016, 01:54
            0
            • X Xicor
              4 Feb 2016, 01:50

              @Wieland okay, i read up on the topic a little more, it seems like there is some sort of bug with setting the volume using setVolume on QMediaPlayer. i had to manually set the volume on a different program. is there a way to classify your qt app as a media program so it knows to change media volume? if i hit the volume rocker it increases my notification sound but not media sound.

              ? Offline
              ? Offline
              A Former User
              wrote on 4 Feb 2016, 01:54 last edited by
              #6

              @Xicor I have no idea, sorry. Maybe someone else knows that.

              1 Reply Last reply
              0

              3/6

              4 Feb 2016, 01:16

              • Login

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