Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/loud-seas-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'livekit-server-sdk': minor
---

Support moving participant to another room
2 changes: 1 addition & 1 deletion packages/livekit-server-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
21 changes: 21 additions & 0 deletions packages/livekit-server-sdk/src/RoomServiceClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
ListParticipantsResponse,
ListRoomsRequest,
ListRoomsResponse,
MoveParticipantRequest,
MuteRoomTrackRequest,
MuteRoomTrackResponse,
ParticipantInfo,
Expand Down Expand Up @@ -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<void> {
await this.rpc.request(
Expand All @@ -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
Comment on lines +254 to +256

Copilot AI May 9, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The parameter documentation for 'room' and 'identity' in the moveParticipant method uses placeholders. Consider providing more detailed descriptions to improve clarity.

Suggested change
* @param room -
* @param identity -
* @param destinationRoom - the room to move the participant to
* @param room - the name of the room the participant is currently in
* @param identity - the unique identifier of the participant to be moved
* @param destinationRoom - the name of the room to move the participant to

Copilot uses AI. Check for mistakes.
*/
async moveParticipant(room: string, identity: string, destinationRoom: string): Promise<void> {
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 -
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.