Skip to content

🎥 Make videos programmatically with React

initial go client

Alex Fernandezc3ffda52e2f9
diff --git a/packages/goclient-example/go.mod b/packages/goclient-example/go.mod
new file mode 100644
index 0000000000..a24047fe33
--- /dev/null
+++ b/packages/goclient-example/go.mod
@@ -0,0 +1,3 @@
+module goclient-example
+
+go 1.20
diff --git a/packages/goclient-example/main.go b/packages/goclient-example/main.go
new file mode 100644
index 0000000000..b069f51e64
--- /dev/null
+++ b/packages/goclient-example/main.go
@@ -0,0 +1,15 @@
+package main
+
+import (
+ "github.com/remotion-dev/remotion/packages/goclient"
+)
+
+func main() {
+ input := &goclient.RemotionOptions{
+ // Set the input parameters here
+ }
+ err := goclient.Render(input)
+ if err != nil {
+ // Handle the error here
+ }
+}
diff --git a/packages/goclient/go.mod b/packages/goclient/go.mod
index 1dbec954cb..990e391643 100644
--- a/packages/goclient/go.mod
+++ b/packages/goclient/go.mod
@@ -1,4 +1,4 @@
-module github.com/remotion-dev/remotion/packages/go-client
+module github.com/remotion-dev/remotion/packages/goclient
go 1.19
diff --git a/packages/goclient/utils.go b/packages/goclient/utils.go
index b9a563ad39..f6ec204c56 100644
--- a/packages/goclient/utils.go
+++ b/packages/goclient/utils.go
@@ -4,11 +4,13 @@ import (
"encoding/json"
"errors"
"fmt"
+ "log"
"math/rand"
"time"
)
-func serializeInputProps(inputProps interface{}, region string, inputType string, userSpecifiedBucketName *string) (map[string]interface{}, error) {
+func serializeInputProps(inputProps interface{}, region string, inputType string,
+ userSpecifiedBucketName string) (map[string]interface{}, 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.")
@@ -56,10 +58,17 @@ func randomHash(options ...bool) string {
func constructInternals(options *RemotionOptions) internalOptions {
+ inputProps, err := serializeInputProps(options.InputProps, options.Region, options.Type, options.ForceBucketName)
+
+ if err != nil {
+ log.Fatal("Failed to open file:", err)
+ }
+
internalParams := &internalOptions{
ServeUrl: options.ServeUrl,
Region: options.Region,
Composition: options.Composition,
+ InputProps: inputProps,
}
return *internalParams