Skip to content

Commit e70d341

Browse files
committed
update egress comments
1 parent 6b727a2 commit e70d341

File tree

8 files changed

+393
-43
lines changed

8 files changed

+393
-43
lines changed

livekit-api/livekit/api/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
from .twirp_client import TwirpError, TwirpErrorCode
3838
from .livekit_api import LiveKitAPI
39+
from .sip_service import SIPError
3940
from .access_token import VideoGrants, SIPGrants, AccessToken, TokenVerifier
4041
from .webhook import WebhookReceiver
4142
from .version import __version__
@@ -52,4 +53,7 @@
5253
"AccessToken",
5354
"TokenVerifier",
5455
"WebhookReceiver",
56+
"TwirpError",
57+
"TwirpErrorCode",
58+
"SIPError",
5559
]

livekit-api/livekit/api/_service.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
from typing import Dict
43
import aiohttp
54
from abc import ABC
65
from .twirp_client import TwirpClient
@@ -17,7 +16,7 @@ def __init__(self, session: aiohttp.ClientSession, host: str, api_key: str, api_
1716

1817
def _auth_header(
1918
self, grants: VideoGrants | None, sip: SIPGrants | None = None
20-
) -> Dict[str, str]:
19+
) -> dict[str, str]:
2120
tok = AccessToken(self.api_key, self.api_secret)
2221
if grants:
2322
tok.with_grants(grants)

livekit-api/livekit/api/egress_service.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def __init__(self, session: aiohttp.ClientSession, url: str, api_key: str, api_s
3737
super().__init__(session, url, api_key, api_secret)
3838

3939
async def start_room_composite_egress(self, start: RoomCompositeEgressRequest) -> EgressInfo:
40+
"""Starts a composite recording of a room."""
4041
return await self._client.request(
4142
SVC,
4243
"StartRoomCompositeEgress",
@@ -46,6 +47,7 @@ async def start_room_composite_egress(self, start: RoomCompositeEgressRequest) -
4647
)
4748

4849
async def start_web_egress(self, start: WebEgressRequest) -> EgressInfo:
50+
"""Starts a recording of a web page."""
4951
return await self._client.request(
5052
SVC,
5153
"StartWebEgress",
@@ -55,6 +57,7 @@ async def start_web_egress(self, start: WebEgressRequest) -> EgressInfo:
5557
)
5658

5759
async def start_participant_egress(self, start: ParticipantEgressRequest) -> EgressInfo:
60+
"""Starts a recording of a participant."""
5861
return await self._client.request(
5962
SVC,
6063
"StartParticipantEgress",
@@ -64,6 +67,7 @@ async def start_participant_egress(self, start: ParticipantEgressRequest) -> Egr
6467
)
6568

6669
async def start_track_composite_egress(self, start: TrackCompositeEgressRequest) -> EgressInfo:
70+
"""Starts a composite recording with audio and video tracks."""
6771
return await self._client.request(
6872
SVC,
6973
"StartTrackCompositeEgress",
@@ -73,6 +77,7 @@ async def start_track_composite_egress(self, start: TrackCompositeEgressRequest)
7377
)
7478

7579
async def start_track_egress(self, start: TrackEgressRequest) -> EgressInfo:
80+
"""Starts a recording of a single track."""
7681
return await self._client.request(
7782
SVC,
7883
"StartTrackEgress",
@@ -82,6 +87,7 @@ async def start_track_egress(self, start: TrackEgressRequest) -> EgressInfo:
8287
)
8388

8489
async def update_layout(self, update: UpdateLayoutRequest) -> EgressInfo:
90+
"""Updates the layout of a composite recording."""
8591
return await self._client.request(
8692
SVC,
8793
"UpdateLayout",
@@ -91,6 +97,7 @@ async def update_layout(self, update: UpdateLayoutRequest) -> EgressInfo:
9197
)
9298

9399
async def update_stream(self, update: UpdateStreamRequest) -> EgressInfo:
100+
"""Updates the stream of a RoomComposite, Web, or Participant recording."""
94101
return await self._client.request(
95102
SVC,
96103
"UpdateStream",
@@ -100,6 +107,14 @@ async def update_stream(self, update: UpdateStreamRequest) -> EgressInfo:
100107
)
101108

102109
async def list_egress(self, list: ListEgressRequest) -> ListEgressResponse:
110+
"""Lists all active egress and recently completed recordings.
111+
112+
Args:
113+
list (ListEgressRequest): arg contains optional filters:
114+
- room_name: str - List all egresses for a specific room
115+
- egress_id: str - Only list egress with matching ID
116+
- active: bool - Only list active egresses
117+
"""
103118
return await self._client.request(
104119
SVC,
105120
"ListEgress",
@@ -109,6 +124,7 @@ async def list_egress(self, list: ListEgressRequest) -> ListEgressResponse:
109124
)
110125

111126
async def stop_egress(self, stop: StopEgressRequest) -> EgressInfo:
127+
"""Stops an active egress recording."""
112128
return await self._client.request(
113129
SVC,
114130
"StopEgress",

livekit-api/livekit/api/room_service.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
UpdateRoomMetadataRequest,
1919
RemoveParticipantResponse,
2020
UpdateSubscriptionsResponse,
21+
ForwardParticipantRequest,
22+
ForwardParticipantResponse,
2123
)
2224
from livekit.protocol.models import Room, ParticipantInfo
2325
from ._service import Service
@@ -197,6 +199,24 @@ async def remove_participant(
197199
RemoveParticipantResponse,
198200
)
199201

202+
async def forward_participant(self, forward: ForwardParticipantRequest) -> None:
203+
"""Forwards a participant to a new room.
204+
205+
Args:
206+
forward (ForwardParticipantRequest): arg containing:
207+
- room: str - Room name
208+
- identity: str - identity of Participant to forward
209+
- destination_room: str - Destination room name
210+
"""
211+
# currently nothing is returned
212+
await self._client.request(
213+
SVC,
214+
"ForwardParticipant",
215+
forward,
216+
self._auth_header(VideoGrants(room_admin=True, room=forward.room)),
217+
ForwardParticipantResponse,
218+
)
219+
200220
async def mute_published_track(
201221
self,
202222
update: MuteRoomTrackRequest,

0 commit comments

Comments
 (0)