Skip to content

🎥 Make videos programmatically with React

construct parameters

Alex Fernandez9c63fd35524d
diff --git a/packages/goclient/goclient.go b/packages/goclient/goclient.go
index 3b407e419f..df8b17150b 100644
--- a/packages/goclient/goclient.go
+++ b/packages/goclient/goclient.go
@@ -19,13 +19,20 @@ func invokeLambda(options *RemotionOptions) error {
svc := lambda.New(sess)
// Create input for Lambda function
- payload, err := json.Marshal(options)
+ _, err := json.Marshal(options)
if err != nil {
return err
}
+
+ internalParams := constructInternals(options)
+ internalParamByte, err := json.Marshal(internalParams)
+ if err != nil {
+ return err
+ }
+
params := &lambda.InvokeInput{
FunctionName: aws.String(options.FunctionName),
- Payload: payload,
+ Payload: internalParamByte,
}
// Invoke Lambda function
diff --git a/packages/goclient/models.go b/packages/goclient/models.go
index e3a293061e..414a6c1369 100644
--- a/packages/goclient/models.go
+++ b/packages/goclient/models.go
@@ -3,6 +3,7 @@ package goclient
type RemotionOptions struct {
ServeUrl string `json:"serveUrl"`
FunctionName string `json:"functionName"`
+ Region string `json:"region"`
InputProps interface{} `json:"inputProps"`
Composition string `json:"composition"`
Type string `json:"type"`
@@ -36,6 +37,43 @@ type RemotionOptions struct {
ForceBucketName string `json:"forceBucketName"`
}
+type internalOptions struct {
+ ServeUrl string
+ InputProps interface{} `json:"inputProps"`
+ Composition string `json:"composition"`
+ FunctionName string `json:"functionName"`
+ Region string `json:"region"`
+ Type string `json:"type"`
+ Codec string `json:"codec"`
+ Version string `json:"version"`
+ ImageFormat string `json:"imageFormat"`
+ Crf int `json:"crf"`
+ EnvVariables []interface{} `json:"envVariables"`
+ Quality int `json:"quality"`
+ MaxRetries int `json:"maxRetries"`
+ Privacy string `json:"privacy"`
+ LogLevel string `json:"logLevel"`
+ FrameRange interface{} `json:"frameRange"`
+ OutName interface{} `json:"outName"`
+ TimeoutInMilliseconds int `json:"timeoutInMilliseconds"`
+ ChromiumOptions []interface{} `json:"chromiumOptions"`
+ Scale int `json:"scale"`
+ EveryNthFrame int `json:"everyNthFrame"`
+ NumberOfGifLoops int `json:"numberOfGifLoops"`
+ ConcurrencyPerLambda int `json:"concurrencyPerLambda"`
+ DownloadBehavior map[string]interface{} `json:"downloadBehavior"`
+ Muted bool `json:"muted"`
+ Overwrite bool `json:"overwrite"`
+ AudioBitrate interface{} `json:"audioBitrate"`
+ VideoBitrate interface{} `json:"videoBitrate"`
+ Webhook interface{} `json:"webhook"`
+ ForceHeight interface{} `json:"forceHeight"`
+ ForceWidth interface{} `json:"forceWidth"`
+ BucketName interface{} `json:"bucketName"`
+ AudioCodec interface{} `json:"audioCodec"`
+ ForceBucketName string `json:"forceBucketName"`
+}
+
type RemotionRenderResponse struct {
RenderId string `json:"renderId"`
BucketName string `json:"bucketName"`
diff --git a/packages/goclient/utils.go b/packages/goclient/utils.go
index 649b7ca5d5..b9a563ad39 100644
--- a/packages/goclient/utils.go
+++ b/packages/goclient/utils.go
@@ -53,3 +53,14 @@ func randomHash(options ...bool) string {
return string(hash)
}
+
+func constructInternals(options *RemotionOptions) internalOptions {
+
+ internalParams := &internalOptions{
+ ServeUrl: options.ServeUrl,
+ Region: options.Region,
+ Composition: options.Composition,
+ }
+
+ return *internalParams
+}