PlexMeetsHomeAssistant icon indicating copy to clipboard operation
PlexMeetsHomeAssistant copied to clipboard

Feature Request: Play Live TV from Plex via cast or androidTV

Open JurajNyiri opened this issue 2 years ago • 1 comments

Release 2.4 has introduced live tv listing possibility.

It is possible to cast live tv from plex to TV using plex UI. However, when you select your target device first, it refuses to do it which hints me that plexPlayer will not be supported (and casting works by accident?)

Screenshot 2021-09-02 at 15 51 54

If it is possible through browser, it should be possible through this card, at least via cast.

After a lot of hours I have successfully figured out and implemented a function which returns me an m3u8 file for any channel I clicked play on. I can take this link and use it in VLC to successfully start stream 100% of the time.

I can see cast errors in home assistant log:

image

2 issues:

  1. It expires after 5 minutes, this is the lesser issue though
  2. I am not able to cast it into device through Home Assistant. I have tried many different media types documented on Home Assistant - cast wiki. I have also researched for people having similar issues.

Regarding android TV, the furthest I got was it to load metadata of current show but it did not play anything.

Main parts of generating the url are:

  1. tune request, which tell plex to tune to channel
  2. getting info about stream, to see if it is already started, if not, start it using start.mpd endpoint
  3. get the m3u8 stream using the decide endpoint, I have found that the stream only works in VLC if it has already been running for a while (10 sec work for me) but that might be specific for me

Current code is in https://github.com/JurajNyiri/PlexMeetsHomeAssistant/tree/live_tv_play if any developer wants to take a look! 👍

JurajNyiri avatar Sep 02 '21 20:09 JurajNyiri

Plex Live TV is definitely not an accident when being cast, and should be supported by most clients - their blog lists the supported clients: https://support.plex.tv/articles/115007689648-watching-live-tv/ you will note that Casting from Web and iOS is supported, while Android is currently missing. Waching LiveTV on both Android and AndroidTV is specifically supported though. So plexPlayer should work.

asjmcguire avatar Oct 04 '21 13:10 asjmcguire