OverviewFelgo 2 Support (Qt 5) › Audio keeps playing when app is in the background

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #22569


    I have a soundtrack to be played through the run time as the main theme:

            source: "../assets/Art Of Silence_V2.mp3"
            autoPlay: true
            loops : Audio.Infinite

    <div class=”post-text”>

    How do I stop it from playing when the app is in the background and resume it afterwards?

    <div class=”post-taglist grid gs4 gsy fd-column”>I tried changing the code to this:</div>

            readonly property bool forground : Window.visibility !== Window.Minimized &&
                                                 Window.visibility !== Window.Hidden
            source: "../assets/Art Of Silence_V2.mp3"
            autoPlay: true
            loops : Audio.Infinite
            onForgroundChanged: { forground ? start() : stop() }

    SinceAppĀ is a subclass of Window it should have worked but it didn't, what can I do?




    Felgo Team

    I guess you need too give your App component an id, e.g. “app” and then you can check app.visibility.

    Also you can use onApplicationPaused and onApplicationResumed signal handlers of the App component.

    Alternatively you can also use the BackgroundMusic component, which already handles this for you.


Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
create apps
create games
cross platform
native performance
3rd party services
game network
level editor
easiest to learn
biggest time saving
best support