iBicha / playlet

The unofficial, privacy driven, YouTube client for Roku
GNU Affero General Public License v3.0
280 stars 11 forks source link

Device connected notification repeats when casting from YouTube app #303

Closed titan99855 closed 4 months ago

titan99855 commented 4 months ago

When casting from the official YouTube Android app to Playlet, a notification that my phone has connected pops up on Playlet when my phone connects as expected. While playing a video, this notification will come back randomly, sometimes it takes a few minutes and sometimes a few seconds. It's a minor issue but the popups are a bit distracting.

Also I would like to say thank you and that I really appreciate the work you have put into this project as YouTube is practically unwatchable using the official client.

iBicha commented 4 months ago

Thanks for your kind words, and thanks for raising the issue. I have not experienced this kind of excessive notifications, but if they are to the point of appearing every few minutes/seconds, that would be too much. I will look into it, and consider either

May I ask about the phone model you're using that's causing this? Thanks

iBicha commented 4 months ago

I can easily reproduce this behaviour on my Android phone, by either force quitting the app, or disconnecting the network and back. Both trigger remote connected events. Interestingly enough, YouTube TV app does not do this, and only shows the notification when I'm actually connecting, not when my phone loses the connection. So they either have some sort of timer before considering the device "actually disconnected" or they are using a newer version of the protocol where the specify the reason of the disconnect/reconnect, and only show the notification on manual connects (at least for me, I don't identify a difference between the two events). I'll keep an eye on this.

titan99855 commented 4 months ago

This is happening on a Nokia G50 phone. I noticed it seems to happen more when the phone is locked but I haven't been able to consistently reproduce it. I'll try it with some other devices too. Thanks for looking into it.

iBicha commented 4 months ago

I just pushed a fix that I think will address this. Please try out the Canary version if you can to confirm this fixes your issue, and I will create a patch release soon if it does. Thanks

iBicha commented 4 months ago

Fix released in 0.20.1

titan99855 commented 4 months ago

I tried the canary (0.20.0) and the latest as of this post (0.20.1) but it's still happening for me. I'll try to test it on another Roku with another phone on a different Wifi access point to see if it's something on my end.

iBicha commented 4 months ago

Every time an event is triggered (device connects, disconnects, etc) is logged to the log file (http://ROKU_IP_ADDRESS:8888/logs/app_logs.txt). You can take a look to see if there's any interesting pattern. Also feel free to share your logs (by email if you prefer) and I can take a look. When I looked at my own logs, I noticed that phones fire a "connect" event, but when the lose connection and connect again, they fire another "connect" event. Only when the phone explicitly disconnect by the user the "disconnect" event happens. That was the basis of the fix, but perhaps I was wrong.

iBicha commented 4 months ago

Ok I think I've seen a device disconnect and connect multiple times during (what I think) a short period. Perhaps a resolution is to not show a notification for a specific device until 30 minutes are passed.

iBicha commented 4 months ago

Implemented the 30 minute timeout for notifications (Now in Canary builds)