I have a soundtrack to be played through the run time as the main theme:
App{
...............
Audio{
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>
<div class=”post-taglist grid gs4 gsy fd-column”>I tried changing the code to this:</div>
<div>
Audio{
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?
</div>