Skip to content

🎥 Make videos programmatically with React

update docs and set default docu

Alex Fernandeze83f5b59c226
diff --git a/packages/docs/docs/lambda/go.md b/packages/docs/docs/lambda/go.md
index bf22183b37..05c1f7b884 100644
--- a/packages/docs/docs/lambda/go.md
+++ b/packages/docs/docs/lambda/go.md
@@ -1,6 +1,6 @@
---
title: Triggering renders from Go
-slug: /lambda/php
+slug: /lambda/go
sidebar_label: Rendering from Go
crumb: "@remotion/lambda"
---
@@ -50,26 +50,23 @@ func main() {
log.Fatal(err)
}
- serveUrl := os.Getenv("REMOTION_APP_SERVER_URL")
+ // Specify the URL to your Webpack bundle
+ serveUrl := os.Getenv("REMOTION_APP_SERVE_URL")
+ // Specify the function you would like to call
functionName := os.Getenv("REMOTION_APP_FUNCTION_NAME")
+ // Specify the region you deployed to, for example "us-east-1"
region := os.Getenv("REMOTION_APP_REGION")
input := goclient.RemotionOptions{
ServeUrl: serveUrl,
FunctionName: functionName,
Region: region,
+ // The data that composition will use
InputProps: map[string]interface{}{
"data": "Let's play",
},
- Composition: "main",
- Type: "start",
- Codec: "h264",
- Version: "3.3.78",
- ImageFormat: "jpeg",
- Crf: 1,
- Privacy: "public",
- LogLevel: "info",
- Scale: 1,
+ Composition: "main", // The composition to use
+ Version: "3.3.78", // Specify the Remotion version to use
}
response, error := goclient.RenderMediaOnLambda(input)
@@ -112,6 +109,7 @@ func main() {
}
+
```
## Reference applications
diff --git a/packages/goclient-example/main.go b/packages/goclient-example/main.go
index c6b2b75e84..7b07bbc514 100644
--- a/packages/goclient-example/main.go
+++ b/packages/goclient-example/main.go
@@ -32,26 +32,23 @@ func main() {
log.Fatal(err)
}
- serveUrl := os.Getenv("REMOTION_APP_SERVER_URL")
+ // Specify the URL to your Webpack bundle
+ serveUrl := os.Getenv("REMOTION_APP_SERVE_URL")
+ // Specify the function you would like to call
functionName := os.Getenv("REMOTION_APP_FUNCTION_NAME")
+ // Specify the region you deployed to, for example "us-east-1"
region := os.Getenv("REMOTION_APP_REGION")
input := goclient.RemotionOptions{
ServeUrl: serveUrl,
FunctionName: functionName,
Region: region,
+ // The data that composition will use
InputProps: map[string]interface{}{
"data": "Let's play",
},
- Composition: "main",
- Type: "start",
- Codec: "h264",
- Version: "3.3.78",
- ImageFormat: "jpeg",
- Crf: 1,
- Privacy: "public",
- LogLevel: "info",
- Scale: 1,
+ Composition: "main", // The composition to use
+ Version: "3.3.78", // Specify the Remotion version to use
}
response, error := goclient.RenderMediaOnLambda(input)
diff --git a/packages/goclient/internalops.go b/packages/goclient/internalops.go
index 35c15039d4..722182536e 100644
--- a/packages/goclient/internalops.go
+++ b/packages/goclient/internalops.go
@@ -14,7 +14,6 @@ func constructInternals(options RemotionOptions) (*internalOptions, error) {
log.Fatal("Error in serializing input props", serializeError)
}
validate := validator.New()
- validate.RegisterValidation("privacyTypeValidator", privacyTypeValidator)
validationErrors := validate.Struct(options)
if validationErrors != nil {
@@ -26,12 +25,8 @@ func constructInternals(options RemotionOptions) (*internalOptions, error) {
InputProps: inputProps,
Composition: options.Composition,
Region: options.Region,
- Type: options.Type,
+ Type: "start",
Version: options.Version,
- ImageFormat: options.ImageFormat,
- Crf: options.Crf,
- EnvVariables: options.EnvVariables,
- Privacy: options.Privacy,
LogLevel: options.LogLevel,
FrameRange: options.FrameRange,
OutName: options.OutName,
@@ -49,8 +44,24 @@ func constructInternals(options RemotionOptions) (*internalOptions, error) {
/*
Default values
+ TODO: Validation for values
*/
+ if &options.Codec == nil {
+ internalParams.Codec = "h264"
+ }
+ if &options.ImageFormat == nil {
+ internalParams.ImageFormat = "jpeg"
+ }
+ if &options.Crf == nil {
+ internalParams.Crf = 1
+ }
+ if &options.Privacy == nil {
+ internalParams.Privacy = "public"
+ }
+ if &options.Privacy == nil {
+ internalParams.LogLevel = "info"
+ }
if &options.Scale == nil {
internalParams.Scale = 1
}
diff --git a/packages/goclient/models.go b/packages/goclient/models.go
index 02ac531bda..600fe8a176 100644
--- a/packages/goclient/models.go
+++ b/packages/goclient/models.go
@@ -1,25 +1,11 @@
package goclient
-type PrivacyType string
-
-const (
- Public PrivacyType = "public"
- Private PrivacyType = "private"
- NoACL PrivacyType = "no-acl"
-)
-
-/*
-*
-
- TODO Validation rules
-*/
type RemotionOptions struct {
ServeUrl string `json:"serveUrl" validate:"required"`
FunctionName string `json:"functionName" validate:"required"`
Region string `json:"region" validate:"required"`
InputProps interface{} `json:"inputProps"`
Composition string `json:"composition" validate:"required"`
- Type string `json:"type" validate:"required"`
Codec string `json:"codec"`
Version string `json:"version"`
ImageFormat string `json:"imageFormat"`
@@ -27,7 +13,7 @@ type RemotionOptions struct {
EnvVariables []interface{} `json:"envVariables"`
Quality int `json:"quality"`
MaxRetries int `json:"maxRetries"`
- Privacy PrivacyType `json:"privacy" validate:"required,privacyTypeValidator"`
+ Privacy string `json:"privacy"`
LogLevel string `json:"logLevel"`
FrameRange interface{} `json:"frameRange"`
OutName interface{} `json:"outName"`
@@ -64,7 +50,7 @@ type internalOptions struct {
EnvVariables []interface{}
Quality int
MaxRetries int `json:"maxRetries"`
- Privacy PrivacyType `json:"privacy"`
+ Privacy string `json:"privacy"`
LogLevel string `json:"logLevel"`
FrameRange interface{} `json:"frameRange"`
OutName interface{} `json:"outName"`
diff --git a/packages/goclient/validation.go b/packages/goclient/validation.go
index 1f279d1baa..e4ea83bf51 100644
--- a/packages/goclient/validation.go
+++ b/packages/goclient/validation.go
@@ -13,14 +13,3 @@ func qualityRange(fl validator.FieldLevel) bool {
}
return quality >= 1 && quality <= 100
}
-
-func privacyTypeValidator(fl validator.FieldLevel) bool {
- value, ok := fl.Field().Interface().(PrivacyType)
- if ok {
- switch value {
- case Public, Private, NoACL:
- return true
- }
- }
- return false
-}