Forums

OverviewV-Play 2 Support (Qt 5)Android Hardware Volume Buttons › Reply To: Android Hardware Volume Buttons

OverviewV-Play 2 Support (Qt 5)Android Hardware Volume Buttons › Reply To: Android Hardware Volume Buttons
#9818

Günther
V-Play Team

Hi alb!

Sadly, we never encountered a use-case where we had to change this setting with Qt/Qml up until now … maybe you can get an answer on how to do it at the official Qt/Qml support forums.

In case you do not find a good answer, I tried to solve your problem by using a little “hack”:
At least for my android phone and the current qt version, it works if a muted sound is played endlessly in the background of the app. The device is then tricked into thinking that music is playing and lets you control the media volume. (even though nothing can actually be heard)

This is how I did it:

import QtMultimedia 5.0

// ...

Scene {


    BackgroundMusic {
      id: muted_loop
      loops: SoundEffect.Infinite
      muted: true
      source: "../assets/Click1.wav"
    }

    // ...
}

// ...

 

Cheers,

GT

 

 

 

 

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
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support