|
31 | 31 | from ._proto.room_pb2 import ( |
32 | 32 | TranscriptionSegment as ProtoTranscriptionSegment, |
33 | 33 | ) |
| 34 | +from ._proto.track_pb2 import ( |
| 35 | + ParticipantTrackPermission, |
| 36 | +) |
34 | 37 | from ._utils import BroadcastQueue, split_utf8 |
35 | 38 | from .track import LocalTrack |
36 | 39 | from .track_publication import ( |
@@ -398,6 +401,34 @@ def unregister_rpc_method(self, method: str) -> None: |
398 | 401 |
|
399 | 402 | FfiClient.instance.request(req) |
400 | 403 |
|
| 404 | + def set_track_subscription_permissions( |
| 405 | + self, |
| 406 | + *, |
| 407 | + allow_all_participants: bool, |
| 408 | + participant_permissions: Optional[List[ParticipantTrackPermission]] = None, |
| 409 | + ) -> None: |
| 410 | + """ |
| 411 | + Set the track subscription permissions for the local participant. |
| 412 | +
|
| 413 | + Args: |
| 414 | + allow_all_participants (bool): Whether to allow all participants to subscribe to this participant's tracks. |
| 415 | + participant_permissions (List[ParticipantTrackPermission]): Participant-specific track subscription permissions, ignored if `allow_all_participants` is True. |
| 416 | + """ |
| 417 | + if participant_permissions is None: |
| 418 | + participant_permissions = [] |
| 419 | + |
| 420 | + req = proto_ffi.FfiRequest() |
| 421 | + req.set_track_subscription_permissions.local_participant_handle = ( |
| 422 | + self._ffi_handle.handle |
| 423 | + ) |
| 424 | + req.set_track_subscription_permissions.all_participants_allowed = ( |
| 425 | + allow_all_participants |
| 426 | + ) |
| 427 | + req.set_track_subscription_permissions.permissions.extend( |
| 428 | + participant_permissions |
| 429 | + ) |
| 430 | + FfiClient.instance.request(req) |
| 431 | + |
401 | 432 | async def _handle_rpc_method_invocation( |
402 | 433 | self, |
403 | 434 | invocation_id: int, |
|
0 commit comments