Skip to content

Commit a56c174

Browse files
authored
Add ForwardParticipant method to room service (#440)
* Add ForwardParticipant method to room service * prettier * update protocol
1 parent 65a14b2 commit a56c174

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

.changeset/fair-squids-applaud.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'livekit-server-sdk': minor
3+
---
4+
5+
Add ForwardParticipant to room service

packages/livekit-server-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
},
4444
"dependencies": {
4545
"@bufbuild/protobuf": "^1.7.2",
46-
"@livekit/protocol": "^1.32.1",
46+
"@livekit/protocol": "^1.36.1",
4747
"camelcase-keys": "^9.0.0",
4848
"jose": "^5.1.2"
4949
},

packages/livekit-server-sdk/src/RoomServiceClient.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { DataPacket_Kind, RoomEgress, TrackInfo } from '@livekit/protocol';
55
import {
66
CreateRoomRequest,
77
DeleteRoomRequest,
8+
ForwardParticipantRequest,
89
ListParticipantsRequest,
910
ListParticipantsResponse,
1011
ListRoomsRequest,
@@ -224,6 +225,24 @@ export class RoomServiceClient extends ServiceBase {
224225
);
225226
}
226227

228+
/**
229+
* Forwards a participant's track to another room. This will create a
230+
* participant to join the destination room that has same information
231+
* with the source participant except the kind to be `Forwarded`. All
232+
* changes to the source participant will be reflected to the forwarded
233+
* participant. When the source participant disconnects or the
234+
* `RemoveParticipant` method is called in the destination room, the
235+
* forwarding will be stopped.
236+
*/
237+
async forwardParticipant(room: string, identity: string, destinationRoom: string): Promise<void> {
238+
await this.rpc.request(
239+
svc,
240+
'ForwardParticipant',
241+
new ForwardParticipantRequest({ room, identity, destinationRoom }).toJson(),
242+
await this.authHeader({ roomAdmin: true, room }),
243+
);
244+
}
245+
227246
/**
228247
* Mutes a track that the participant has published.
229248
* @param room -

pnpm-lock.yaml

Lines changed: 9 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)