Overview
Web egress allows you to record or stream any website. Similar to room composite egress, it uses headless Chromium to render output. Unlike room composite egress, you can supply any url, and the lifecycle of web egress is not attached to a LiveKit room.
Usage
const output = {fileType: EncodedFileType.MP4,filepath: 'livekit-demo/web-test.mp4',s3: {accessKey: 'aws-access-key',secret: 'aws-access-secret',region: 'aws-region',bucket: 'my-bucket'}};const info = await egressClient.startWebEgress('https://docs.livekit.io/server/egress', output);const egressID = info.egressId;
request := &livekit.WebEgressRequest{Url: "https://docs.livekit.io/server/egress",Output: &livekit.WebEgressRequest_File{File: &livekit.EncodedFileOutput{FileType: livekit.EncodedFileType_MP4,Filepath: "livekit-demo/web-test.mp4",Output: &livekit.EncodedFileOutput_S3{S3: &livekit.S3Upload{AccessKey: "aws-access-key",Secret: "aws-access-secret",Region: "aws-region",Bucket: "my-bucket",},},},},}info, err := egressClient.StartWebEgress(ctx, request)egressID := info.EgressId
# require a special type for arrays, which enforces type# RTMP simulcast is supportedurls = Google::Protobuf::RepeatedField.new(:string, ['rtmp://url1', 'rtmps://url2'])info = egressClient.start_web_egress('https://docs.livekit.io/server/egress',LiveKit::Proto::StreamOutput.new(protocol: LiveKit::Proto::StreamProtocol::RTMP,urls: urls))puts info
LivekitEgress.EncodedFileOutput output = LivekitEgress.EncodedFileOutput.newBuilder().setFileType(LivekitEgress.EncodedFileType.MP4).setFilepath("livekit-demo/web-test.mp4").setS3(LivekitEgress.S3Upload.newBuilder().setAccessKey("access-key").setSecret("secret").setBucket("bucket").setEndpoint("https://my.s3.endpoint").build()).build();Call<LivekitEgress.EgressInfo> call = client.startWebEgress("https://docs.livekit.io/server/egress",output);try {LivekitEgress.EgressInfo egressInfo = call.execute().body();// handle engress info} catch (IOException e) {// handle error}
{"url": "https://docs.livekit.io/server/egress","file": {"file_type": "MP4","filepath": "livekit-demo/web-test.mp4","s3": {"access_key": "aws-access-key","secret": "aws-access-secret","region": "aws-region","bucket": "my-bucket"}}}
livekit-cli start-web-egress --request request.json
Egress started. Egress ID: EG_XXXXXXXXXXXX
Supported Outputs
Web egress supports the same output methods as RoomComposite: RTMP, MP4, and HLS. Refer to RoomComposite examples for additional details.