Closed rohmishra closed 4 years ago
Ok so my mistake, i did some more research and found that GSConnect starts MediaPlayer2 Player with 1.0 irrespective of volume set on phone even though it gets that data from KDE Connect.
This issue #23 may be why mpris-indicator sets the volume to full:
1st a little bit of background. Volume is a read/write MPRIS property. Unfortunately it's broken in at least a few players (Spotify for example) and there's no real good way to tell if it really works other than to poke the property and see if it causes the player to emit a property changed signal. Basically I read the property change it by +/-0.1 and then change it back to it's initial amount when the MPRIS interface shows up
GSConnect will transmit any changes to volume but doesn't correctly start with correct value set. I'll Close this issue and start a new one with GSConnect.
mpris indicator changing volume to get volume increases the volume to maximum for GSConnect Players.
https://github.com/andyholmes/gnome-shell-extension-gsconnect/releases/tag/v40 fixes the issue with volume not being read which means the volume values are correctly available.
@rohmishra Is there a reason you reopened this issue?
With v40 (and above) GSConnect now reports the correct volume when Volume is read but when using with mpris-indicator, Volume is set to 1 or max Volume irrespective of current Volume. Disabling mpris-indicator and using D-Feet to check value for MediaPlayer2 Volume reports the correct Volume as set on device.
Well for a split second when it creates the interface it must be reporting full volume. The code to poke the volume property is here:
_testVolume() {
// This should cause a Volume props change signal
// if the player's Volume prop works correctly,
// which in turn should cause the volume slider to show itself.
// Spotify's Volume prop is broken for example so the volume slider
// remains hidden since it's pointless to show a widget that doesn't do anything...
if (this._playerProxy.Volume) {
let initialVolume = this._playerProxy.Volume || 0.0;
this._playerProxy.Volume = initialVolume <= 0.0
? 0.1
: initialVolume >= 1.0
? 0.9
: Math.min(initialVolume - 0.1, 0.0);
this._playerProxy.Volume = initialVolume;
}
}
Yep sure does:
See:
get Volume() {
if (this._Volume === undefined)
this._Volume = 1.0;
return this._Volume;
}
Not my bug.
The solution would be to make sure all the properties where populated before the interface was put up instead of putting up an interface with yet undefined property values.
Describe the bug
When GSConnect is setup and you have a music already playing and you either power on your device or resume, MPRIS plugin sets the volume at full causing audio to unexpectedly rise on mobile phone.
Steps To Reproduce:
(Requires GSConnect to be configured)
Expected behavior
MPRIS plugin should show the actual volume set instead of increasing it to full by default.
Logs
(the type kdeconnect lines are GSConnect) (GSConnect gets its volume data from the phone , the last line)
System Details (please complete the following information):
Additional Notes: