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
Forum Updated to NodeBB v4.3 + New Features

Sound using QMediaPlayer on android

Scheduled Pinned Locked Moved Solved Mobile and Embedded
qmediaplayerandroidmp3
6 Posts 2 Posters 3.1k Views 2 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.
  • X Offline
    X Offline
    Xicor
    wrote on 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 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
      0
      • ? A Former User

        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 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 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
          0
          • ? A Former User

            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 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
            0
            • X Xicor

              @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 last edited by
              #6

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

              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