-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve reference docs for Server APIs (#306)
- Loading branch information
Showing
9 changed files
with
449 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -162,4 +162,6 @@ cython_debug/ | |
# vscode project settings | ||
.vscode | ||
|
||
.DS_Store | ||
.DS_Store | ||
|
||
docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,112 +1,126 @@ | ||
import aiohttp | ||
from livekit.protocol import egress as proto_egress | ||
from livekit.protocol.egress import ( | ||
RoomCompositeEgressRequest, | ||
WebEgressRequest, | ||
ParticipantEgressRequest, | ||
TrackCompositeEgressRequest, | ||
TrackEgressRequest, | ||
UpdateLayoutRequest, | ||
UpdateStreamRequest, | ||
ListEgressRequest, | ||
StopEgressRequest, | ||
EgressInfo, | ||
ListEgressResponse, | ||
) | ||
from ._service import Service | ||
from .access_token import VideoGrants | ||
|
||
SVC = "Egress" | ||
"""@private""" | ||
|
||
|
||
class EgressService(Service): | ||
"""Client for LiveKit Egress Service API | ||
Recommended way to use this service is via `livekit.api.LiveKitAPI`: | ||
```python | ||
from livekit import api | ||
lkapi = api.LiveKitAPI() | ||
egress = lkapi.egress | ||
``` | ||
Also see https://docs.livekit.io/home/egress/overview/ | ||
""" | ||
|
||
def __init__( | ||
self, session: aiohttp.ClientSession, url: str, api_key: str, api_secret: str | ||
): | ||
super().__init__(session, url, api_key, api_secret) | ||
|
||
async def start_room_composite_egress( | ||
self, start: proto_egress.RoomCompositeEgressRequest | ||
) -> proto_egress.EgressInfo: | ||
self, start: RoomCompositeEgressRequest | ||
) -> EgressInfo: | ||
return await self._client.request( | ||
SVC, | ||
"StartRoomCompositeEgress", | ||
start, | ||
self._auth_header(VideoGrants(room_record=True)), | ||
proto_egress.EgressInfo, | ||
EgressInfo, | ||
) | ||
|
||
async def start_web_egress( | ||
self, start: proto_egress.WebEgressRequest | ||
) -> proto_egress.EgressInfo: | ||
async def start_web_egress(self, start: WebEgressRequest) -> EgressInfo: | ||
return await self._client.request( | ||
SVC, | ||
"StartWebEgress", | ||
start, | ||
self._auth_header(VideoGrants(room_record=True)), | ||
proto_egress.EgressInfo, | ||
EgressInfo, | ||
) | ||
|
||
async def start_participant_egress( | ||
self, start: proto_egress.ParticipantEgressRequest | ||
) -> proto_egress.EgressInfo: | ||
self, start: ParticipantEgressRequest | ||
) -> EgressInfo: | ||
return await self._client.request( | ||
SVC, | ||
"StartParticipantEgress", | ||
start, | ||
self._auth_header(VideoGrants(room_record=True)), | ||
proto_egress.EgressInfo, | ||
EgressInfo, | ||
) | ||
|
||
async def start_track_composite_egress( | ||
self, start: proto_egress.TrackCompositeEgressRequest | ||
) -> proto_egress.EgressInfo: | ||
self, start: TrackCompositeEgressRequest | ||
) -> EgressInfo: | ||
return await self._client.request( | ||
SVC, | ||
"StartTrackCompositeEgress", | ||
start, | ||
self._auth_header(VideoGrants(room_record=True)), | ||
proto_egress.EgressInfo, | ||
EgressInfo, | ||
) | ||
|
||
async def start_track_egress( | ||
self, start: proto_egress.TrackEgressRequest | ||
) -> proto_egress.EgressInfo: | ||
async def start_track_egress(self, start: TrackEgressRequest) -> EgressInfo: | ||
return await self._client.request( | ||
SVC, | ||
"StartTrackEgress", | ||
start, | ||
self._auth_header(VideoGrants(room_record=True)), | ||
proto_egress.EgressInfo, | ||
EgressInfo, | ||
) | ||
|
||
async def update_layout( | ||
self, update: proto_egress.UpdateLayoutRequest | ||
) -> proto_egress.EgressInfo: | ||
async def update_layout(self, update: UpdateLayoutRequest) -> EgressInfo: | ||
return await self._client.request( | ||
SVC, | ||
"UpdateLayout", | ||
update, | ||
self._auth_header(VideoGrants(room_record=True)), | ||
proto_egress.EgressInfo, | ||
EgressInfo, | ||
) | ||
|
||
async def update_stream( | ||
self, update: proto_egress.UpdateStreamRequest | ||
) -> proto_egress.EgressInfo: | ||
async def update_stream(self, update: UpdateStreamRequest) -> EgressInfo: | ||
return await self._client.request( | ||
SVC, | ||
"UpdateStream", | ||
update, | ||
self._auth_header(VideoGrants(room_record=True)), | ||
proto_egress.EgressInfo, | ||
EgressInfo, | ||
) | ||
|
||
async def list_egress( | ||
self, list: proto_egress.ListEgressRequest | ||
) -> proto_egress.ListEgressResponse: | ||
async def list_egress(self, list: ListEgressRequest) -> ListEgressResponse: | ||
return await self._client.request( | ||
SVC, | ||
"ListEgress", | ||
list, | ||
self._auth_header(VideoGrants(room_record=True)), | ||
proto_egress.ListEgressResponse, | ||
ListEgressResponse, | ||
) | ||
|
||
async def stop_egress( | ||
self, stop: proto_egress.StopEgressRequest | ||
) -> proto_egress.EgressInfo: | ||
async def stop_egress(self, stop: StopEgressRequest) -> EgressInfo: | ||
return await self._client.request( | ||
SVC, | ||
"StopEgress", | ||
stop, | ||
self._auth_header(VideoGrants(room_record=True)), | ||
proto_egress.EgressInfo, | ||
EgressInfo, | ||
) |
Oops, something went wrong.