@@ -312,6 +312,8 @@ class RTStream:
312312 :ivar str created_at: Timestamp of the rtstream creation
313313 :ivar int sample_rate: Sample rate of the rtstream
314314 :ivar str status: Status of the rtstream
315+ :ivar str stream_url: Generated playback URL for the rtstream segment
316+ :ivar str player_url: Player URL for the generated rtstream segment
315317 """
316318
317319 def __init__ (self , _connection , id : str , ** kwargs ) -> None :
@@ -323,6 +325,8 @@ def __init__(self, _connection, id: str, **kwargs) -> None:
323325 self .sample_rate = kwargs .get ("sample_rate" , None )
324326 self .status = kwargs .get ("status" , None )
325327 self .channel_id = kwargs .get ("channel_id" , None )
328+ self .stream_url = kwargs .get ("stream_url" , None )
329+ self .player_url = kwargs .get ("player_url" , None )
326330
327331 def __repr__ (self ) -> str :
328332 return (
@@ -332,7 +336,9 @@ def __repr__(self) -> str:
332336 f"collection_id={ self .collection_id } , "
333337 f"created_at={ self .created_at } , "
334338 f"sample_rate={ self .sample_rate } , "
335- f"status={ self .status } )"
339+ f"status={ self .status } , "
340+ f"stream_url={ self .stream_url } , "
341+ f"player_url={ self .player_url } )"
336342 )
337343
338344 def start (self ):
@@ -421,19 +427,41 @@ def stop_transcript(self, engine: Optional[str] = None) -> dict:
421427 data = data ,
422428 )
423429
424- def generate_stream (self , start , end ):
430+ def generate_stream (
431+ self ,
432+ start : int ,
433+ end : int ,
434+ player_config : Optional [Dict [str , str ]] = None ,
435+ ) -> str :
425436 """Generate a stream from the rtstream.
426437
427438 :param int start: Start time of the stream in Unix timestamp format
428439 :param int end: End time of the stream in Unix timestamp format
440+ :param dict player_config: Optional player metadata with `title`,
441+ `description`, and `slug` keys
429442 :return: Stream URL
430443 :rtype: str
431444 """
445+ params = {"start" : start , "end" : end }
446+ if player_config :
447+ player_title = player_config .get ("title" )
448+ player_description = player_config .get ("description" )
449+ player_slug = player_config .get ("slug" )
450+
451+ if player_title :
452+ params ["player_title" ] = player_title
453+ if player_description :
454+ params ["player_description" ] = player_description
455+ if player_slug :
456+ params ["player_slug_prefix" ] = player_slug
457+
432458 stream_data = self ._connection .get (
433459 f"{ ApiPath .rtstream } /{ self .id } /{ ApiPath .stream } " ,
434- params = { "start" : start , "end" : end } ,
460+ params = params ,
435461 )
436- return stream_data .get ("stream_url" , None )
462+ self .stream_url = stream_data .get ("stream_url" )
463+ self .player_url = stream_data .get ("player_url" )
464+ return self .player_url
437465
438466 def index_scenes (
439467 self ,
0 commit comments