🎥 Make videos programmatically with React
align the gopackage request with native typescript values
Alex Fernandezb4d2fe08bfd2
diff --git a/packages/compositor-darwin-arm64/compositor b/packages/compositor-darwin-arm64/compositorindex 6dce8d0b34..cfd91e3c59 100755Binary files a/packages/compositor-darwin-arm64/compositor and b/packages/compositor-darwin-arm64/compositor differdiff --git a/packages/goclient-example/main.go b/packages/goclient-example/main.goold mode 100644new mode 100755diff --git a/packages/goclient/internalops.go b/packages/goclient/internalops.goindex 59434e564b..fffe2ecfd3 100644--- a/packages/goclient/internalops.go+++ b/packages/goclient/internalops.go@@ -21,26 +21,29 @@ func constructRenderInternals(options *RemotionOptions) (*renderInternalOptions,}internalParams := renderInternalOptions{- ServeUrl: options.ServeUrl,- InputProps: inputProps,- Composition: options.Composition,- Region: options.Region,- Type: "start",- Version: VERSION,- FrameRange: options.FrameRange,- OutName: options.OutName,- AudioBitrate: options.AudioBitrate,- VideoBitrate: options.VideoBitrate,- Webhook: options.Webhook,- ForceHeight: options.ForceHeight,- ForceWidth: options.ForceWidth,- BucketName: options.BucketName,- AudioCodec: options.AudioCodec,- ForceBucketName: options.ForceBucketName,+ ServeUrl: options.ServeUrl,+ InputProps: inputProps,+ Composition: options.Composition,+ Version: VERSION,+ FrameRange: options.FrameRange,+ OutName: options.OutName,+ AudioBitrate: options.AudioBitrate,+ VideoBitrate: options.VideoBitrate,+ Webhook: options.Webhook,+ ForceHeight: options.ForceHeight,+ ForceWidth: options.ForceWidth,+ BucketName: options.BucketName,+ AudioCodec: options.AudioCodec,+ ForceBucketName: options.ForceBucketName,+ RendererFunctionName: &options.RendererFunctionName,}internalParams.Muted = options.MutedinternalParams.Overwrite = options.Overwrite++ if options.RendererFunctionName == "" {+ internalParams.RendererFunctionName = nil+ }if options.Codec == "" {internalParams.Codec = "h264"} else {@@ -57,11 +60,7 @@ func constructRenderInternals(options *RemotionOptions) (*renderInternalOptions,} else {internalParams.ImageFormat = options.ImageFormat}- if options.Crf == 0 {- internalParams.Crf = 1- } else {- internalParams.Crf = options.Crf- }+ internalParams.Crf = options.Crfif options.Privacy == "" {internalParams.Privacy = "public"} else {@@ -79,12 +78,6 @@ func constructRenderInternals(options *RemotionOptions) (*renderInternalOptions,internalParams.Scale = options.Scale}- if options.Crf == 0 {- internalParams.Crf = 1- } else {- internalParams.Crf = options.Crf- }-if options.Codec == "" {internalParams.Codec = "h264"} else {@@ -92,17 +85,11 @@ func constructRenderInternals(options *RemotionOptions) (*renderInternalOptions,}if options.MaxRetries == 0 {- internalParams.MaxRetries = 3+ internalParams.MaxRetries = 1} else {internalParams.MaxRetries = options.MaxRetries}- if options.Quality == 0 {- internalParams.Quality = 80- } else {- internalParams.Quality = options.Quality- }-if options.Scale == 0 {internalParams.Scale = 1} else {@@ -122,12 +109,6 @@ func constructRenderInternals(options *RemotionOptions) (*renderInternalOptions,}internalParams.NumberOfGifLoops = options.NumberOfGifLoops- if options.Gl == "" {- internalParams.Gl = "swangle"- } else {- internalParams.Gl = options.Gl- }-if options.DownloadBehavior == nil {internalParams.DownloadBehavior = map[string]interface{}{"type": "play-in-browser",@@ -136,16 +117,11 @@ func constructRenderInternals(options *RemotionOptions) (*renderInternalOptions,internalParams.DownloadBehavior = options.DownloadBehavior}if options.ChromiumOptions == nil {- internalParams.ChromiumOptions = []interface{}{}+ internalParams.ChromiumOptions = map[string]interface{}{}} else {internalParams.ChromiumOptions = options.ChromiumOptions}-- if options.EnvVariables == nil {- internalParams.EnvVariables = []interface{}{}- } else {- internalParams.EnvVariables = options.EnvVariables- }+ internalParams.EnvVariables = options.EnvVariablesreturn &internalParams, nil}diff --git a/packages/goclient/models.go b/packages/goclient/models.goindex 78c5a6480a..959cf203d3 100644--- a/packages/goclient/models.go+++ b/packages/goclient/models.go@@ -3,14 +3,15 @@ package goclienttype RemotionOptions struct {ServeUrl string `json:"serveUrl" validate:"required"`FunctionName string `json:"functionName" validate:"required"`+ RendererFunctionName string `json:"rendererFunctionName"`Region string `json:"region" validate:"required"`InputProps interface{} `json:"inputProps"`Composition string `json:"composition" validate:"required"`- Codec string `json:"codec" validate:"required"`+ Codec string `json:"codec"`Version string `json:"version"`ImageFormat string `json:"imageFormat"`Crf int `json:"crf"`- EnvVariables []interface{} `json:"envVariables"`+ EnvVariables interface{} `json:"envVariables"`Quality int `json:"quality"`MaxRetries int `json:"maxRetries"`Privacy string `json:"privacy"`@@ -18,7 +19,7 @@ type RemotionOptions struct {FrameRange interface{} `json:"frameRange"`OutName interface{} `json:"outName"`TimeoutInMilliseconds int `json:"timeoutInMilliseconds"`- ChromiumOptions []interface{} `json:"chromiumOptions"`+ ChromiumOptions interface{} `json:"chromiumOptions"`Scale int `json:"scale"`EveryNthFrame int `json:"everyNthFrame"`NumberOfGifLoops int `json:"numberOfGifLoops"`@@ -33,35 +34,37 @@ type RemotionOptions struct {ForceWidth interface{} `json:"forceWidth"`BucketName interface{} `json:"bucketName"`AudioCodec interface{} `json:"audioCodec"`- ForceBucketName *string `json:"forceBucketName"`+ DumpBrowserLogs bool `json:"dumpBrowserLogs"`+ ForceBucketName string `json:"forceBucketName"`Gl string `json:"gl"`}type renderInternalOptions struct {- ServeUrl string `json:"serveUrl" validate:"required"`- Region string `json:"region" validate:"required"`- InputProps interface{} `json:"inputProps"`- Composition string `json:"composition" validate:"required"`- 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+ RendererFunctionName *string `json:"rendererFunctionName"`+ FramesPerLambda *string `json:"framesPerLambda"`+ Composition string `json:"composition" validate:"required"`+ ServeUrl string `json:"serveUrl" validate:"required"`+ InputProps interface{} `json:"inputProps"`+ Type string `json:"type,omitempty"`+ Codec string `json:"codec"`+ ImageFormat string `json:"imageFormat"`+ Crf int `json:"crf,omitempty"`+ EnvVariables interface{} `json:"envVariables,omitempty"`+ Quality int `json:"quality,omitempty"`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"`+ 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"`+ Version string `json:"version"`Overwrite bool `json:"overwrite"`AudioBitrate interface{} `json:"audioBitrate"`VideoBitrate interface{} `json:"videoBitrate"`@@ -70,8 +73,10 @@ type renderInternalOptions struct {ForceWidth interface{} `json:"forceWidth"`BucketName interface{} `json:"bucketName"`AudioCodec interface{} `json:"audioCodec"`- ForceBucketName *string `json:"forceBucketName"`- Gl string `json:"gl"`+ DumpBrowserLogs bool `json:"dumpBrowserLogs"`++ ForceBucketName string `json:"forceBucketName,omitempty"`+ Gl *string `json:"gl,omitempty"`}type RemotionRenderResponse struct {@@ -136,3 +141,8 @@ type FrameRange struct {TimeInMilliseconds int `json:"timeInMilliseconds"`FrameRange [2]int `json:"frameRange"`}++type PayloadData struct {+ Type string `json:"type"`+ Payload string `json:"payload"`+}diff --git a/packages/goclient/utils.go b/packages/goclient/utils.goindex 8805ab7aed..17f6a05d0f 100644--- a/packages/goclient/utils.go+++ b/packages/goclient/utils.go@@ -7,7 +7,7 @@ import ()func serializeInputProps(inputProps interface{}, region string, inputType string,- userSpecifiedBucketName *string) (map[string]interface{}, error) {+ userSpecifiedBucketName string) (*PayloadData, error) {payload, err := json.Marshal(inputProps)if err != nil {return nil, errors.New("error serializing inputProps. Check it has no circular references or reduce the size if the object is big")@@ -24,8 +24,14 @@ func serializeInputProps(inputProps interface{}, region string, inputType stringreturn nil, fmt.Errorf("warning: inputProps are over %dKB (%dKB) in size. This is not currently supported", maxInlinePayloadSize/1000, len(payload)/1024)}- return map[string]interface{}{- "type": "payload",- "payload": string(payload),+ if &payload != nil && &inputProps == nil {+ return &PayloadData{+ Payload: string(payload),+ Type: "payload",+ }, nil+ }+ return &PayloadData{+ Payload: "{}",+ Type: "payload",}, nil}