dmunozv04 / iSponsorBlockTV

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

Disable Autoplay #82

Closed Tone866 closed 3 days ago

Tone866 commented 8 months ago

Since I connected my TV with iSponsorBlockTV, autoplay on youtube is enabled.

I checked the settings in my youtube app and there autoplay is disabled. So it must come from iSponsorBlockTV.

It would be nice to control autoplay over the settings file.

dmunozv04 commented 8 months ago

That's something I didn't consider, but it seems like it can be detected to maintain autoplay settings when using iSponsorBlockTV

tgkenney commented 8 months ago

I've got the opposite problem here, I do have autoplay enabled in youtube settings, but since setting this up videos aren't autoplaying anymore. It would definitely be nice for iSponsorBlockTV to not mess with that setting and just leave it be

dmunozv04 commented 8 months ago

@tgkenney iSponsorBlockTV doesn’t touch those settings but somehow they get modified

tgkenney commented 8 months ago

Yeah just seems like something weird is going on. For what it's worth, I didn't get this behavior using V1, it only started when I migrated to V2. Though that probably comes down to the different connection method

dmunozv04 commented 8 months ago

@tgkenney v1 didn’t interact with YouTube, to the point that it could be any other app. V2 uses a YouTube specific feature that has some quirks. Autoplay seems to be one of them. Please test the new version to see if that works

tgkenney commented 8 months ago

I just did some quick testing, using v2.0.2 of the docker image.

Edit to add: This is all on a Apple TV 4k

dmunozv04 commented 8 months ago

@tgkenney that’s super odd. I’ve been using it for a few months on an Apple TV 4K with autoplay on and it’s always moved to the next video (albeit with the 5 second countdown)

tgkenney commented 8 months ago

I'm using version 3.01.12 of the YouTube app, and TvOS 17. I wonder if it something with those versions?

Tone866 commented 8 months ago
  • When autoplay is disabled in Youtube and the container is running: The video ends and it recommends a different video but doesn't autoplay (as expected)

It doesn't work like that for me. I'm also using the 2.0.2 docker image. The only difference is that my client is a LG TV with webos 4.

CDeLeon94 commented 8 months ago

The youtube app on iphone has an autoplay setting "Mobile phone/tablet"

My TV keeps autoplaying, and that setting was previously enabled. (Disabling it made no difference) I wonder if the state of that switch plays a factor somehow when setting up iSponsorBlockTV

dmunozv04 commented 8 months ago

It shouldn’t make a difference. Somehow, I’m able to use the autoplay toggle on the YouTube app (with the v2.0.4 version) and it seems to just work; toggling autoplay correctly

etienn01 commented 8 months ago

On CCwGTV, can't get rid of autoplay as well, whatever the autoplay setting in the Android TV app or the mobile app. I tried v2.0.2 and the develop tags of the Docker image (which should include this commit 50b71d9f5c7f7522f33d751eec81f166a8b6f4b8) and it made no difference.

dmunozv04 commented 8 months ago

The “fix” I attempted on the develop tag seems to not work for me. Additionally, I’ve tried setting autoplay to off on a Tizen TV and it’s not working for me even without iSponsorBlockTV. This is just very confusing since it looks like different devices handle this differently

simphide commented 8 months ago

I can report the same problem on my AppleTV. Videos are now beeing autoplayed eventhough the settings are turned off...

berstend commented 8 months ago

Can confirm this issue with a Shield TV - in the YT app autoplay was turned off and once iSponsorBlockTV became active in the network (working great for skipping segments) videos are now autoplaying (with the setting still being off).

AN1MATEK commented 7 months ago

I also have the same issues with an ATV 4K 2022.

dmunozv04 commented 6 months ago

If you're still experiencing issues with autoplay follow these steps:

  1. Update iSponsorBlockTV to the latest version (should be 2.0.4)
  2. Reset your YouTube app: open the YouTube app on your device/TV, go to settings, go down to reset app, and select that option. WARNING: you'll need to log in again to your YouTube account
  3. Add the device again to iSponsorBlockTV, since resetting the app also resets the screen id

Please let me know if autoplay is still broken after following ALL the steps

Tone866 commented 6 months ago

If you're still experiencing issues with autoplay follow these steps:

  1. Update iSponsorBlockTV to the latest version (should be 2.0.4)
  2. Reset your YouTube app: open the YouTube app on your device/TV, go to settings, go down to reset app, and select that option. WARNING: you'll need to log in again to your YouTube account
  3. Add the device again to iSponsorBlockTV, since resetting the app also resets the screen id

Please let me know if autoplay is still broken after following ALL the steps

I followed your guide and autoplay is still enabled on my tv.

bdougherty commented 6 months ago

Same here. I even tried enabling autoplay and then disabling it again in the settings and that did not fix either. I'm on an Apple TV.

sejmann commented 6 months ago

tldr: same here; still causing forced autoplay Long version: Using 2.0.4 on the latest Apple TV 4K (w/ A15) and the latest public beta (17.3) version of TVOS and the latest youtube apple TV (4.22.01/web_20231213_10_RC002) app, as soon as the "mobile" iSponsorBlockTV is connected, auto play is behavior is enabled via the remote link somehow. Resetting and repairing iSponsorBlockTV doesn't help.

@dmunozv04 -- as a work around until this can be fixed, can a STOP optionally be sent automatically within 5 seconds of video end?

Adithyan007hack commented 5 months ago

Is there an update on this situation? because it still autoplays for me

dmunozv04 commented 5 months ago

I've been experimenting but haven't been able to make it work consistently

TylerJaacks commented 5 months ago

Does if have something to do with this


        elif event_type == "autoplayUpNext":
            if len(args) > 0 and (
                vid_id := args[0]["videoId"]
            ):  # if video id is not empty
                print(f"Getting segments for next video: {vid_id}")
                create_task(self.api_helper.get_segments(vid_id))```
dmunozv04 commented 5 months ago

That shouldn’t modify anything, it just requests the segments on the sponsorblock database

TylerJaacks commented 5 months ago

So I was looking at the pyytlounge code and the youtube lounge api documentation. I see this

Set autoplay
Video Play
command name = `setAutoplayMode`
&count=1
&autoplayMode=ENABLED / ENABLED or DISABLED

it seems that is what is happening here

    async def set_auto_play_mode(self, enabled: bool):
        await super()._command(
            "setAutoplayMode", {"autoplayMode": "ENABLED" if enabled else "DISABLED"}
        )
POST https://www.youtube.com/api/lounge/bc/bind
content-type:application/x-www-form-urlencoded
name=devicename&app=app_name&loungeIdToken=loungeToken
234
[[0,[\"c\",\"FEWWEFWEFWEF\",\"\",8]]
,[1,[\"S\",\"wefwefwef\"]]
,[2,[\"loungeStatus\",{}]
,[3,[\"playlistModified\",{\"videoIds\":\"\"}]]
,[4,[\"onAutoplayModeChanged\",{\"autoplayMode\":\"UNSUPPORTED\"}]]
,[5,[\"onPlaylistModeChanged\",{\"shuffleEnabled\":\"false\",\"loopEnabled\":\"false\"}]]
]

I'm wondering if its possible to spoof the api into thinking the device doesn't support autoplay.

TylerJaacks commented 5 months ago

or never mind couldn't u just process this event onAutoplayModeChanged cause it doesn't look like that is currently happening.

dmunozv04 commented 5 months ago

I attempted processing that event, and it managed to disable autoplay for people that wanted it enabled and also keep autoplay enabled for the ones that didn't want it. Feel free to experiment with it and report back, maybe it works now

TylerJaacks commented 4 months ago

@dmunozv04 do u have the code that you used?

dmunozv04 commented 4 months ago

@dmunozv04 do u have the code that you used?

https://github.com/dmunozv04/iSponsorBlockTV/blob/8ab9cf951920f61d5130191f87ded00fe2a18e70/src/iSponsorBlockTV/ytlounge.py#L116 This is what I tried

TylerJaacks commented 4 months ago

ok I added elif event_type == "setAutoplayMode": data = args[0] print(data) and this seems to disable them for me what is what I want, so I just forked for my self.

dmunozv04 commented 4 months ago

@TylerJaacks is that event reliably called every time a new lounge connection is established? If so, that might fix it for everyone

TylerJaacks commented 4 months ago

i will have to do some testing this weekend.

TylerJaacks commented 4 months ago

cause u probably could just and the event_type = setAutoplayMode and the toggle variable and maybe that will work.

FarawaySounds commented 3 months ago

Did this work?

TylerJaacks commented 3 months ago

i believe so

FarawaySounds commented 3 months ago

I wasn't able to get your suggested solution to work.

However I think I found something that does.

elif event_type == "onAutoplayModeChanged":
            create_task(self.set_auto_play_mode(False))

This seems to work consistently as the onAutoplayModeChanged event is called regularly. You could have it enable/disable if there was an option in the settings that would change what bool value was passed into the set auto play mode method.

TylerJaacks commented 3 months ago

Nice

sejmann commented 3 months ago

I tried @FarawaySounds' change, and it seems to work well most of the time on my Apple TV. and instead of showing the post-video screen (that allows replay), it exits to the main list screen, which I'm okay with. Once during my testing, one video ended, but the audio repeated from the beginning while the screen showed the post-video screen. It was a Jimmy Kimmel clip, but had no sponsors, and I'd jumped around a bit, and maybe that confused the YouTube.app. (https://www.youtube.com/watch?v=F7iANkAUB_k). Anyone else see any rare odd behavior?

Anyway, maybe this works well enough to be merged, if it has a flag in the config.json, or something?

mureev commented 1 month ago

it would be nice to use suggested change with the docker image. did anyone forked/pushed already?

dmunozv04 commented 1 month ago

I've pushed a new version, it might help with autoplay issues, regardless if you want it to be ON or OFF. Please toggle autoplay at least one time after updating and let me know if it fixes the issues

Tone866 commented 1 month ago

I've toggled it in the tv app, but it's still enabled. Do I have to change something in the settings of isponserblocktv?

dmunozv04 commented 1 month ago

I've toggled it in the tv app, but it's still enabled. Do I have to change something in the settings of isponserblocktv?

I've done some testing, and after updating and toggling autoplay on and off again, the video end screen would show a "next up" message instead of "playing in x seconds". Please make sure that you have the latest version

Tone866 commented 1 month ago

I updated to 2.0.8 today On my device it still starts the next video in 5 seconds

the8thsign commented 1 month ago

My experience has been it has not been fixed. Updated to 2.0.8, restarted the Youtube app on Apple TV. Set autoplay from on to off, then off to on, one last time. Restarted the YT app and tested with 3 videos. All had autoplay enabled.

taylorthurlow commented 1 month ago

No luck here either.

RareBirdMe commented 4 weeks ago

Same issue on Sony Android TV. Autoplay in the youtube app is set to off but after the end of the video 5-sec autoplay countdown starts, with a note to prevent playing the next video "press the stop button on the mobile device" (which is obviously iSponsorBlockTV service).

Also, it looks like all the videos played in the current session are stored in a separate playlist (accessible when pausing a video, under the controls section). Possibly the autoplay is somehow active with regard to this playlist.

Latest version. Tried toggling it on and back off on the TV app, no effect.

dmunozv04 commented 3 days ago

This is now fixed on v2.1.0 . Set the new config option auto_play to your desired choice!

AN1MATEK commented 1 day ago

Unfortunately it still autoplays for me on a ATV (I did edit the config file with the new option).

Should I open a new issue? What information can I provide for debugging?

the8thsign commented 1 day ago

@AN1MATEK Make sure you are using auto_play and not autoplay. The config.json template has the wrong one. Also restart both iSponsorBlockTV and the Youtube app after the change.

dmunozv04 commented 1 day ago

Unfortunately it still autoplays for me on a ATV (I did edit the config file with the new option).

Should I open a new issue? What information can I provide for debugging?

@AN1MATEK do please open a new issue if you still are having problems