stijnvdb88 / Snap.Net

A cross-platform control client and player for https://github.com/badaix/snapcast
GNU General Public License v3.0
119 stars 11 forks source link

Error message waking up - Auto remove possible? #6

Closed almostserious closed 4 years ago

almostserious commented 4 years ago

When the PC wakes up from sleep (with snap.net running) The first connection always fails and i get the following error message: image

Usually it connects with the following tries. However, the error message remains.

Would it be possible to either: 1.Not show the error message if a successful connection was achieved with the following tries? 2.Remove the message after some time automatically?

Its set to auto restart on error with 3 attempts.

stijnvdb88 commented 4 years ago

Thanks! Great suggestions both - will be included in the next release :)

PD75 commented 4 years ago

This could also be a workaround for my problem: https://github.com/badaix/snapcast/issues/657

In Windows, I use HDMI for sound. Whenever Kodi starts, or I switch to console or TV, SnapClient crashes. And then I have to either reboot the computer or find my keyboard. This also some times happens when I switch to music mode (only Amp, no TV).

Basically the Audio Output disappears for a short time.

Maybe a retry more infrequently when it has been off for a longer period of time. Like every 30 sec, or check for the audio source first.

stijnvdb88 commented 4 years ago

@PD75 what's the error message Snap.Net shows in your case? Do you ever get the one below, or just a "device invalidated" wasapi error?

image

PD75 commented 4 years ago

@stijnvdb88 I get the message you have. Annotation 2020-06-30 203232

Also it wants to remove the device from Autoplay. Annotation 2020-06-30 203135

stijnvdb88 commented 4 years ago

@PD75 thanks - that means your issue is a bit different, it won't be solved by changing how the error messages show up.

The current flow is:

  1. detect audio device
  2. attempt to start snapclient for device
  3. if process crashes, show error and repeat flow

The catch here is that it only retries if the second step failed. If the first step fails, we show the "would you like to remove this device from auto-start" dialog and bail. In other words, the moment a device was no longer detected, the retry loop is stopped entirely. That's less than ideal for hdmi devices which are apt to disappear every once in a while :) I'll add an extra setting to optionally make it look for the device every x seconds like you suggested, along with flags for suppressing those error messages.

PD75 commented 4 years ago

Thanks!

stijnvdb88 commented 4 years ago

Hi! I just added a pre-release which hopefully solves these issues for both of you :) https://github.com/stijnvdb88/Snap.Net/releases/tag/v0.20.01

You now have more control over how notifications work, and what happens when a devices goes missing: image

Combined with the existing "Auto-restart on error" check, this should make Snap.Net a lot more robust. Whenever anything goes wrong it'll auto-recover as soon as it's able to, without requiring action from the user. image

Please take a look and let me know!

almostserious commented 4 years ago

Thanks, waking up the PC now will first play the sound, then the error pops up, is removed automatically and after that it will reconnect and the music resumes :) Very nice.

PD75 commented 4 years ago

Thanks, I am testing in teh background (first workday after vacation so super busy). It crashed once, but I need to investigate why and how. I hope it is OK that I take a few days to check.

PD75 commented 4 years ago

@stijnvdb88 seems to work like a dream, I have not had to go into the gui of the computer since I installed it. I have watched netflix on my xbox over lunch then switch back to the computer sound only and it works.

Thanks!!!

stijnvdb88 commented 4 years ago

Great to hear! Thanks again to both of you for reporting these issues!