Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add isAgent getter on participant #960

Merged
merged 2 commits into from
Dec 7, 2023
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/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
Loading