Skip to content

Commit

Permalink
Add isAgent getter on participant (#960)
Browse files Browse the repository at this point in the history
* Add isAgent getter on participant

* Create shy-steaks-poke.md
  • Loading branch information
lukasIO authored Dec 7, 2023
1 parent 3e8b46c commit b411cbe
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/shy-steaks-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"livekit-client": patch
---

Add isAgent getter on participant
16 changes: 15 additions & 1 deletion src/proto/livekit_models_pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// @generated by protoc-gen-es v1.3.3 with parameter "target=ts"
// @generated by protoc-gen-es v1.4.2 with parameter "target=ts"
// @generated from file livekit_models.proto (package livekit, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down Expand Up @@ -218,12 +218,18 @@ export enum ConnectionQuality {
* @generated from enum value: EXCELLENT = 2;
*/
EXCELLENT = 2,

/**
* @generated from enum value: LOST = 3;
*/
LOST = 3,
}
// Retrieve enum metadata with: proto3.getEnumType(ConnectionQuality)
proto3.util.setEnumType(ConnectionQuality, "livekit.ConnectionQuality", [
{ no: 0, name: "POOR" },
{ no: 1, name: "GOOD" },
{ no: 2, name: "EXCELLENT" },
{ no: 3, name: "LOST" },
]);

/**
Expand Down Expand Up @@ -614,6 +620,13 @@ export class ParticipantPermission extends Message<ParticipantPermission> {
*/
canUpdateMetadata = false;

/**
* indicates that participant is an agent
*
* @generated from field: bool agent = 11;
*/
agent = false;

constructor(data?: PartialMessage<ParticipantPermission>) {
super();
proto3.util.initPartial(data, this);
Expand All @@ -629,6 +642,7 @@ export class ParticipantPermission extends Message<ParticipantPermission> {
{ no: 7, name: "hidden", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
{ no: 8, name: "recorder", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
{ no: 10, name: "can_update_metadata", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
{ no: 11, name: "agent", kind: "scalar", T: 8 /* ScalarType.BOOL */ },
]);

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ParticipantPermission {
Expand Down
2 changes: 1 addition & 1 deletion src/proto/livekit_rtc_pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// @generated by protoc-gen-es v1.3.3 with parameter "target=ts"
// @generated by protoc-gen-es v1.4.2 with parameter "target=ts"
// @generated from file livekit_rtc.proto (package livekit, syntax proto3)
/* eslint-disable */
// @ts-nocheck
Expand Down
4 changes: 4 additions & 0 deletions src/room/participant/Participant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ export default class Participant extends (EventEmitter as new () => TypedEmitter
return this.tracks.size > 0 && Array.from(this.tracks.values()).every((tr) => tr.isEncrypted);
}

get isAgent() {
return this.permissions?.agent ?? false;
}

/** @internal */
constructor(sid: string, identity: string, name?: string, metadata?: string) {
super();
Expand Down

0 comments on commit b411cbe

Please sign in to comment.