Play Youtube video on Chromecast with script/service

media_player
Tags: #<Tag:0x00007f1ba34f0f18>

#1

I want to auto play Youtube video/playlist on Chromecast but not found any way. I search about https://home-assistant.io/components/media_extractor/ but it say service not exist, media_player.play_media will not too: Googlecast/Chromecast Play Youtube TV App/Channel


#2

See here :


#3

It show error:

Unable to find service media_extractor/play_media

I use hassio 0.64.3


#4

you will need the add below to config

# Example configuration.yaml entry
media_extractor:

#5

Thank you. My fault with quick reading.


#6

Thnx jivesinger, but it doesn’t work with https://youtu.be/tPE4wv7ob8Q. Do you know why?


#7

Would media_extractor work with Youtube Music urls. I’m new to this and would like to trigger a relaxation music playlist upon tv turning off, I’m already hooked to a webos tv but need some clues as to how to cast the playlist.

– edited to include answer –

Thank you so much I got this to work with youtube music casting to Google home mini
{
“entity_id”: “media_player.master_bedroom_speaker”,
“media_content_id”: “https://music.youtube.com/watch?v=vCQTiI_ESl0&list=RDAMVMvCQTiI_ESl0”,
“media_content_type”: “audio/youtube”
}

I believe this might also work without advertising since I have a subscription too. Don’t know how it might apply to others.


#8

@3dgr, will this play the entire playlist without pause?


#9

@goprojojo Yes, I believe it would play the entire playlist. I need to redo my setup so I can’t confirm now.


#10

Sounds promising. I also tried to play a YouTube video playlist (https://music.youtube.com/playlist?list=PLMC9KNkIncKtsacKpgMb0CVq43W80FKvo ) on my Chromecast TV but it plays only the first video. Don’t know if it’s possible what I want. Any suggestions?


#11

@goprojojo Did you try https://music.youtube.com/watch?v=vCQTiI_ESl0&list=PLMC9KNkIncKtsacKpgMb0CVq43W80FKvo to see if it would start directly ?


#13

It starts directly but the playlist stops after the first track. Below my automation.yaml.
Any suggestions?

- alias: 'TEST'
  trigger:
    platform: state
    entity_id: binary_sensor.test
    to: 'on'
  action:
    - service: media_extractor.play_media
      entity_id:
      - media_player.tv_bedroom
      data:
        media_content_id: https://music.youtube.com/watch?v=vCQTiI_ESl0&list=PLMC9KNkIncKtsacKpgMb0CVq43W80FKvo
        media_content_type: video/youtube

#14

Just tried this as well. The reason why it is probably not working, that the media extractor does not support it. This is the warning:

Playlists are not supported, looking for the first video
1:35 PM components/media_extractor.py (WARNING)


#15

So is there another way to play Youtube video playlist (with or without media_extractor)?