Play youtube on smart TV

I assume you are referring to this fragment

try {
                params.put("contentId", String.format("%s&pairingCode=%s&t=%.1f", contentId, UUID.randomUUID().toString(), startTime));

In which case it seems to be a randomUUID cinverted to a string. (at least as far as I can read java!)

Yeah, that’s it.

I’m terrible at reading Java (honestly, I’m no great shakes at reading existing Python code either). I feel like I don’t quite understand what’s going on. The .randomUUID() method creates a random 128-bit hexadecimal hash value that is shoved into the "pairingCode=#####" URI string. So this pairing code is just arbitrary and randomly generated for every new call?

Hey I got it working by including the
"contentId: v=n_5i_nzS1z0"
instead of
"contentId: n_5i_nzS1z0"

2 Likes

Well heck. I could have sworn I tried this.

But, yeah, it works for me too. Thanks.

So can someone please post a complete solution?

I can eventually, but I’m still messing with it. I believe the earlier posted solutions will work simply by replacing

contentId: fiwXDPufstQ in the .yaml file with contentId: v=fiwXDPufstQ

I’m still trying to track down whether there are any other valid parameters that can be sent to the YouTube app so you don’t need to hack it with this “delay → press_button” procedure.

You can, strangely enough, tell WebOS to bring up someones channel using the channel ID via c=UCiNBHFMjNdoJ3aB39gkT1-A in place of the v=fiwXDPufstQ. (For reference, this is the channel of the video that has been used a lot in this thread as an example.) This will spawn without prompting the user, but it won’t auto-play anything.

You can also add &t=30 to the end of v=fiwXDPufstQ query to start a video 30 seconds in, so it respects those basic parameters.

Thank a lot!!! It’s very helpful! It’s works for me!

1 Like

Thanks for this, have you figured out how to autoplay the channel ? or how to play a Youtube playlist for example: Home Assistant Podcast - YouTube ?

Thanks again

hi guys,
it´s not working for me.
pls could you tell me your YT Version on your TV?
Mine is running web_20220105_10_RC00

thanks

thanks Shyre

not working for me.
pls could you tell me your YT Version on your TV?
Mine is running web_20220105_10_RC00

It works prefectly for me. It autoplays a playlist by using this as data:

{
  "command": "system.launcher/launch",
  "payload":{
    "id":"youtube.leanback.v4",
    "contentId":"list=PL2YHata9QWSZGWh0hmQdjrd_ZjEKCoO7S"
  }
}

Now I just have to figure out how to autoselect “whos watching” that pops up before. Anyone figured that out?

I found this, but not work. Can you works it?

    'Maxdome'            => 'maxdome',
    'AmazonLovefilm'     => 'lovefilm.de',
    'AmazonVideo'        => 'amazon',
    'YouTube'            => 'youtube.leanback.v4',
    'Netflix'            => 'netflix',
    'TV'                 => 'com.webos.app.livetv',
    'GooglePlay'         => 'googleplaymovieswebos',
    'Browser'            => 'com.webos.app.browser',
    'Chili.tv'           => 'Chilieu',
    'TVCast'             => 'de.2kit.castbrowsing',
    'Smartshare'         => 'com.webos.app.smartshare',
    'Scheduler'          => 'com.webos.app.scheduler',
    'Miracast'           => 'com.webos.app.miracast',
    'TVGuide'            => 'com.webos.app.tvguide',
    'Timemachine'        => 'com.webos.app.timemachine',
    'ARDMediathek'       => 'ard.mediathek',
    'Arte'               => 'com.3827031.168353',
    'WetterMeteo'        => 'meteonews',
    'Notificationcenter' => 'com.webos.app.notificationcenter',
    'Plex'               => 'cdp-30',
    'SkyOnline'          => 'de.sky.skyonline',
    'Smart-IPTV'         => 'com.1827622.109556',
    'Spotify'            => 'spotify-beehive',
    'DuplexIPTV'         => 'com.duplexiptv.app',
    'Disney+'            => 'com.disney.disneyplus-prod',
    'Smart-IPTV'         => 'siptv',
    'AppleTV'            => 'com.apple.appletv',
    'Joyn'               => 'joyn',
    'YouTube-Kids'       => 'youtube.leanback.kids.v4',
    'DAZN'               => 'dazn',
    'SkyQ'               => 'com.skygo.app.de.q',
    'WaipuTv'            => 'tv.waipu.app.waipu-lg'
1 Like

i tried only in developer mode, after your bit of code i just called another service:

service: webostv.button
data:
  entity_id: media_player.tv
  button: ENTER

and it started playing

1 Like

Nice ended up doing the same thing, but I added a delay between the two calls. Do you have a delay between or does it work without?

I added delay too. Also i had to add LEFT button before ENTER, because sometimes dialog to choose who is watching reappeared after “pressing” just ENTER :man_shrugging:

1 Like

Is that the only way to select a profile?

Who are you asking?