https://livekit.io logo
Title
p

prehistoric-needle-99890

05/25/2023, 10:25 AM
Hi, I've noticed that rtmp egress only lives for the duration of a session rather than for the life of the room. Is it possible to allow egress output to persist through multiple sessions of a room?
d

dry-elephant-14928

05/25/2023, 8:57 PM
Egress itself is a session-based construct.. (since all of the identifiers change when a new session comes). Even with RoomComposite egress, it would live as long as the room is. However, you can use AutoEgress to configure a template when rooms are created, that will ensure that the new rooms will also start the egress according to your template.
s

shy-sandwich-47644

05/30/2023, 3:10 PM
Hi @dry-elephant-14928 I have few questions related with AutoEgress.
1. AutoEgress supports the RTMP output same as the normal egress right? 2. Let's say, I created a room via server SDK and configured the RTMP output, User(s) join the session, and disconnected after sometime (let's say close the browser tab) and no buddy left in the room so will autoegress automatically close? and what if user(s) rejoin the same session again will the autoegress restart again using the same RTMP output?
d

dry-elephant-14928

05/30/2023, 4:47 PM
CC: @able-gigabyte-21598
a

able-gigabyte-21598

05/30/2023, 6:28 PM
1. Yes, it supports all the same outputs 2. Yes, autoegress will automatically close when nobody is left in the room, and if people later rejoined it would not restart again. To ensure that sessions are always started with autoegress enabled, you can disable automatic room creation
s

shy-sandwich-47644

05/30/2023, 7:22 PM
@able-gigabyte-21598 just to confirm, If the auto room creation is disabled with AutoEgress config, and all the users in the room left and re-join (after any interval of time), AutoEgress will automatically start. correct?
a

able-gigabyte-21598

05/30/2023, 7:27 PM
The room itself would not restart in this situation. You would need to use the CreateRoom api again before the users re-join
s

shy-sandwich-47644

05/30/2023, 7:29 PM
Oh, That's tricky. What if the room already created, and we call the CreateRoom api again (with same room Name and RTMP output config) ?
let me explain my use case. We send a unique urls to our public users to join the video session, when user land of the unique url, we first perform the authentication/authorization, then we return the token using server side sdk
const at = new livekitApi.AccessToken('livekit:key', 'livekit:secret', {
    identity: participantName,
    metadata: JSON.stringify(metadata)
  });
  at.addGrant({ roomJoin: true, room: roomName });
  return at.toJwt();
So before getting the token we can easily call the CreateRoom API.
fyi:
roomName
will always stay same for those unique urls. Even user disconnects and come back after sometime.
a

able-gigabyte-21598

05/30/2023, 9:49 PM
Calling CreateRoom every time should work
👍 1