wonderful-account-72949
09/11/2025, 7:36 AMtall-airline-16756
09/11/2025, 7:36 AMtall-airline-16756
09/11/2025, 7:37 AMParticipantEgressRequest
with the screen_share=True
parameter. This way, it captures both the video and audio from the participant's screen-sharing source right when screen sharing starts.
Here's a simple example to guide you:
from livekit import api
# Initialize the LiveKit API client
lkapi = api.LiveKitAPI()
# Start recording participant's screen share (with audio)
request = api.ParticipantEgressRequest(
room_name="my-room",
identity="user-to-record",
screen_share=True, # Enables screen share recording
file_outputs=[
api.EncodedFileOutput(
file_type=api.EncodedFileType.MP4,
filepath="recordings/screen_with_audio.mp4",
s3=api.S3Upload(
bucket="my-bucket",
region="us-west-2",
access_key="your-access-key",
secret="your-secret-key",
),
)
],
)
# Start the egress
egress_info = await lkapi.egress.start_participant_egress(request)
print(f"Screen recording started: {egress_info.egress_id}")
Just a quick tip: make sure that screen share audio is enabled on the client side when setting up the screen capture. Also, if you're looking to record all participants in the room along with their screen shares, using RoomCompositeEgressRequest
might be the way to go.
If you have any questions or need more examples, please don’t hesitate to ask—I’m here to help!