8000 Fix unmute bug in vlc_telnet by dmcc · Pull Request #48441 · home-assistant/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix unmute bug in vlc_telnet #48441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions homeassistant/components/vlc_telnet/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ def set_volume_level(self, volume):
self._vlc.set_volume(volume * MAX_VOLUME)
self._volume = volume

if self._muted and self._volume > 0:
# This can happen if we were muted and then see a volume_up.
self._muted = False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there no feedback on mute state that we can get from vlc on update?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good question. I've looked at the output of VLCTelnet.status() and VLCTelnet.info(), but didn't find anything relevant. AFAICT, the VLC telnet protocol doesn't ever tell us if VLC is actually muted so this seems to be a deeper problem.

Seems we'd want to use https://pypi.org/project/python-vlc/ for this type of control.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, that library is using the c-bindings so is out of scope for this integration.

Instead of using a separate variable for muted I suggest we check if self._volume equals 0. The volume attribute is updated by the update method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, not sure I understand. Would that check mean that if the user sets the volume to 0 in VLC, Home Assistant would detect VLC as muted? If so, what would the behavior be if the user clicks unmute in Home Assistant?

Incidentally, here's another possible direction: We remove SUPPORT_VOLUME_MUTE from vlc_telnet entirely (since VLC doesn't actually support this and we're essentially simulating mute...).

(and yes, switching to the CTypes lib would be a totally separate integration -- probably not worth it if the only benefit is adding mute support :))

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. We probably wouldn't have added mute support today simulated like this, but removing it now is also a breaking change. We have some simulated features in the base media player class so we're a bit more flexible it seems for the media player. I'm ok with this fix.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The vlc integration uses the c-bindings library.

https://www.home-assistant.io/integrations/vlc/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Martin!

The vlc integration uses the c-bindings library.

Indeed! I'll have to revisit using that integration in my setup -- I forget why I settled on the telnet one of all things :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to have the vlc application installed on the same host as Home Assistant for that integration. I think that may be a major limitation for some users.


def media_play(self):
"""Send play command."""
self._vlc.play()
Expand Down
0