diff --git a/.changeset/loud-seas-sniff.md b/.changeset/loud-seas-sniff.md new file mode 100644 index 00000000..5fee7009 --- /dev/null +++ b/.changeset/loud-seas-sniff.md @@ -0,0 +1,5 @@ +--- +'livekit-server-sdk': minor +--- + +Support moving participant to another room diff --git a/packages/livekit-server-sdk/package.json b/packages/livekit-server-sdk/package.json index 7ae6224b..83c46197 100644 --- a/packages/livekit-server-sdk/package.json +++ b/packages/livekit-server-sdk/package.json @@ -43,7 +43,7 @@ }, "dependencies": { "@bufbuild/protobuf": "^1.7.2", - "@livekit/protocol": "^1.36.1", + "@livekit/protocol": "^1.38.0", "camelcase-keys": "^9.0.0", "jose": "^5.1.2" }, diff --git a/packages/livekit-server-sdk/src/RoomServiceClient.ts b/packages/livekit-server-sdk/src/RoomServiceClient.ts index 9157f5bc..2a17e575 100644 --- a/packages/livekit-server-sdk/src/RoomServiceClient.ts +++ b/packages/livekit-server-sdk/src/RoomServiceClient.ts @@ -10,6 +10,7 @@ import { ListParticipantsResponse, ListRoomsRequest, ListRoomsResponse, + MoveParticipantRequest, MuteRoomTrackRequest, MuteRoomTrackResponse, ParticipantInfo, @@ -233,6 +234,9 @@ export class RoomServiceClient extends ServiceBase { * participant. When the source participant disconnects or the * `RemoveParticipant` method is called in the destination room, the * forwarding will be stopped. + * @param room - + * @param identity - + * @param destinationRoom - the room to forward the participant to */ async forwardParticipant(room: string, identity: string, destinationRoom: string): Promise { await this.rpc.request( @@ -243,6 +247,23 @@ export class RoomServiceClient extends ServiceBase { ); } + /** + * Move a connected participant to a different room. Requires `roomAdmin` and `destinationRoom`. + * The participant will be removed from the current room and added to the destination room. + * From the other observers' perspective, the participant would've disconnected from the previous room and joined the new one. + * @param room - + * @param identity - + * @param destinationRoom - the room to move the participant to + */ + async moveParticipant(room: string, identity: string, destinationRoom: string): Promise { + await this.rpc.request( + svc, + 'MoveParticipant', + new MoveParticipantRequest({ room, identity, destinationRoom }).toJson(), + await this.authHeader({ roomAdmin: true, room, destinationRoom }), + ); + } + /** * Mutes a track that the participant has published. * @param room - diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a1e1a67d..297cfd92 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -270,8 +270,8 @@ importers: specifier: ^1.7.2 version: 1.10.0 '@livekit/protocol': - specifier: ^1.36.1 - version: 1.36.1 + specifier: ^1.38.0 + version: 1.38.0 camelcase-keys: specifier: ^9.0.0 version: 9.1.3 @@ -956,8 +956,8 @@ packages: '@livekit/protocol@1.35.0': resolution: {integrity: sha512-uVVfQQr9JlsE+WBKbMgMdsxuVCG2zYkcE52bOjRQiGQvdbj9dm90A7sy+G7Vrb0QPGaN30xlI7nvtKpcGqw9Nw==} - '@livekit/protocol@1.36.1': - resolution: {integrity: sha512-nN3QnITAQ5yXk7UKfotH7CRWIlEozNWeKVyFJ0/+dtSzvWP/ib+10l1DDnRYi3A1yICJOGAKFgJ5d6kmi1HCUA==} + '@livekit/protocol@1.38.0': + resolution: {integrity: sha512-XX6ulvsE1XCN18LVf3ydHN7Ri1Z1M1P5dQdjnm5nVDsSqUL12Vbo/4RKcRlCEXAg2qB62mKjcaVLXVwkfXggkg==} '@livekit/typed-emitter@3.0.0': resolution: {integrity: sha512-9bl0k4MgBPZu3Qu3R3xy12rmbW17e3bE9yf4YY85gJIQ3ezLEj/uzpKHWBsLaDoL5Mozz8QCgggwIBudYQWeQg==} @@ -4163,7 +4163,7 @@ snapshots: dependencies: '@bufbuild/protobuf': 1.10.0 - '@livekit/protocol@1.36.1': + '@livekit/protocol@1.38.0': dependencies: '@bufbuild/protobuf': 1.10.0