diff --git a/template-sdk/package.json b/template-sdk/package.json index 32251e33..da1a82fc 100644 --- a/template-sdk/package.json +++ b/template-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@livekit/egress-sdk", - "version": "0.1.3", + "version": "0.2.0", "description": "A lightweight SDK for developing RoomComposite templates", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/template-sdk/src/index.ts b/template-sdk/src/index.ts index cc0f4960..41e97cad 100644 --- a/template-sdk/src/index.ts +++ b/template-sdk/src/index.ts @@ -16,11 +16,6 @@ import { ParticipantEvent, Room, RoomEvent } from 'livekit-client'; -export interface EgressOptions { - // automatically finish recording when the last participant leaves - autoEnd?: boolean; -} - const EgressHelper = { /** * RoomComposite will pass URL to your livekit's server instance. @@ -62,17 +57,13 @@ const EgressHelper = { * Call when successfully connected to the room * @param room */ - setRoom(room: Room, opts?: EgressOptions) { + setRoom(room: Room) { if (currentRoom) { - currentRoom.off(RoomEvent.ParticipantDisconnected, onParticipantDisconnected); currentRoom.off(RoomEvent.Disconnected, EgressHelper.endRecording); } currentRoom = room; currentRoom.localParticipant.on(ParticipantEvent.ParticipantMetadataChanged, onMetadataChanged); - if (opts?.autoEnd) { - currentRoom.on(RoomEvent.ParticipantDisconnected, onParticipantDisconnected); - } currentRoom.on(RoomEvent.Disconnected, EgressHelper.endRecording); onMetadataChanged(); }, @@ -124,14 +115,6 @@ function onMetadataChanged() { } } -function onParticipantDisconnected() { - if (currentRoom) { - if (currentRoom.participants.size === 0) { - EgressHelper.endRecording(); - } - } -} - function getURLParam(name: string): string | null { const query = new URLSearchParams(window.location.search); return query.get(name);