From 01e55069ed11c0f54d1031fffd2aa3525559fa9b Mon Sep 17 00:00:00 2001 From: Om Gate Date: Tue, 10 Mar 2026 16:51:14 +0530 Subject: [PATCH 1/3] feat: rtstream stream url player handling --- videodb/rtstream.py | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/videodb/rtstream.py b/videodb/rtstream.py index 425b73f..5bbbd60 100644 --- a/videodb/rtstream.py +++ b/videodb/rtstream.py @@ -312,6 +312,8 @@ class RTStream: :ivar str created_at: Timestamp of the rtstream creation :ivar int sample_rate: Sample rate of the rtstream :ivar str status: Status of the rtstream + :ivar str stream_url: Generated playback URL for the rtstream segment + :ivar str player_url: Player URL for the generated rtstream segment """ def __init__(self, _connection, id: str, **kwargs) -> None: @@ -323,6 +325,8 @@ def __init__(self, _connection, id: str, **kwargs) -> None: self.sample_rate = kwargs.get("sample_rate", None) self.status = kwargs.get("status", None) self.channel_id = kwargs.get("channel_id", None) + self.stream_url = kwargs.get("stream_url", None) + self.player_url = kwargs.get("player_url", None) def __repr__(self) -> str: return ( @@ -332,7 +336,9 @@ def __repr__(self) -> str: f"collection_id={self.collection_id}, " f"created_at={self.created_at}, " f"sample_rate={self.sample_rate}, " - f"status={self.status})" + f"status={self.status}, " + f"stream_url={self.stream_url}, " + f"player_url={self.player_url})" ) def start(self): @@ -421,19 +427,41 @@ def stop_transcript(self, engine: Optional[str] = None) -> dict: data=data, ) - def generate_stream(self, start, end): + def generate_stream( + self, + start: int, + end: int, + player_render: bool = True, + player_title: str = None, + player_description: str = None, + player_slug_prefix: str = None, + ) -> str: """Generate a stream from the rtstream. :param int start: Start time of the stream in Unix timestamp format :param int end: End time of the stream in Unix timestamp format + :param bool player_render: Whether to generate a player URL for the stream + :param str player_title: Optional player title metadata + :param str player_description: Optional player description metadata + :param str player_slug_prefix: Optional prefix for the generated player slug :return: Stream URL :rtype: str """ + params = {"start": start, "end": end, "player_render": player_render} + if player_title: + params["player_title"] = player_title + if player_description: + params["player_description"] = player_description + if player_slug_prefix: + params["player_slug_prefix"] = player_slug_prefix + stream_data = self._connection.get( f"{ApiPath.rtstream}/{self.id}/{ApiPath.stream}", - params={"start": start, "end": end}, + params=params, ) - return stream_data.get("stream_url", None) + self.stream_url = stream_data.get("stream_url") + self.player_url = stream_data.get("player_url") + return self.stream_url def index_scenes( self, From b5d785cb03a282e7bba7c96420f70d4d0abc88d7 Mon Sep 17 00:00:00 2001 From: Om Gate Date: Tue, 10 Mar 2026 17:07:44 +0530 Subject: [PATCH 2/3] feat: remove player render option --- videodb/rtstream.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/videodb/rtstream.py b/videodb/rtstream.py index 5bbbd60..bc08a74 100644 --- a/videodb/rtstream.py +++ b/videodb/rtstream.py @@ -431,7 +431,6 @@ def generate_stream( self, start: int, end: int, - player_render: bool = True, player_title: str = None, player_description: str = None, player_slug_prefix: str = None, @@ -440,14 +439,13 @@ def generate_stream( :param int start: Start time of the stream in Unix timestamp format :param int end: End time of the stream in Unix timestamp format - :param bool player_render: Whether to generate a player URL for the stream :param str player_title: Optional player title metadata :param str player_description: Optional player description metadata :param str player_slug_prefix: Optional prefix for the generated player slug :return: Stream URL :rtype: str """ - params = {"start": start, "end": end, "player_render": player_render} + params = {"start": start, "end": end} if player_title: params["player_title"] = player_title if player_description: From 96d1e1a9505b09c7629f087b412a14fb2feb025f Mon Sep 17 00:00:00 2001 From: Om Gate Date: Tue, 10 Mar 2026 17:29:57 +0530 Subject: [PATCH 3/3] feat: player as a config --- videodb/rtstream.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/videodb/rtstream.py b/videodb/rtstream.py index bc08a74..540844f 100644 --- a/videodb/rtstream.py +++ b/videodb/rtstream.py @@ -431,27 +431,29 @@ def generate_stream( self, start: int, end: int, - player_title: str = None, - player_description: str = None, - player_slug_prefix: str = None, + player_config: Optional[Dict[str, str]] = None, ) -> str: """Generate a stream from the rtstream. :param int start: Start time of the stream in Unix timestamp format :param int end: End time of the stream in Unix timestamp format - :param str player_title: Optional player title metadata - :param str player_description: Optional player description metadata - :param str player_slug_prefix: Optional prefix for the generated player slug + :param dict player_config: Optional player metadata with `title`, + `description`, and `slug` keys :return: Stream URL :rtype: str """ params = {"start": start, "end": end} - if player_title: - params["player_title"] = player_title - if player_description: - params["player_description"] = player_description - if player_slug_prefix: - params["player_slug_prefix"] = player_slug_prefix + if player_config: + player_title = player_config.get("title") + player_description = player_config.get("description") + player_slug = player_config.get("slug") + + if player_title: + params["player_title"] = player_title + if player_description: + params["player_description"] = player_description + if player_slug: + params["player_slug_prefix"] = player_slug stream_data = self._connection.get( f"{ApiPath.rtstream}/{self.id}/{ApiPath.stream}", @@ -459,7 +461,7 @@ def generate_stream( ) self.stream_url = stream_data.get("stream_url") self.player_url = stream_data.get("player_url") - return self.stream_url + return self.player_url def index_scenes( self,