diff --git a/livekit-rtc/livekit/rtc/data_stream.py b/livekit-rtc/livekit/rtc/data_stream.py index c7a22bf5..9e994805 100644 --- a/livekit-rtc/livekit/rtc/data_stream.py +++ b/livekit-rtc/livekit/rtc/data_stream.py @@ -70,6 +70,8 @@ async def _on_chunk_update(self, chunk: proto_DataStream.Chunk): await self._queue.put(chunk) async def _on_stream_close(self, trailer: proto_DataStream.Trailer): + self.info.attributes = self.info.attributes or {} + self.info.attributes.update(trailer.attributes) await self._queue.put(None) def __aiter__(self) -> AsyncIterator[str]: @@ -118,6 +120,8 @@ async def _on_chunk_update(self, chunk: proto_DataStream.Chunk): await self._queue.put(chunk) async def _on_stream_close(self, trailer: proto_DataStream.Trailer): + self.info.attributes = self.info.attributes or {} + self.info.attributes.update(trailer.attributes) await self._queue.put(None) def __aiter__(self) -> AsyncIterator[bytes]: