ANy suggestions on how to play videos on a smart TV?
Media player all setup and working with a LG using component webostv and media_extractor.
No problems in changing the TV source to youtube, but can’t seem to get it to play a youtube
Here’s the script:
video_intro:
alias: “first_video”
sequence:
A media type. Must be one of music , tvshow , video , episode , channel or playlist . For example, to play music you would set media_content_type to music .
But I can’t seem to get the same going. Like mentioned no errors reported. Other Media player scripts do work ie can script powering off/on and selecting the youtube channel. Just can’t get it to play any media. Tried the “music” option (thanks for that) but that didn’t work either.
In the webostv component docs, it mentioned pylgtv, so I went looking there and seems like this is definitely possible, so I tried out the following successfully
from pylgtv import WebOsClient
client = WebOsClient('1.2.3.4')
apps = client.get_apps() # At this point your TV will prompt you to authorized pairing app
youtube_app = [ app for app in apps if app['title'] == 'YouTube' ][0]
youtube_id = youtube_app['id'] # Mine returned "youtube.leanback.v4"
client.launch_app_with_content_id("youtube.leanback.v4", "dQw4w9WgXcQ") # It works!
The tricky part was determining the youtube id, which was “youtube.leanback.v4”. I imagine it will only change with a major youtube app update.
That’s good news!
However to be honest I didn’t understand how you extract the id: "youtube.leanback.v4" i(s it python script?) neither the second part of how to use the service: webostv.command
When you find some time please explain a bit
Certainly. First I was using the “Developer Tools > Services” in the home-assistant UI trying to invoke the possible services. I noticed that there were several services that started with webostv.* specifically the webostv.command and the documentation that was associated with it referred to a external python project called pylgtv. I installed pylgtv on my local machine and was playing around, calling get_apps returned a list of all the apps (and for each app there was a title, id, etc). I saw a function there called launch_app_with_content_id and I fed it app='youtube.leanback.v4', contentId='dQw4w9WgXcQ'. Looking at the function, it was also using EP_LAUNCH = "system.launcher/launch"
Given this info, I tried to see how I can feed it in to home-assistant’s webostv service. Noticed the last commit which was by @PotatoDrug which enabled passing the command + payload (and I took a guess that payload is where I would cram id/contentId)
Thanks for the details. I hope that it will be doable with the 0.111 release. When you know how we can call to play a particular playlist from youtube please leave here an example.
I am also wondering if with this way we could call a particular movie from Netflix for example. I think it could.