Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions livekit-rtc/livekit/rtc/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,34 @@ async def get_rtc_stats(self) -> RtcStats:

return RtcStats(publisher_stats=publisher_stats, subscriber_stats=subscriber_stats)

async def restart_publisher(self) -> None:
"""Restart the publisher PeerConnection with an ICE restart.

This is useful when the publisher connection fails while the subscriber still works.
For example, when sending data (stream_text/publish_data) times out but receiving
audio/video still works.

Raises:
NotImplementedError: This method requires FFI bindings in rust-sdks.
See: https://github.com/livekit/rust-sdks/issues/XXX

Example:
```python
try:
await room.local_participant.publish_data(data)
except TimeoutError:
# Publisher might be stuck, try to restart it
await room.restart_publisher()
# Retry the operation
await room.local_participant.publish_data(data)
```
"""
raise NotImplementedError(
"restart_publisher() requires FFI bindings in livekit/rust-sdks. "
"This is a placeholder for future implementation. "
"See: https://github.com/livekit/python-sdks/pull/571"
)

def register_byte_stream_handler(self, topic: str, handler: ByteStreamHandler):
existing_handler = self._byte_stream_handlers.get(topic)
if existing_handler is None:
Expand Down
Loading