From 697f5f3ef0cbc03c8608b2f4f036a4c46d54e564 Mon Sep 17 00:00:00 2001 From: Om Gate Date: Tue, 10 Mar 2026 16:51:14 +0530 Subject: [PATCH 1/4] 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 1b01689a1b3293d9dc0737693602b1b1f1fadac0 Mon Sep 17 00:00:00 2001 From: Om Gate Date: Tue, 10 Mar 2026 17:07:44 +0530 Subject: [PATCH 2/4] 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 c8aa70fdb5eda54cb274c0299ac51f422be4ad53 Mon Sep 17 00:00:00 2001 From: Om Gate Date: Tue, 10 Mar 2026 17:29:57 +0530 Subject: [PATCH 3/4] 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, From d8236a5a8ea3471d2f8c7167c4a5889bcf5d5adb Mon Sep 17 00:00:00 2001 From: Lalit Gupta Date: Tue, 10 Mar 2026 20:16:44 +0530 Subject: [PATCH 4/4] chore: bump version to 0.4.2 --- videodb/__about__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/videodb/__about__.py b/videodb/__about__.py index c7587c0..c1f5177 100644 --- a/videodb/__about__.py +++ b/videodb/__about__.py @@ -2,7 +2,7 @@ -__version__ = "0.4.1" +__version__ = "0.4.2" __title__ = "videodb" __author__ = "videodb" __email__ = "contact@videodb.io"