Closed fennabe closed 3 years ago
I'm not sure if this is related, but I found that Device.sessions
only returns active (those which are currently playing audio) sessions. It's because of the second condition in this statement. Removing it will return the same devices as the volume mixer.
With that change, I'm also able to control the volume of inactive sessions:
const {default: SoundMixer, DeviceType} = require("native-sound-mixer");
function main() {
const d = SoundMixer.getDefaultDevice(DeviceType.RENDER)
const sess = d.sessions.find(d => d.path == APPLICATION_PATH)
sess.mute = false;
}
main()
@m1dugh what do you think? Should Device.sessions
return inactive sessions too? I can make a PR.
@hi019 This could be a good change and just takes the removal of a single line of code. However, As the typescript code does not include a state value in AudioSession
, we should add it. I'll be working on it.
I added all sessions in Device.sessions
, you can now change the volumes and mute flags of inactive and expired sessions.
Cool! I think we can close this now.
When I try to change the volume for an application (ex. Chrome), the volume in volume mixer only changes if Chrome is actively playing audio. If the audio (in Chrome) is paused or stopped, the slider in volume mixer won't change when I try to adjust volume with this node package.
Is it possible to allow volume changes even if there is no audio playing? (but there previously was, so the session still exists)