🎥 Make videos programmatically with React
add test invoke
Alex Fernandez0b23f08c45a0
diff --git a/packages/lambda-php-example/src/.env.example b/packages/lambda-php-example/src/.env.exampleindex af39db448e..9f9476e39d 100644--- a/packages/lambda-php-example/src/.env.example+++ b/packages/lambda-php-example/src/.env.example@@ -1,6 +1,5 @@REMOTION_APP_IS_ASSUME_ROLE="false"REMOTION_APP_REGION="ap-southeast-2"-REMOTION_APP_BUCKET="remotionlambda-"REMOTION_APP_FUNCTION_NAME="remotion-render-3-3-78-"REMOTION_APP_SERVE_URL="https://remotionlambda-apsoutheast2-XXXXXX.s3.ap-southeast-2.amazonaws.com/sites/remotion-render-app-3.3.78/index.html"REMOTION_APP_ROLE_ARN="arn:aws:iam::123456789012:role/xaccounts3access"diff --git a/packages/lambda-php-example/src/render.php b/packages/lambda-php-example/src/render.phpindex e8cc2d2d41..38be8ec5d3 100644--- a/packages/lambda-php-example/src/render.php+++ b/packages/lambda-php-example/src/render.php@@ -3,14 +3,22 @@ require_once dirname(__DIR__) . '/vendor/autoload.php';use Remotion\LambdaPhp\PHPClient;use Remotion\LambdaPhp\RenderParams;++$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);+$dotenv->load();++$region = $_ENV['REMOTION_APP_REGION'];+$functionName = $_ENV['REMOTION_APP_FUNCTION_NAME'];+$serveUrl = $_ENV["REMOTION_APP_SERVE_URL"];+$client = new PHPClient(- "us-east-1",- "testbed",- "remotion-render",+ $region,+ $serveUrl,+ $functionName,null);$params = new RenderParams();$params->setComposition("react-svg");-$internalParams = $client->constructInternals($params);+$renderResponse = $client->render($params);-print($internalParams);+//print($renderResponse);diff --git a/packages/lambda-php/src/Exceptions.php b/packages/lambda-php/src/Exceptions.phpindex 2f056f4c6d..79d377cce1 100644--- a/packages/lambda-php/src/Exceptions.php+++ b/packages/lambda-php/src/Exceptions.php@@ -2,5 +2,7 @@namespace Remotion\LambdaPhp;+use Exception;+class ValidationException extends Exception{}diff --git a/packages/lambda-php/src/PHPClient.php b/packages/lambda-php/src/PHPClient.phpindex 618760e2df..1a90e18323 100644--- a/packages/lambda-php/src/PHPClient.php+++ b/packages/lambda-php/src/PHPClient.php@@ -4,6 +4,7 @@ namespace Remotion\LambdaPhp;require_once dirname(__DIR__) . '/vendor/autoload.php';use Aws\Lambda\LambdaClient;+use Exception;use stdClass;class PHPClient@@ -44,23 +45,25 @@ class PHPClient$render->setInputProps($input);$render->setServerUrl($this->getServeUrl());$render->setRegion($this->getRegion());- return json_encode($render->serializeParams());+ return ($render->serializeParams());}public function render(RenderParams $render) : ? string{$params = $this->constructInternals($render);+ $params['type'] = 'start';$result = $this->client->invoke(['InvocationType' => 'RequestResponse',- 'FunctionName' => $functionName,+ 'FunctionName' => $this->getFunctionName(),'Payload' => json_encode($params),]);// Check if the invocation was successful- if ($result->getStatusCode() == 200) {+ if ($result['StatusCode'] == 200) {// Get the response from the invocation- $response = json_decode($result->get('Payload'));+ $response = ($result['Payload']->getContents());+if (isset($response->errorMessage)) {// The Lambda function encountered an errorthrow new Exception($response->errorMessage);diff --git a/packages/lambda-php/src/RenderParams.php b/packages/lambda-php/src/RenderParams.phpindex 8d1a0bd447..c45e8607f5 100644--- a/packages/lambda-php/src/RenderParams.php+++ b/packages/lambda-php/src/RenderParams.php@@ -12,7 +12,7 @@ class RenderParamsprivate $bucketName = null;private $region = null;private $outName = null;- private $composition = 'main';+ private $composition = null;private $serverUrl = null;private $framesPerLambda = null;@@ -114,7 +114,7 @@ class RenderParams$this->forceWidth = $forceWidth;$this->audioCodec = $audioCodec;$this->dumpBrowserLogs = $dumpBrowserLogs;- $this->setOutName($outName);+ $this->outName = $outName;$this->proResProfile = $proResProfile;$this->pixelFormat = $pixelFormat;}