Resume Youtube Music on Google Hub after TTS or CAST interruption

Problem: If Youtube Music (specifically) is playing and there is an TTS or cast interruption, the music will stop after the interruption is done.

Conditions: I don’t have Youtube music premium, all the music was initiated by voice command to the Hub, issue is specifically for Youtube Music, noting is playing from playlist or stored songs.

Work so far: I spent weeks searching online for a solution to resume the Youtube Music but no luck. I tried ’ yTube Music Player’, ‘Music Assistant’, scripts from ‘TheFes’ which are good for Spotify and Youtube video etc. Only solution I found is that, I can save the content_id and resume the same song but Google Hub will not continue to next song (next song is not playlist, it is random song played by Youtube Music).

…Is there a script and solution anyone to resume Youtube Music after interruption (not premium account)?

1 Like

I agree- This is the most common scenario I can think of- most posts will address resuming content started by ytube player, but more often than not i’m starting something from casting via my phone or just using voice commands “hey google play some music”. I’ve several use cases such as automatically casting the front door camera for 20 seconds as someone approaches the door… but that stops the music and I’m currently unable to figure out how to resume.

Querying the media_player.kitchen_display will show you the current song for example;

volume_level: 0.6200000047683716
is_volume_muted: false
media_content_id: RmYCOm4ehKs
media_content_type: music
media_duration: 216
media_position: 0.834
media_position_updated_at: 2023-10-19T09:29:05.617162+00:00
media_title: Save Your Tears
media_artist: The Weeknd
media_album_name: After Hours
app_id: 2DB7CC49
app_name: YouTube Music
entity_picture_local: /api/media_player_proxy/media_player.kitchen_display?token=5d41***&cache=3e327****
entity_picture: https://lh3.googleusercontent.com/JDKz3Anlyo49xBhFcFx13QD_Tk4-kqdiYTo15gtkL93nE8biWyZ7o0BPyW6RnXVxcXaJ5DgU5nJ_0NjJ=w544-h544-l90-rj
friendly_name: Kitchen Display
supported_features: 152511

But as you mention, despite this being a playlist, it’s just the current songs media id being returned. The media_player.ytube_music_player meanwhile has no idea anything is happening;

remote_player_state: off
likeStatus: 
current_playlist_title: 
videoId: 
_media_type: null
_media_id: null
current_track: 0
remote_player_id: media_player.kitchen_display
shuffle_mode: Shuffle
icon: mdi:music-circle
friendly_name: ytube_music_player
supported_features: 450495

I am looking for the same solution but with TuneIn and Spotify. I figured you would have to make a sensor that keeps track of which app is playing, which media is playing and it’s timestamp, and on which device it is playing. Then you have tostore that data, and then fetch it after your TTS interruption in order for your server to know what media it has to play, on what timestamp, on which device. I only have no idea where to start to program such a sensor.

Another approach is to fade your music to the background, play your TTS message over it, and then restore the volume of the music. Also this is very complex to build with Home Assistant.