-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[Components] livekit - new action components #14662
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
87 changes: 87 additions & 0 deletions
87
components/livekit/actions/create-ingress-from-url/create-ingress-from-url.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,87 @@ | ||
| import { IngressInput } from "livekit-server-sdk"; | ||
| import app from "../../livekit.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "livekit-create-ingress-from-url", | ||
| name: "Create Ingress From URL", | ||
| description: "Create a new ingress from url in LiveKit. [See the documentation](https://docs.livekit.io/home/ingress/overview/#url-input-example).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| name: { | ||
| type: "string", | ||
| label: "Ingress Name", | ||
| description: "The name of the ingress", | ||
| optional: true, | ||
| }, | ||
| roomName: { | ||
| description: "The name of the room to send media to", | ||
| propDefinition: [ | ||
| app, | ||
| "room", | ||
| ], | ||
| }, | ||
| participantIdentity: { | ||
| type: "string", | ||
| label: "Participant Identity", | ||
| description: "Unique identity of the participant", | ||
| }, | ||
| participantName: { | ||
| type: "string", | ||
| label: "Participant Name", | ||
| description: "Participant display name", | ||
| optional: true, | ||
| }, | ||
| participantMetadata: { | ||
| type: "string", | ||
| label: "Participant Metadata", | ||
| description: "Metadata to attach to the participant", | ||
| optional: true, | ||
| }, | ||
| bypassTranscoding: { | ||
| type: "boolean", | ||
| label: "Bypass Transcoding", | ||
| description: "Whether to skip transcoding and forward the input media directly. Only supported by WHIP", | ||
| optional: true, | ||
| }, | ||
| enableTranscoding: { | ||
| type: "boolean", | ||
| label: "Enable Transcoding", | ||
| description: "Whether to enable transcoding or forward the input media directly. Transcoding is required for all input types except WHIP. For WHIP, the default is to not transcode.", | ||
| optional: true, | ||
| }, | ||
| url: { | ||
| type: "string", | ||
| label: "URL", | ||
| description: "URL of the media to pull for ingresses of type URL", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| name, | ||
| roomName, | ||
| participantIdentity, | ||
| participantName, | ||
| participantMetadata, | ||
| bypassTranscoding, | ||
| enableTranscoding, | ||
| url, | ||
| } = this; | ||
|
|
||
| const response = await app.createIngress({ | ||
| inputType: IngressInput.URL_INPUT, | ||
| name, | ||
| roomName, | ||
| participantIdentity, | ||
| participantName, | ||
| participantMetadata, | ||
| bypassTranscoding, | ||
| enableTranscoding, | ||
| url, | ||
| }); | ||
| $.export("$summary", `Successfully created ingress with ID \`${response.ingressId}\`.`); | ||
| 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| import app from "../../livekit.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "livekit-create-room", | ||
| name: "Create Room", | ||
| description: "Create a new room in LiveKit. [See the documentation](https://docs.livekit.io/home/server/managing-rooms/#create-a-room).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| name: { | ||
| type: "string", | ||
| label: "Room Name", | ||
| description: "The name of the room", | ||
| }, | ||
| emptyTimeout: { | ||
| type: "integer", | ||
| label: "Empty Timeout", | ||
| description: "Number of seconds to keep the room open before any participant joins", | ||
| optional: true, | ||
| }, | ||
| departureTimeout: { | ||
| type: "integer", | ||
| label: "Departure Timeout", | ||
| description: "Number of seconds to keep the room open after the last participant leaves", | ||
| optional: true, | ||
| }, | ||
| maxParticipants: { | ||
| type: "integer", | ||
| label: "Max Participants", | ||
| description: "Limit to the number of participants in a room at a time", | ||
| optional: true, | ||
| }, | ||
| metadata: { | ||
| type: "string", | ||
| label: "Metadata", | ||
| description: "Initial room metadata", | ||
| optional: true, | ||
| }, | ||
| minPlayoutDelay: { | ||
| type: "integer", | ||
| label: "Min Playout Delay", | ||
| description: "Minimum playout delay in milliseconds", | ||
| optional: true, | ||
| }, | ||
| maxPlayoutDelay: { | ||
| type: "integer", | ||
| label: "Max Playout Delay", | ||
| description: "Maximum playout delay in milliseconds", | ||
| optional: true, | ||
| }, | ||
| syncStreams: { | ||
| type: "boolean", | ||
| label: "Sync Streams", | ||
| description: "Improves A/V sync when min_playout_delay set to a value larger than 200ms. It will disables transceiver re-use -- this option is not recommended for rooms with frequent subscription changes", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| name, | ||
| emptyTimeout, | ||
| departureTimeout, | ||
| maxParticipants, | ||
| metadata, | ||
| minPlayoutDelay, | ||
| maxPlayoutDelay, | ||
| syncStreams, | ||
| } = this; | ||
|
|
||
| const response = await app.createRoom({ | ||
| name, | ||
| emptyTimeout, | ||
| departureTimeout, | ||
| maxParticipants, | ||
| metadata, | ||
| minPlayoutDelay, | ||
| maxPlayoutDelay, | ||
| syncStreams, | ||
| }); | ||
| $.export("$summary", `Successfully created room with SID \`${response.sid}\`.`); | ||
| 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import app from "../../livekit.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "livekit-delete-room", | ||
| name: "Delete Room", | ||
| description: "Delete a room in LiveKit. [See the documentation](https://docs.livekit.io/home/server/managing-rooms/#delete-a-room)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| room: { | ||
| propDefinition: [ | ||
| app, | ||
| "room", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| room, | ||
| } = this; | ||
|
|
||
| await app.deleteRoom(room); | ||
|
|
||
| $.export("$summary", "Successfully deleted room."); | ||
|
|
||
| return { | ||
| success: true, | ||
| }; | ||
| }, | ||
| }; | ||
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,17 @@ | ||
| import app from "../../livekit.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "livekit-list-rooms", | ||
| name: "List Rooms", | ||
| description: "List all rooms with LiveKit. [See the documentation](https://docs.livekit.io/home/server/managing-rooms/#list-rooms).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| }, | ||
| async run({ $ }) { | ||
| const rooms = await this.app.listRooms(); | ||
| $.export("$summary", `Successfully listed \`${rooms.length}\` room(s).`); | ||
| return rooms; | ||
| }, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
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,7 @@ | ||
| const HTTPS_PREFIX = "https://"; | ||
| const HTTP_PREFIX = "http://"; | ||
|
|
||
| export default { | ||
| HTTPS_PREFIX, | ||
| HTTP_PREFIX, | ||
| }; |
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 |
|---|---|---|
| @@ -1,11 +1,62 @@ | ||
| import { | ||
| RoomServiceClient, | ||
| IngressClient, | ||
| } from "livekit-server-sdk"; | ||
| import constants from "./common/constants.mjs"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "livekit", | ||
| propDefinitions: {}, | ||
| propDefinitions: { | ||
| room: { | ||
| type: "string", | ||
| label: "Room Name", | ||
| description: "The name of the room", | ||
| async options() { | ||
| const rooms = await this.listRooms(); | ||
| return rooms.map(({ name }) => name); | ||
| }, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| getHost() { | ||
| const { project_url: projectUrl } = this.$auth; | ||
|
|
||
| return projectUrl.startsWith(constants.HTTPS_PREFIX) | ||
| ? projectUrl | ||
| : projectUrl.startsWith(constants.HTTP_PREFIX) | ||
| ? projectUrl.replace(constants.HTTP_PREFIX, constants.HTTPS_PREFIX) | ||
| : `${constants.HTTPS_PREFIX}${projectUrl}`; | ||
| }, | ||
| getKeys() { | ||
| const { | ||
| api_key: apiKey, | ||
| secret_key: secretKey, | ||
| } = this.$auth; | ||
| return [ | ||
| apiKey, | ||
| secretKey, | ||
| ]; | ||
| }, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| getRoomClient() { | ||
| return new RoomServiceClient(this.getHost(), ...this.getKeys()); | ||
| }, | ||
| getIngressClient() { | ||
| return new IngressClient(this.getHost(), ...this.getKeys()); | ||
| }, | ||
| createRoom(args) { | ||
| return this.getRoomClient().createRoom(args); | ||
| }, | ||
| listRooms(names) { | ||
| return this.getRoomClient().listRooms(names); | ||
| }, | ||
| deleteRoom(room) { | ||
| return this.getRoomClient().deleteRoom(room); | ||
| }, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| createIngress({ | ||
| inputType, ...args | ||
| } = {}) { | ||
| return this.getIngressClient().createIngress(inputType, args); | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
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 |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "@pipedream/livekit", | ||
| "version": "0.0.1", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream LiveKit Components", | ||
| "main": "livekit.app.mjs", | ||
| "keywords": [ | ||
|
|
@@ -11,5 +11,8 @@ | |
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "livekit-server-sdk": "^2.8.1" | ||
| } | ||
| } | ||
| } | ||
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.