-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[Components] livekit - new components #16839
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
195 changes: 195 additions & 0 deletions
195
components/livekit/actions/generate-access-token/generate-access-token.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,195 @@ | ||
| import app from "../../livekit.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "livekit-generate-access-token", | ||
| name: "Generate Access Token", | ||
| description: "Generate an access token for a participant to join a LiveKit room. [See the documentation](https://github.com/livekit/node-sdks/tree/main/packages/livekit-server-sdk).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| room: { | ||
| description: "The name of the room to join", | ||
| optional: true, | ||
| propDefinition: [ | ||
| app, | ||
| "room", | ||
| ], | ||
| }, | ||
| ttl: { | ||
| type: "integer", | ||
| label: "Token TTL (seconds)", | ||
| description: "How long the access token should be valid for (in seconds)", | ||
| optional: true, | ||
| }, | ||
| name: { | ||
| type: "string", | ||
| label: "Participant Name", | ||
| description: "Display name for the participant", | ||
| optional: true, | ||
| }, | ||
| identity: { | ||
| type: "string", | ||
| label: "Participant Identity", | ||
| description: "Unique identity for the participant joining the call", | ||
| }, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| metadata: { | ||
| type: "string", | ||
| label: "Participant Metadata", | ||
| description: "Optional metadata to attach to the participant", | ||
| optional: true, | ||
| }, | ||
| canPublish: { | ||
| type: "boolean", | ||
| label: "Can Publish", | ||
| description: "Whether the participant can publish audio/video tracks", | ||
| optional: true, | ||
| }, | ||
| canSubscribe: { | ||
| type: "boolean", | ||
| label: "Can Subscribe", | ||
| description: "Whether the participant can subscribe to other participants' tracks", | ||
| optional: true, | ||
| }, | ||
| canPublishData: { | ||
| type: "boolean", | ||
| label: "Can Publish Data", | ||
| description: "Whether the participant can publish data messages", | ||
| optional: true, | ||
| }, | ||
| hidden: { | ||
| type: "boolean", | ||
| label: "Hidden Participant", | ||
| description: "Whether the participant should be hidden from other participants", | ||
| optional: true, | ||
| }, | ||
| roomCreate: { | ||
| type: "boolean", | ||
| label: "Room Create Permission", | ||
| description: "Permission to create rooms", | ||
| optional: true, | ||
| }, | ||
| roomList: { | ||
| type: "boolean", | ||
| label: "Room List Permission", | ||
| description: "Permission to list rooms", | ||
| optional: true, | ||
| }, | ||
| roomRecord: { | ||
| type: "boolean", | ||
| label: "Room Record Permission", | ||
| description: "Permission to start a recording", | ||
| optional: true, | ||
| }, | ||
| roomAdmin: { | ||
| type: "boolean", | ||
| label: "Room Admin Permission", | ||
| description: "Permission to control the specific room", | ||
| optional: true, | ||
| }, | ||
| ingressAdmin: { | ||
| type: "boolean", | ||
| label: "Ingress Admin Permission", | ||
| description: "Permission to control ingress, not specific to any room or ingress", | ||
| optional: true, | ||
| }, | ||
| canUpdateOwnMetadata: { | ||
| type: "boolean", | ||
| label: "Can Update Own Metadata", | ||
| description: "Allow participant to update its own metadata", | ||
| optional: true, | ||
| }, | ||
| recorder: { | ||
| type: "boolean", | ||
| label: "Recorder", | ||
| description: "Participant is recording the room, allows room to indicate it's being recorded", | ||
| optional: true, | ||
| }, | ||
| agent: { | ||
| type: "boolean", | ||
| label: "Agent", | ||
| description: "Participant allowed to connect to LiveKit as Agent Framework worker", | ||
| optional: true, | ||
| }, | ||
| canSubscribeMetrics: { | ||
| type: "boolean", | ||
| label: "Can Subscribe Metrics", | ||
| description: "Allow participant to subscribe to metrics", | ||
| optional: true, | ||
| }, | ||
| destinationRoom: { | ||
| type: "string", | ||
| label: "Destination Room", | ||
| description: "Destination room which this participant can forward to", | ||
| optional: true, | ||
| }, | ||
| createRoomIfNotExists: { | ||
| type: "boolean", | ||
| label: "Create Room If Not Exists", | ||
| description: "Whether to create the room if it doesn't exist", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| ttl, | ||
| identity, | ||
| name, | ||
| metadata, | ||
| room, | ||
| createRoomIfNotExists, | ||
| canPublish, | ||
| canSubscribe, | ||
| canPublishData, | ||
| hidden, | ||
| roomCreate, | ||
| roomList, | ||
| roomRecord, | ||
| roomAdmin, | ||
| ingressAdmin, | ||
| canUpdateOwnMetadata, | ||
| recorder, | ||
| agent, | ||
| canSubscribeMetrics, | ||
| destinationRoom, | ||
| } = this; | ||
|
|
||
| // Create room if it doesn't exist and option is enabled | ||
| if (createRoomIfNotExists) { | ||
| await app.createRoom({ | ||
| name: room, | ||
| }); | ||
| } | ||
|
|
||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| // Create access token for the participant | ||
| const response = await app.createAccessToken({ | ||
| identity, | ||
| name, | ||
| metadata, | ||
| ttl, | ||
| grant: { | ||
| roomJoin: true, | ||
| room, | ||
| roomCreate, | ||
| roomList, | ||
| roomRecord, | ||
| roomAdmin, | ||
| ingressAdmin, | ||
| canPublish, | ||
| canSubscribe, | ||
| canPublishData, | ||
| canUpdateOwnMetadata, | ||
| hidden, | ||
| recorder, | ||
| agent, | ||
| canSubscribeMetrics, | ||
| destinationRoom, | ||
| }, | ||
| }); | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| $.export("$summary", "Successfully generated access token for participant to join the call."); | ||
|
|
||
| return response; | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
components/livekit/actions/remove-participants/remove-participants.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import app from "../../livekit.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "livekit-remove-participants", | ||
| name: "Remove Participants", | ||
| description: "Remove specific participants from a LiveKit room. [See the documentation](https://github.com/livekit/node-sdks/tree/main/packages/livekit-server-sdk).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| room: { | ||
| propDefinition: [ | ||
| app, | ||
| "room", | ||
| ], | ||
| }, | ||
| identities: { | ||
| type: "string[]", | ||
| label: "Participant Identities", | ||
| description: "Identities of participants to remove from the room", | ||
| propDefinition: [ | ||
| app, | ||
| "identity", | ||
| ({ room }) => ({ | ||
| room, | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| room, | ||
| identities, | ||
| } = this; | ||
|
|
||
| const results = await Promise.all( | ||
| identities.map(async (identity) => { | ||
| await app.removeParticipant(room, identity); | ||
| return identity; | ||
| }), | ||
| ); | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| $.export("$summary", `Successfully removed \`${identities.length}\` participant(s) from room: \`${room}\``); | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| return { | ||
| room, | ||
| removedParticipants: results, | ||
| }; | ||
| }, | ||
| }; | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.