ReVanced / revanced-patches

🧩 Patches for ReVanced
https://revanced.app
GNU General Public License v3.0
2.3k stars 268 forks source link

feat(YouTube): Use cast V1 on non-rooted builds #2323

Open Canny1913 opened 2 years ago

Canny1913 commented 2 years ago

Type

Functionality

Issue

Currently, cast is entirely disabled on the non-rooted variant even if cast V1 works without an issue. This is obviously not ideal.

Feature

Modify microg-support patch and only enable cast V1.

Motivation

Play Services have the ability to fallback to using V1 if V2 is disabled. This way cast can function perfectly even if only V1 is enabled.

Additional context

Removing cast V2 function completely causes the cast button to break. Alternative solution: shortcut icon to link to a TV which is available in the settings.

jr1221 commented 2 years ago

Does the code for cast V1 even exist in youtube?

Canny1913 commented 2 years ago

Yes it still exists.

Joomsy commented 2 years ago

Seconding this request. Alternative clients like SmartTubeNext and Kodi's YouTube addon rely on V1 in order to be discoverable.

masterflitzer commented 2 years ago

I made an alternative suggestion in this issue 78 might be a sufficient workaround for most people (including me)

Virusmater commented 2 years ago

Were using Vanced with MicroG on non-rooted phone for years and casting to SmartTubeNext without any problems. Would love to have the cast button back.

Virusmater commented 2 years ago

Found on reddit, it is possible to bring back cast icon and it works fine with SmartTubeNext

You have to go to the "Revanced settings --> layout settings" then activate the "cast button" option, then on the chromecast navigate to set --> tv code.  add this tv code after clicking on cast in Revanced,
and you're done.
masterflitzer commented 2 years ago

yes you're right, hide cast button seems to just hide it but with the option to change it back

my suggestion is therefore not needed at all

i think when we don't include hide cast button patch explicitly (only microg patch) the cast button should stay enabled with the option to disable it

Joomsy commented 2 years ago

Found on reddit, it is possible to bring back cast icon and it works fine with SmartTubeNext

You have to go to the "Revanced settings --> layout settings" then activate the "cast button" option, then on the chromecast navigate to set --> tv code.  add this tv code after clicking on cast in Revanced,
and you're done.

This is true, and always has been, but it's not what I'm referring to. The DLNA broadcast relies on V1. This is what makes the device name show up under the cast menu. Linking with a code has always been possible, even with the button disabled. You do it in the app's settings under "Watch on TV".

masterflitzer commented 2 years ago

ok so cast v1 really does mean that it shows up in the list automatically? I didn't know that sry

is the stock YouTube app for Android TV still broadcasting over v1 (meaning both v1 and v2)? I thought google switched to v2 only (idk but I read it somewhere on GitHub or reddit)

anyway for me tv code is enough as I'm using smarttubenext and there tv code is the only option

but of course having feature parity with vanced should be the goal so this would be nice to have

Joomsy commented 2 years ago

ok so cast v1 really does mean that it shows up in the list automatically? I didn't know that sry

is the stock YouTube app for Android TV still broadcasting over v1 (meaning both v1 and v2)? I thought google switched to v2 only (idk but I read it somewhere on GitHub or reddit)

anyway for me tv code is enough as I'm using smarttubenext and there tv code is the only option

but of course having feature parity with vanced should be the goal so this would be nice to have

Right, it's not that big of a deal. Just makes things a bit more convenient, especially when you have multiple devices casting at once. And you're right, the official YouTube apps are V2 only now. STN won't show on the official mobile app, either.

masterflitzer commented 2 years ago

wait, what use does cast v1 have then? if official YT uses v2 only and STN doesn't support v1 either...

are there other 3rd party apps that implement v1?

Joomsy commented 2 years ago

wait, what use does cast v1 have then? if official YT uses v2 only and STN doesn't support v1 either...

are there other 3rd party apps that implement v1?

STN does support V1. V1 is an open API that's free to use by third parties. Only Google can use V2. They haven't said that they're going to shut down V1, but Google being Google, anything's possible. They're definitely trying to make it more difficult to use.

masterflitzer commented 2 years ago

hmm for me STN didn't pop up automatically in old vanced, might try in official YT app

but afaik only official YT Android TV works with official YT (with cast v2)

InakiArzalluz commented 2 years ago

I just casted to a roku express and it was auto detected, and all I had to do was unhide the cast button. Isn't it supposed to not work?

Joomsy commented 2 years ago

I just casted to a roku express and it was auto detected, and all I had to do was unhide the cast button. Isn't it supposed to not work?

The YouTube app for Roku was discontinued, meaning it likely has an older version of the casting API that still works for some reason. That, or it performs a DLNA broadcast independent of YouTube, which I know it does for some things. Roku also has multicast DNS support, which may be what's causing it to be listed. That's my best guess, though. My Roku Ultra also gets detected, for what it's worth.

masterflitzer commented 2 years ago

casted to a roku express

do you mean to the youtube app on roku or to roku itself (i dont have one but i heard you can cast to it directly), i might be totally wrong but i think its most likely the youtube app on roku you are casting to (because i don't think roku would have google cast built in), which in turn makes me wonder why its different on roku vs android tv

older version of the casting API

but didn't they say cast v1 doesn't work in revanced? maybe revanced didn't change anything except for hiding the cast button, which means cast v1 works (because microg is the service that implements it)

i wouldn't know because the official youtube app on android tv only does cast v2 apparently and i'm still not sure if smarttubenext even supports cast v1 (so it very well may be that v1 works on revanced but nobody noticed because there aren't many receivers left for v1)

DLNA broadcast multicast DNS

does youtube even support protocols other than google cast? i didn't think so

Joomsy commented 2 years ago

Yes, STN supports V1. It used to show up in the last official version of Vanced. And Google's casting is just their fancy version of DLNA. Functionally speaking, there's really not much of a difference between the two. Multicast DNS is just a simple way to assign local domain names to networked devices so they don't have to be found by IP. This helps the Roku be more easily detected when another device is searching for networked devices. My line of thinking is mDNS may be helping in this regard.

InakiArzalluz commented 2 years ago

do you mean to the youtube app on roku or to roku itself

I mean to the youtube app on roku.

masterflitzer commented 2 years ago

youtube app on roku

how old/new is this app version? it's indeed likely that it supports cast v1, then i'm wondering if maybe this issue is solved (maybe unhide cast button by default because at this point i don't even know why they hid it)

yes i know mDNS but didn't know google cast is similar to DLNA still i think youtube only supports google cast (google wouldn't even allow miracast in official android anymore, samsung etc. had to reimplement it)

would be nice if someone from revanced team could say if revanced does support cast v1 currently (or if they even changed anything because if not then it should work like in vanced), it's really difficult to explain the current behavior

i can't seem to test it correctly because my STN doesn't show up in official yt or revanced and official yt androidtv only supports cast v2

InakiArzalluz commented 2 years ago

how old/new is this app version?

It's version 2.22.105005075, from july 26 2022

masterflitzer commented 2 years ago

ok that's not really old but it's possible that they still rely on cast v1 on roku because it doesn't have google play services (because it's not android)

most plausible explanation i currently have is this: revanced only hid the cast button, cast v1 is actually working fine, youtube on android tv only supports cast v2 and STNs cast v1 is very unreliable and therefore isn't working for me

we would need a reliable way to check casting capability to be sure but idk

Canny1913 commented 2 years ago

both v1 and v2 doesnt work currently and both modules are disabled in microg-support patch

masterflitzer commented 2 years ago

thanks for the information, do you have maybe an explanation how casting to roku is possible?

Canny1913 commented 2 years ago

uh no sorry

masterflitzer commented 2 years ago

no worry's thanks

InakiArzalluz commented 2 years ago

do you have maybe an explanation how casting to roku is possible?

after a little google searching I found out that Youtube on Roku is using DIAL protocol. That being said, I won't clutter this thread any longer, since I was only confused about the protocol being used on the device.

masterflitzer commented 2 years ago

thanks i definitely learned new things

Canny1913 commented 2 years ago

Both cast V1 and V2 are fixed.

masterflitzer commented 2 years ago

how is v2 fixed? i'm not sure i understand

Canny1913 commented 2 years ago

i dont even know lol it casts to my tv without issues (vanced still gives error)

masterflitzer commented 2 years ago

that's weird, you are still using non-root build? v2 shouldn't be possible because it needs official google services

Canny1913 commented 2 years ago

It worked for first few tries then failed again. It keeps trying to use play services for cast.

Theletha commented 6 months ago

Is this why I can't see my chromecastultra in the cast menu? I keep having to switch to the original app to cast content.

oSumAtrIX commented 6 months ago

Casting is limited by GmsCore/ MicroG.

Theletha commented 6 months ago

Casting is limited by GmsCore/ MicroG.

Will it be fixed?

oSumAtrIX commented 6 months ago

Thats not up to us