wonderful-account-72949
10/24/2025, 5:58 AMtall-airline-16756
10/24/2025, 5:58 AMtall-airline-16756
10/24/2025, 5:58 AMstartParticipantEgress with the screen_share parameter set to true. This lets you capture a participant's screen and audio, which is perfect for things like lecture recordings or agent assistance.
• Custom Layout: Another option is to use StartRoomCompositeEgress along with a custom web app. By hosting your own HTML/React app and setting its URL as the customBaseUrl, you can create a fully personalized recording layout—whether that’s grids, speaker focus, or even branded overlays.
If you’d like, I can walk you through the detailed steps for either option. Just let me know, and I’ll be here to guide you!
Sources: lib/livekit/egress_service_client.rb | livekit-api/livekit/api/egress_service.py | livekit-protocol/src/livekit.rs | Custom recording templates | LiveKit Docs | template-sdk/src/index.tswonderful-account-72949
10/24/2025, 6:04 AM# Set up recording request
req = api.RoomCompositeEgressRequest(
room_name=ctx.room.name,
audio_only=False, # Record both audio and video
file_outputs=[api.EncodedFileOutput(
file_type=api.EncodedFileType.MP4, # Use MP4 for video
filepath=filename.replace('.ogg', '.mp4'), # Change extension to .mp4
s3=api.S3Upload(
bucket=s3_bucket,
region=s3_region,
access_key=s3_access_key,
secret=s3_secret_key,
),
)],
)
# Start recording with proper LiveKit API configuration
lkapi = api.LiveKitAPI(
url=livekit_url,
api_key=livekit_api_key,
api_secret=livekit_api_secret
)
res = await lkapi.egress.start_room_composite_egress(req)
This is my code, you can tell me where i need to pass param for screen sharetall-airline-16756
10/24/2025, 6:05 AMRoomCompositeEgressRequest already includes screen sharing by default, as long as participants are actively sharing their screens during the session. So, no extra parameters are needed to get screen share working here.
If you’d like to record just the screen share from a specific participant, you can switch to using ParticipantEgressRequest and set the screenShare parameter to true. That should do the trick!
Feel free to reach out if you want me to walk you through any part of this or help tweak your code further. I’m here to help!
Sources: Universal Egress | Composite and web recordings | LiveKit Docs | RoomComposite Egress | LiveKit Docs | packages/livekit-server-sdk/src/EgressClient.tswonderful-account-72949
10/24/2025, 6:06 AMtall-airline-16756
10/24/2025, 6:07 AMcreateScreenTracks() to capture the screen, then publish it with localParticipant.publishVideoTrack().
◦ iOS/macOS: Use createMacOSScreenShareTrack() or createBroadcastScreenCapturerTrack() to create and publish your track.
◦ Android: Utilize MediaProjectionManager along with setScreenShareEnabled() to enable screen sharing.
1. Enable Recording: To record just the screen share, use ParticipantEgressRequest with screen_share=true. If you want to include it in the full room recording, go with RoomCompositeEgressRequest.
If you’d like, I’d be happy to provide specific code examples for your platform or help you with any other questions you might have. Just let me know!
Sources: Docs/ios-screen-sharing.md | Screen sharing | LiveKit Docs | README.md | Recording participants | LiveKit Docs | Custom recording templates | LiveKit Docswonderful-account-72949
10/24/2025, 6:08 AMtall-airline-16756
10/24/2025, 6:08 AMcreateScreenTracks method from the LiveKit JS SDK. This lets you capture the screen and, if you like, include audio too:
try {
const screenTracks = await createScreenTracks({
audio: true, // Enable audio sharing if supported
resolution: '1080p', // Specify resolution
});
// Publish the video track
await room.localParticipant.publishTrack(screenTracks[0]);
// If audio is included, publish the audio track
if (screenTracks.length > 1) {
await room.localParticipant.publishTrack(screenTracks[1]);
}
} catch (error) {
console.error('Error publishing screen share:', error);
}
Recording the Screen Share
1. Enable Screen Share in Egress Request: When you start a recording, just set screen_share=true in the egress request parameters. This ensures the screen share and its audio are captured.
2. Start Recording: The Egress service will take care of recording the screen share track as soon as it’s published. It also manages mute states and will stop recording when the participant leaves the room.
If you have any questions or need a hand with the recording setup or more examples, please don’t hesitate to ask—I’m here to help!
Sources: Screen sharing | LiveKit Docs | Recording participants | LiveKit Docswonderful-account-72949
10/24/2025, 6:12 AMtall-airline-16756
10/24/2025, 6:13 AMcaptureStream() method to create a MediaStream from an HTML canvas or another source:const canvas = document.getElementById('myCanvas');
const mediaStream = canvas.captureStream(30); // 30 fps
2. Publish the Stream: Next, grab the video track from the MediaStream and publish it to LiveKit like this:const videoTrack = mediaStream.getVideoTracks()[0];
localParticipant.publishTrack(videoTrack, {
name: "custom-screen-share",
source: Track.Source.ScreenShare, // or Track.Source.Unknown
});
3. Record the Stream: To make sure your custom screen share is recorded, use Participant Egress with screen_share=true.
This method lets you share all kinds of custom visuals, whether it’s animations, presentations, or anything else you want to show. If you have any questions or need a hand with any step, just let me know—I’m here to help!
Sources: Recording participants | LiveKit Docs | Sources/LiveKit/Broadcast/BroadcastScreenCapturer.swift | Screen sharing | LiveKit Docs | src/room/participant/LocalParticipant.tswonderful-account-72949
10/24/2025, 6:31 AMtall-airline-16756
10/24/2025, 6:32 AMwonderful-account-72949
10/24/2025, 6:33 AM# Set up recording request
req = api.RoomCompositeEgressRequest(
room_name=ctx.room.name,
audio_only=False, # Record both audio and video
file_outputs=[api.EncodedFileOutput(
file_type=api.EncodedFileType.MP4, # Use MP4 for video
filepath=filename.replace('.ogg', '.mp4'), # Change extension to .mp4
s3=api.S3Upload(
bucket=s3_bucket,
region=s3_region,
access_key=s3_access_key,
secret=s3_secret_key,
),
)],
)
# Start recording with proper LiveKit API configuration
lkapi = api.LiveKitAPI(
url=livekit_url,
api_key=livekit_api_key,
api_secret=livekit_api_secret
)
res = await lkapi.egress.start_room_composite_egress(req)tall-airline-16756
10/24/2025, 6:34 AMRoom.tsx or SpeakerLayout.tsx to exclude the camera preview.
◦ Finally, deploy your customized template and set its URL using the custom_base_url parameter when you start the egress.
1. Alternative API Options: If custom templates aren’t your preference, you might want to try these:
◦ ParticipantEgress: This lets you record specific participants one by one, so you can simply leave out the participant whose camera preview you want to exclude.
◦ TrackCompositeEgress: This option allows you to record only the audio and video tracks you choose, giving you precise control over what’s included.
If you’d like, I’d be more than happy to walk you through detailed steps for any of these approaches or answer any questions you have. Just let me know!
Sources: packages/livekit-server-sdk/src/EgressClient.ts | livekit-protocol/livekit/protocol/egress.pyi | Custom recording templates | LiveKit Docs