| 
 | 1 | +import { IngressInput } from "livekit-server-sdk";  | 
 | 2 | +import app from "../../livekit.app.mjs";  | 
 | 3 | + | 
 | 4 | +export default {  | 
 | 5 | +  key: "livekit-create-ingress-from-url",  | 
 | 6 | +  name: "Create Ingress From URL",  | 
 | 7 | +  description: "Create a new ingress from url in LiveKit. [See the documentation](https://docs.livekit.io/home/ingress/overview/#url-input-example).",  | 
 | 8 | +  version: "0.0.1",  | 
 | 9 | +  type: "action",  | 
 | 10 | +  props: {  | 
 | 11 | +    app,  | 
 | 12 | +    name: {  | 
 | 13 | +      type: "string",  | 
 | 14 | +      label: "Ingress Name",  | 
 | 15 | +      description: "The name of the ingress",  | 
 | 16 | +      optional: true,  | 
 | 17 | +    },  | 
 | 18 | +    roomName: {  | 
 | 19 | +      description: "The name of the room to send media to",  | 
 | 20 | +      propDefinition: [  | 
 | 21 | +        app,  | 
 | 22 | +        "room",  | 
 | 23 | +      ],  | 
 | 24 | +    },  | 
 | 25 | +    participantIdentity: {  | 
 | 26 | +      type: "string",  | 
 | 27 | +      label: "Participant Identity",  | 
 | 28 | +      description: "Unique identity of the participant",  | 
 | 29 | +    },  | 
 | 30 | +    participantName: {  | 
 | 31 | +      type: "string",  | 
 | 32 | +      label: "Participant Name",  | 
 | 33 | +      description: "Participant display name",  | 
 | 34 | +      optional: true,  | 
 | 35 | +    },  | 
 | 36 | +    participantMetadata: {  | 
 | 37 | +      type: "string",  | 
 | 38 | +      label: "Participant Metadata",  | 
 | 39 | +      description: "Metadata to attach to the participant",  | 
 | 40 | +      optional: true,  | 
 | 41 | +    },  | 
 | 42 | +    bypassTranscoding: {  | 
 | 43 | +      type: "boolean",  | 
 | 44 | +      label: "Bypass Transcoding",  | 
 | 45 | +      description: "Whether to skip transcoding and forward the input media directly. Only supported by WHIP",  | 
 | 46 | +      optional: true,  | 
 | 47 | +    },  | 
 | 48 | +    enableTranscoding: {  | 
 | 49 | +      type: "boolean",  | 
 | 50 | +      label: "Enable Transcoding",  | 
 | 51 | +      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.",  | 
 | 52 | +      optional: true,  | 
 | 53 | +    },  | 
 | 54 | +    url: {  | 
 | 55 | +      type: "string",  | 
 | 56 | +      label: "URL",  | 
 | 57 | +      description: "URL of the media to pull for ingresses of type URL",  | 
 | 58 | +    },  | 
 | 59 | +  },  | 
 | 60 | +  async run({ $ }) {  | 
 | 61 | +    const {  | 
 | 62 | +      app,  | 
 | 63 | +      name,  | 
 | 64 | +      roomName,  | 
 | 65 | +      participantIdentity,  | 
 | 66 | +      participantName,  | 
 | 67 | +      participantMetadata,  | 
 | 68 | +      bypassTranscoding,  | 
 | 69 | +      enableTranscoding,  | 
 | 70 | +      url,  | 
 | 71 | +    } = this;  | 
 | 72 | + | 
 | 73 | +    const response = await app.createIngress({  | 
 | 74 | +      inputType: IngressInput.URL_INPUT,  | 
 | 75 | +      name,  | 
 | 76 | +      roomName,  | 
 | 77 | +      participantIdentity,  | 
 | 78 | +      participantName,  | 
 | 79 | +      participantMetadata,  | 
 | 80 | +      bypassTranscoding,  | 
 | 81 | +      enableTranscoding,  | 
 | 82 | +      url,  | 
 | 83 | +    });  | 
 | 84 | +    $.export("$summary", `Successfully created ingress with ID \`${response.ingressId}\`.`);  | 
 | 85 | +    return response;  | 
 | 86 | +  },  | 
 | 87 | +};  | 
0 commit comments