what card?? send to us
Iāve uploaded my code to GitHub - pathofleastresistor/ytube-media-card. Itās purely experimental and mostly just hacking together what I can get out of the current integration.
Currently is there any change that we can do search for a youtube music song and play the first result and then play randomly as youtube suggest?
I dont want to stick with playlist, day by day, year by year :)))
love this add-on
Iād say yes.
Havenāt tried, but you can call the search service call, grab the videoID of the first result and start a radio based on that track.
What have you tried so far?
Jkw
@JKW As I mentioned before, I managed to have ytube_music playing on my Sonos speaker using OwnTone as a āproxyā. But Iām still fighting with the next track behaviour of ytube_music:
OwnTone goes to off
state at the end of a track, so I set off_is_idle
, which works correctly
But when I press next track on ytube_music, OwnTone goes to paused
state for a moment, triggering ytube_music to also go to paused state, stopping the stream.
So I think I need an extra service call off_or_pause_is_idle
for this to be handled correctly. As next track seems to work correctly when I issue a pause_is_idle
call, but then the next track on end of current track no longer works as off is then no longer detected as idle.
Then another issue I encounter: I also want to be able to play ytube music on other devices than the Sonos/OwnTone combo, but there seems to be no way to reset the the off_is_idle
call. Providing an idle_is_idle
call to reset the idle detection to default could be a solution to this ? Or by resetting the idle detection method whenever the ytube_music playback target is changed?
Alternatively, and perhaps more user-friendly, but probably more work , would be that ytube_music keeps track of which idle detection method to use on which target.
Should I open an issue on github for this ?
Iām absolutely new to home assistant and have not much python knowledge, but looking at your code, I think adding an off_or_pause_is_idle
and a idle_is_idle
service call to your code should lie within my current abilities, so I can try to provide a pull request for that?
What are your thoughts about this ?
I like the idea ā¦ actually all of them.
Iād say to provide a list per player might be overkill, Iād rather recommend to have multiple instances of ytubemusicplayer for each playback one, if such special treatment is required.
But idle-is-idle and pause-or-off-is-idle ā¦ sure ā¦ why not.
Go for the pull request
Best way would be a harmonizes behavior in Homeassistent ā¦ but hey
Jkw
I already have 4 instances (one for each house member, as we have a family account, so everyone has their own YT music account, their own playlists and music preferences (and some even become angry when YT starts giving recommendations based on music choices from other house members, so there is no sharing of accounts possible :-))
Iām using custom:state-switch cards to show the correct YT music card based on currently logged in user. So adding even more instances (for each user on each target) would complicate things even moreā¦
Meanwhile, I tried implementing paused-or-off-is-idleā¦ but found out this is not really a solution. As OwnTone server pauses not only when next track is selected manually, but also when seeking inside a songā¦ now triggering the next track instead of jumping to the selected position in the song. Not sure how to solve thatā¦
Patch the ownTone integration?
Honestly ā¦ not sure
That was my first thought also, but looking into the owntone integration, it just calls the owntone api on seek or next/prev song. It seems owntone server itself briefly goes to pause and then start playing again on its own. Hence triggering the state changes in the integration too. Where the YT music integration reacts on the temporary pause state by going into pause, in turn triggering an actual pause on the owntone server by the mediaplayer preventing it from starting to play again automaticallyā¦
So I donāt see how to change that behaviour inside the owntone integration; other than possibly trying to ignore owntone state changes that happen within 5s or so.
But that would delay any relevant state change also with 5s.
Iāve been tinkering with your code, and I found a solution that works for me: I added an _ignore_next_remote_pause_state
variable and set it to true
in async_media_previous_track
, async_media_next_track
and async_media_seek
.
And when a state change playing to paused comes in from the remote player, it is ignored and the variable is reset to false
Result is that when next, prev or seek is performed, owntone pauses, performs the action, then starts playing again and the ytube music integration happily continues and ignores that pause state change. When I now manually press pause on the owntone card, ytube music still also correctly goes into pause.
So I think I solved it with this.
I will prepare a pull request with this.
Hi, Iāve scrolled through this and so many other pages and canāt seem to find anyone that gets as far as i have, without doing steps I have not yet seen (thatās confusing)ā¦ my process has been simple to this point (too simple) and probably the reason Iāve not got passed it in weeks.
So hereās the steps:
- Download YouTube music player from the HACS storeā¦ ā Refresh ā Yay
- Add integrations - it gives me a URL, I go to it, confirm code, login, allow, sweet ā done, and go back and click submit:
[it will only let me post one screenshot, have to delete this one and iāll show the last one, but this is the screen with the URL to open in another tab then come back]
This is where it starts getting different for me to what others appear to get. It takes me to the next screen:
[it will only let me post one screenshot, have to delete this one and iāll show the last one, but this is the screen with language selection, and header file - same as below but without the error]
I confirm language, I can tick āshow advance configurationā but that never does anything. Apart from being able to change the language to anything I donāt understand, my only option is submit. So I click it and then this happens:
It will not open advanced config, I never get to see any fields to enter a name, cookie text, or anything more. itās as far as I can go and have to cancel and give up, go back to HACS, find it, click the menu and select āRemoveā, then restart before trying again and getting the exact same results again.
Now I apologise in advance, because I can only assume iāve done something stupid on my first attempt (what else will it be right?) because Iām fairly new to HA and still getting used to the dance routine before I start trying to dance the Waltz with it. Thanks in advance, youāre an amazing community and if you can help, that would be fantastic
Does this still work for you?
I started getting issues with tracks keeping skipping. Something in either HA, OwnTone server or YTube integration changedā¦
For now I somehow fixed it by making YTube integration to āpauseā whenever OwnTone server goes to āidleā (not āpauseā like your posts say), it does this every time when I change tracks. Sometimes it still skips a track (I can hear a second of a track before it skips to next one). Iām not sure if OwnTone tries to hit ānextā because YTube doesnāt play fast enough.
I could let OwnTone just keep on playing even if YTube is paused, because I can do all control from YTube. It complicates things that both integrations can control playback.
Also, should those commands be done once after HA start or?
Hi Jody,
this is really strange ā¦ Iāve never seen this before ā¦
puh ā¦ restart homeassistant? clear cache ?
Youāve never configured this before, right? fresh install?
This is really strange ā¦
Hi Kolja,
it was a new install at the beginning, but now Iāve tried so many things itās not anymore. Iāve basically given up on it now altogether, as it was really starting to grind me. I binned off my Youtube music account and migrated playlists and everything over to spotify, and that works good for me.
Thanks
Do I need to get on my knees and beg?
Got an actual question?
Perhaps look at integrating YouTube Music via Music Assistant. It works perfectly.
Hey guys just installed this integration, and thereās no ytube_music_player_extra sensor? And I donāt find anything about it in the documentation. I want to show the lyrics
Hi, during the configuration you have to activate
and then
have you done this?
Thank you! For your work!
I installed it, everything is ok. However, when I try to play it on Alexaā¦ it says something is missing, like the public tts configurationā¦ something like that
Iām reading the forum, is that right? It doesnāt work with Alexa??
I donāt think that Alexa can stream from an url. So no, not possible as far as Iām aware.
Jkw