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. Qt Quick iOS: How to keep audio playing while app is in background
QtWS25 Last Chance

Qt Quick iOS: How to keep audio playing while app is in background

Scheduled Pinned Locked Moved Mobile and Embedded
8 Posts 4 Posters 3.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.
  • J Offline
    J Offline
    julienchevet
    wrote on 26 Aug 2014, 15:12 last edited by
    #1

    I'm developing a WebRadio application in qml for iOS devices. To play the audio stream I use the MediaPlayer type which works fine.

    However, in iOS, when I switch to another application or go back to home, in other words when the app go to background, the sound is cut whereas I would like to keep it playing.

    I know how to do it in objective-C by activating the AVAudioSession and add the audio background mode the info.plist file.

    But I really don't know how to do it in qml.

    Can someone help ?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 26 Aug 2014, 20:16 last edited by
      #2

      Hi and welcome to devnet,

      The modification of Info.plist is still a valid thing to do. As for AVAudioSession, you will have to write some native code (e.g. a little wrapper class)

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

      R 1 Reply Last reply 10 Apr 2015, 11:52
      0
      • J Offline
        J Offline
        julienchevet
        wrote on 27 Aug 2014, 08:11 last edited by
        #3

        Thanks for the welcome.

        How can I do a little wrapper class with native iOS code.

        Have you got some exemples ?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 27 Aug 2014, 09:16 last edited by
          #4

          You can take a look at the qtmacextras module, it uses Objective-C++

          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
          • S SGaist
            26 Aug 2014, 20:16

            Hi and welcome to devnet,

            The modification of Info.plist is still a valid thing to do. As for AVAudioSession, you will have to write some native code (e.g. a little wrapper class)

            R Offline
            R Offline
            renatobibiano
            wrote on 10 Apr 2015, 11:52 last edited by
            #5

            @SGaist I've changed the ingo.plist but my audio is still pausing when I put my app on background, what should I do?

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 11 Apr 2015, 23:33 last edited by
              #6

              Did you also setup the AVAudioSession ?

              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
              • F Offline
                F Offline
                felix99
                wrote on 23 Jul 2015, 03:12 last edited by felix99
                #7

                @SGaist ,I meet the same situation, would you like help me?
                The info.plist added audio background mode already.
                The QML by QT 5.5 is:

                Window {
                    visible: true
                    Audio{
                        id: playMusic
                        source: "test.wav"
                    }
                    MainForm {
                        anchors.fill: parent
                        mouseArea.onClicked: {
                            playMusic.play();
                        }
                
                    }
                }
                

                Thank you!

                1 Reply Last reply
                0
                • F Offline
                  F Offline
                  felix99
                  wrote on 24 Aug 2015, 17:01 last edited by
                  #8

                  It can be solved by this link:

                  https://bugreports.qt.io/browse/QTBUG-42934

                  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