Recorded TV streaming via m3u8 Plex

DVBLink Remote API clients and tools

Recorded TV streaming via m3u8 Plex

Postby martosource » Mon Feb 27, 2017 12:38 pm

I have been trying to get the plex plugin to play back recorded tv via my Hisense TV which is an Opera TV OS.

I have been able to get a m3u8 index via the web player using http://<server>:<port>/tvrecords/play/?rid=<object id> which works fine on the tv.

However, how can i set the transcoding setting for a m3u8 file? Is their a better api call to get a m3u8 index for a recorded tv program?

I have changed the following function in recorded_tv_menu.py for the plex plugin and it is transcoding at the default settings (640 x 480 at 512k).

It is now replacing /dvblink/playback?object= with /tvrecords/play/?rid=

Code: Select all
def create_recorded_tv_item(self, url, object_id, title, source_title, summary, rating, start_time, duration, year, writers, directors, producers, guests, genres, thumbnail, include_container=False):
                  
      stream_port = int(Prefs[helper.SERVER_PORT_KEY]) + 1
            
      url = url.replace(str(stream_port) + '/dvblink/playback?object=', Prefs[helper.SERVER_PORT_KEY] + '/tvrecords/play/?rid=')
      
      item_object = VideoClipObject(
         key = Callback(
            self.create_recorded_tv_item,
            url = url,
            object_id = object_id,
            title = title,
            source_title = source_title,
            summary = summary,
            rating = rating,
            start_time = start_time,
            duration = duration,
            year = year,
            writers = writers,
            directors = directors,
            producers = producers,
            guests = guests,
            genres = genres,
            thumbnail = thumbnail,
            include_container = True
         ),
         rating_key = object_id,
         title = title,
         source_title = source_title,
         summary = summary,
         rating = rating,
         originally_available_at = Datetime.FromTimestamp(start_time).date(),
         duration = duration,
         year = year,
         writers = writers,
         directors = directors,
         producers = producers,
         genres = genres,
         thumb = Resource.ContentsOfURLWithFallback(thumbnail),
         items = [
            MediaObject(
               # parts = [
                  # PartObject(key=Callback(self.play_recording, url=url))
               # ]
                parts = [
                    PartObject(
                        key = HTTPLiveStreamURL(url = url),
                        # iOS client shows permanent loading screen in the foreground if no duration is provided (https://forums.plex.tv/discussion/comment/1293745/#Comment_1293745),
                        # smarter clients understand that it is a live stream and ignore this property
                        duration = 86400000 # 24 hours
                    )
                ],
                optimized_for_streaming = True # Prefs['optimized_for_streaming'] # https://forums.plex.tv/discussion/comment/828497/#Comment_828497
            )
         ]
      )
      
      if include_container:
         return ObjectContainer(objects=[item_object])
      else:
         return item_object
martosource
 
Posts: 1
Joined: Mon Feb 27, 2017 12:09 pm


Return to Development corner

Who is online

Users browsing this forum: No registered users and 6 guests