dmunozv04 / iSponsorBlockTV

SponsorBlock client for all YouTube TV clients.
GNU General Public License v3.0
2.16k stars 89 forks source link

mute unskippable ads not working #60

Open 24fpsDaVinci opened 8 months ago

24fpsDaVinci commented 8 months ago

during unskippable ads, the volume level box on top of the screen shows 0, but real volume does not change.

apple tv 4k 2022 tvos 17.1 beta running through docker on ubuntu server 23.10

dmunozv04 commented 8 months ago

That’s really odd, I have only seen it happen a handful of times on an apple tv 4k 2022 in all the testing I’ve done. The fact that the volume box appears suggests that the YouTube client is receiving the mute command, but something is preventing it from working. Does this happen on every ad?

24fpsDaVinci commented 8 months ago

a few scenarios I tested:

  1. homepod stereo pair as default audio output: not muting on all ads
  2. airpods as bluetooth audio output: muting seems to work on all ads
  3. TV speakers as default output: muting seems to works on all ads

the volume box appears in all 3. for 2 and 3 mute happens 1-2 seconds after the ad starts playing, not immediately.

dmunozv04 commented 8 months ago

Apparently YouTube volume controls don’t seem to work with AirPlay audio. The delay on cases 2-3 will depend on your internet connection. Sadly it looks like there’s not much I can do about muting with AirPlay, as it just ignores the volume set in YouTube

Flute7 commented 8 months ago

I can confirm the same happening with HomePod Mini stereo pair and ATV 4K 2021. Happy to provide assistance in any way I am able if anyone has an idea on how to work around this issue.

JayHCloud commented 6 months ago

I notice that the issue occurs frequently with runs of 2+ ads. The first ad will often mute successfully. If the next call to mute fails, the volume is turned back on and the remaining ads will play unmuted. The volume box will appear for each unsuccessful mute attempt. After the final ad plays, the volume box will show mute again then unmute itself quickly before the video begins.

Under those circumstances, the console shows:

Getting segments for next video: videohere
Ad has started, muting
Command failed
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/pyytlounge/wrapper.py", line 547, in _command
    resp.raise_for_status()
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1062, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 401, message='RID_OUTSIDE_WINDOW', url=URL('https://www.youtube.com/api/lounge/bc/bind?device=REMOTE_CONTROL&name=iSponsorBlockTV&app=youtube-desktop&loungeIdToken=tokenhere)
Connected to device YouTube on TV (YouTube on TV)

An error free run will look something like:

Connected to device YouTube on TV (YouTube on TV)
Ad has started, muting
Getting segments for next video: videohere
Ad has started, muting
Ad has started, muting
Playing videohere with 0 segments

Apple TV:
 Apple TV 4k A1842 and A2737 tvOS 17.0 on both

dmunozv04 commented 6 months ago

I notice that the issue occurs frequently with runs of 2+ ads. The first ad will often mute successfully. If the next call to mute fails, the volume is turned back on and the remaining ads will play unmuted. The volume box will appear for each unsuccessful mute attempt. After the final ad plays, the volume box will show mute again then unmute itself quickly before the video begins.

Under those circumstances, the console shows:

Getting segments for next video: videohere
Ad has started, muting
Command failed
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/pyytlounge/wrapper.py", line 547, in _command
    resp.raise_for_status()
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1062, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 401, message='RID_OUTSIDE_WINDOW', url=URL('https://www.youtube.com/api/lounge/bc/bind?device=REMOTE_CONTROL&name=iSponsorBlockTV&app=youtube-desktop&loungeIdToken=tokenhere)
Connected to device YouTube on TV (YouTube on TV)

An error free run will look something like:

Connected to device YouTube on TV (YouTube on TV)
Ad has started, muting
Getting segments for next video: videohere
Ad has started, muting
Ad has started, muting
Playing videohere with 0 segments

Apple TV:
 Apple TV 4k A1842 and A2737 tvOS 17.0 on both

That seems to be unrelated to the AirPlay problem (since it’s muting the first one successfully), and appears to be an issue that is already solved on V2.0.4 (which came out yesterday). Please try with the latest version and let me know if this still happens

JayHCloud commented 6 months ago

My mistake. I pulled this a while ago and only spun it up yesterday. I updated my container to the current version. The second and third ad will still unmute. But now it will attempt to mute again after some delay, generally 5-7 seconds. It's usually successful

On the occasions where it's not successful, it will prioritize another mute attempt over skipping. For example, i had a 90 second ad run that finally managed to mute itself after 20 seconds. However by then, the skip button was available and it chose to and let the run finish on mute instead of just skipping. You're right, its unrelated to airplay. I tested on a google tv and found similar behavior. Should i make a new issue for this?