SEPIA-Framework / sepia-docs

Documentation and Wiki for SEPIA. Please post your questions and bug-reports here in the issues section! Thank you :-)
https://sepia-framework.github.io/
238 stars 16 forks source link

YouTube music player (and Google account login) #138

Closed gu3nter closed 2 years ago

gu3nter commented 3 years ago

Hallo habe mir vor kurzen YouTube Premium inklusive YouTube music geholt. Jetzt meine Frage: So weit ich verstanden habe gibt es keine offizielle YouTube music Api seitens Google, was schade ist da YouTube music erheblich mehr Inhalte als YouTube hat.

Habe mich nach einer möglichen Lösung umgesehen und folgendes GitHub Projekt gefunden, was aus meiner Meinung nach die fehlende Api lösen könnte

https://github.com/sigma67/ytmusicapi

Hier müsste dann aber auch ein embeded Player für gecodet werden, was ich leider nicht kann :( Dieser Player müsste nach meinem Verständnis dann wie die Api Lösung die Cookie Übergabe regeln können. So viel zu meiner Halbwissens Theorie, ob das technisch möglich ist weiß ich leider nicht genau.

So jetzt meine eigentlich Bitte, ist es möglich YouTube music mit dem oben genannten GitHub Projekt zu realisieren? Falls ja würde ich mich sehr darüber freuen, SEPIA ist der geilste shit ever ;)

SHU-red commented 2 years ago

Without wanting to stress you, i just tried to debug this further in vivaldi developer bar.

After every search for "Play Carry on My Wayward Son" these Errors duplicate: Screenshot_20220411_200407

The first points to the problem, that even the youtube logo can not be shown i think. I also tried to take the url, replace "localhost" with my ip but this also does not work ... Could be something related to my docker setup or even a problem in docker itsself? Screenshot_20220411_200423

I think both of the lower errors are related to my currently broken MaryTTS connection, where you may already found https://github.com/SEPIA-Framework/sepia-docs/issues/166

Regarding "Not able to access YouTube Embedded videos from within a VM" i found these guys discussing: https://stackoverflow.com/questions/51969269/embedded-youtube-video-doesnt-work-on-local-server Chances are high, that this is the issue?

At the moment i can open these videos if i click on "open in YouTube" which then opens it from my browser Seems that just my dockerized Sepia has this problem at the Moment

Can i do something? Sorry for causing work with my setup ...

fquirin commented 2 years ago

Hi :-),

The first points to the problem, that even the youtube logo can not be shown i think.

This can be fixed easily :slightly_smiling_face: . I think I never documented it anywhere but missing logos happen when the card is trying to load the logo from the server (instead of the client app itself, like for Youtube) and the server still has the default localhost setting. If you go to the core-settings page in the Control-HUB you should find the entries url_web_files and url_web_images. If you set them to the hostname, domain, IP, proxy address or whatever URL you use to reach your server the logos should be fixed. Something like this:

url_web_files=https://my-server.local:20726/sepia/assist/files/
url_web_images=https://my-server.local:20726/sepia/assist/files/images/

I think both of the lower errors are related to my currently broken MaryTTS

This might be. What is your voice-engine and voice setting right now? If it says voice = 'automatic' try to select one of the espeak voices to test if the error disappears.

Regarding "Not able to access YouTube Embedded videos from within a VM" i found these guys discussing: https://stackoverflow.com/questions/51969269/embedded-youtube-video-doesnt-work-on-local-server Chances are high, that this is the issue?

It may well be the explanation, at least I just checked what happens when I use the IP address to access my client and I can confirm that YouTube will NOT play! So:

It seems the YouTube embedding requires a "real" domain, even if it is just the [hostname].local address or a localhost address.

SHU-red commented 2 years ago

This can be fixed easily slightly_smiling_face . I think I never documented it anywhere but missing logos happen when the card is trying to load the logo from the server (instead of the client app itself, like for Youtube) and the server still has the default localhost setting. If you go to the core-settings page in the Control-HUB you should find the entries url_web_files and url_web_images. If you set them to the hostname, domain, IP, proxy address or whatever URL you use to reach your server the logos should be fixed. Something like this:

url_web_files=https://my-server.local:20726/sepia/assist/files/
url_web_images=https://my-server.local:20726/sepia/assist/files/images/

I tried (And the same with the images part, adding *images/)

... nothing worked ... every time i tried it, i wrote the setting by klicking on the checkmark and reloaded the server ... changes i made with admin account in control hub ... i tested it with a random user in a sepia client ... i do not have some custom name/addres for my server so i think the only options are using the IP or localhost? there must be something obvious im doing wrong .... :thinking:

I also tried it, completely stoping my dockerized adblocker (AdBlock Home)

It seems the YouTube embedding requires a "real" domain, even if it is just the [hostname].local address or a localhost address.

OK ... Thats a problem As mentioned above i am accessing my home server via http://IP:PORT

Maybe i have to try to get it working using a "custom-domain"? I dont know about this stuff :cry:

I think a proxy or something is needed for that? I think only by using my AdGuard Home as DNS this is not possible i think?!

SHU-red commented 2 years ago

This might be. What is your voice-engine and voice setting right now? If it says voice = 'automatic' try to select one of the espeak voices to test if the error disappears.

If i use SEPIA Streaming, i can select a voice and TTS is working

fquirin commented 2 years ago

I tried (And the same with the images part, adding *images/)

https://[MYHOMESERVERIP]:20726/sepia/assist/files/ https://0.0.0.0:20726/sepia/assist/files/ which is the ip if you inspect from within the docker container https://[MYHOMESERVERIP]:20726/sepia/assist/files/ slashes https://0.0.0.0:20726/sepia/assist/files/ slashes http://localhost:20721/sepia/assist/files/ http://localhost:20721/files/

0.0.0.0 that doesn't look like a valid IP to me, maybe some Docker virtualization or something :thinking: . I think you can forget about all the localhost, hostname and Docker internal IPs since they only exist inside the container. The important thing is the URL you use in your browser to access the app. This would be the IP/hostname of your Docker host machine and whatever port mapping you've used when you start the Docker container (the -p 20726:20726 part).

As mentioned above i am accessing my home server via http://ip:PORT/

Then this is exactly what you should use above. If IP and port are correct you should be able to reach this anywhere in your network: http://ip:PORT/sepia/assist/files/images/brands/youtube-logo.png. If your Docker host machine has a hostname that is recognized by your network (it usually has) you can try this as well to avoid the Youtube issues: http://hostname.local:PORT/sepia/assist/app/

SHU-red commented 2 years ago

OK sorry i have to excuse myself. Seems that something in the path was wrong i think --> Logo is working now

Regardings the point, that YouTube will not work --> Am i right, that the only solution is, that i manage to have a hostname instead an ip to get the youtube videos playing? --> I want you to remember, that i basically dont care about playing youtube videos, my goal is to stream music from YouTube Music, like a Google Assistant HomeSpeaker would .... so just audio, no video

fquirin commented 2 years ago

Am i right, that the only solution is, that i manage to have a hostname instead an ip to get the youtube videos playing?

Looking at the current behavior of YouTube it seems so :-/. Usually your network router will handle it automatically. If not there are many possibilities. If you can't configure hostnames in your router manually (DNS resolution) you can edit your systems 'hosts' file. In Windows and Linux terminals the hostname command will show you the given name. In Windows this is the name of your computer. Another more or less simple workaround is simply running a web-server or proxy on your working machine and host the SEPIA client there or point to the server IP via the proxy.

I want you to remember, that i basically dont care about playing youtube videos, my goal is to stream music from YouTube Music, like a Google Assistant HomeSpeaker would .... so just audio, no video

As far as I know there is no public Google offering outside of their own apps or devices of Youtube Music besides the video platform. Google itself obviously can do whatever they want accessing the music streaming directly from their servers and they probably offer something similar to business partners in case Amazon wants to use it too (do they? idk).

Overall I think the music streaming is currently a major pain point in open-source voice assistants because none of the services like Spotify, Apple Music, Amazon Music and Youtube offer an official way of accessing these services outside of their own apps or licensed devices, not even for paying customers. Technically it would be pretty easy to do, Spotify for example would just have to implement the same embedding interface as the YouTube player and we'd be good.

SHU-red commented 2 years ago

Looking at the current behavior of YouTube it seems so :-/. Ok thanks

Then there is nothing you can do :smile:

As far as I know there is no public Google offering outside of their own apps or devices of Youtube Music besides the video platform.

Thats what i was "fearing" I just was confused, what the youtubemusic-microservice is really doing, but at the moment i think its like a specified search function based on YTM right?

Overall I think the music streaming is currently a major pain point in open-source voice assistants because none of the services like Spotify, Apple Music, Amazon Music and Youtube offer an official way of accessing these services outside of their own apps or licensed devices, not even for paying customers. Technically it would be pretty easy to do, Spotify for example would just have to implement the same embedding interface as the YouTube player and we'd be good.

Yes sad story but thats how they force us to buy their devices :sweat_smile:

Thanks for your time

fquirin commented 2 years ago

I just was confused, what the youtubemusic-microservice is really doing, but at the moment i think its like a specified search function based on YTM right?

Roughly spoken it pretends to be the Youtube Music website, sends search queries as if you would type them in the search field and parses the result to a JSON format, ... I think :sweat_smile:

Yes sad story but thats how they force us to buy their devices

Yes :-/. A bit shameless I think since you pay for the service but cannot consume the music as you like :-(. Spotify had a library once that worked exactly as needed to build custom clients, but they stopped supporting it and basically threaten everyone with the usual "it can break anytime". Almost all of the alternative Spotify clients still use it ... I thought about some SEPIA integration from time to time. Maybe I'll have a close look again soon ^^.

gu3nter commented 2 years ago

I'm only a little hobby programmer, but maybe this YouTube music Player can be included in sepia, or is it not possible? https://github.com/th-ch/youtube-music

fquirin commented 2 years ago

It looks like they wrapped the Youtube Music website into an Electron app, so basically it's the modified original website with a stand-alone Chromium browser. Unfortunately this cannot be used inside the SEPIA client, because it doesn't solve the embedding problem, ... well technically it could probably be used inside the Android app like a 2nd browser window that is remote controlled. In general I'm not a big fan of "solutions" that are not officially supported by the companies because you risk putting a lot of work into it and then it constantly breaks or even worse the company asks you to take everything down because you're violating their ToS :grimacing:

gu3nter commented 2 years ago

Ah ok, thanks for the Info, i'm totally fine with the current solution ;)