diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..04ee5f3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +vendor/ +.phpunit.result.cache +.idea/ diff --git a/composer.json b/composer.json index 700ea1d..23ca166 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,8 @@ "license": "proprietary", "autoload": { "psr-4": { - "Remotion\\LambdaPhp\\": "src/" + "Remotion\\LambdaPhp\\": "src/", + "Remotion\\LambdaPhp\\Tests\\": "tests/" } }, "require": { @@ -14,5 +15,8 @@ }, "require-dev": { "phpunit/phpunit": "^10.1" + }, + "scripts": { + "test": "phpunit tests" } } diff --git a/src/GetRenderProgressResponse.php b/src/GetRenderProgressResponse.php index 94e74bc..4dab3d0 100644 --- a/src/GetRenderProgressResponse.php +++ b/src/GetRenderProgressResponse.php @@ -4,7 +4,7 @@ class GetRenderProgressResponse { - public int $chunks; + public ?int $chunks; public bool $done; public float $overallProgress; public string $type; diff --git a/src/PHPClient.php b/src/PHPClient.php index 15c4fb3..09ff2a8 100644 --- a/src/PHPClient.php +++ b/src/PHPClient.php @@ -1,20 +1,16 @@ $renderId, 'bucketName' => $bucketName, 'type' => 'status', - "version" => VERSION, + "version" => Semantic::VERSION, "s3OutputProvider" => null, "logLevel" => $logLevel , ); diff --git a/src/RenderMediaOnLambdaResponse.php b/src/RenderMediaOnLambdaResponse.php new file mode 100644 index 0000000..dbfb6d9 --- /dev/null +++ b/src/RenderMediaOnLambdaResponse.php @@ -0,0 +1,10 @@ + 'play-in-browser', ]; - private $muted = false; - private $preferLossless = false; - private $overwrite = false; - private $audioBitrate = null; - private $videoBitrate = null; - private $encodingBufferSize = null; - private $maxRate = null; - private $webhook = null; - private $forceHeight = null; - private $forceWidth = null; - private $offthreadVideoCacheSizeInBytes = null; - private $audioCodec = null; - private $rendererFunctionName = null; - private $proResProfile = null; - private $pixelFormat = null; - private $x264Preset = null; - private $deleteAfter = null; - + protected $muted = false; + protected $preferLossless = false; + protected $overwrite = false; + protected $audioBitrate = null; + protected $videoBitrate = null; + protected $encodingBufferSize = null; + protected $maxRate = null; + protected $webhook = null; + protected $forceHeight = null; + protected $forceWidth = null; + protected $offthreadVideoCacheSizeInBytes = null; + protected $audioCodec = null; + protected $rendererFunctionName = null; + protected $proResProfile = null; + protected $pixelFormat = null; + protected $x264Preset = null; + protected $deleteAfter = null; + public function __construct( - ?array $data = null, + ?array $data = null, ?string $composition = 'main', - string $codec = 'h264', + string $codec = 'h264', ?string $version = null, - string $imageFormat = 'jpeg', - ?int $crf = null, - ?array $envVariables = null, - int $maxRetries = 1, - int $jpegQuality = 80, - string $privacy = 'public', - string $colorSpace = 'default', - string $logLevel = 'info', + string $imageFormat = 'jpeg', + ?int $crf = null, + ?array $envVariables = null, + int $maxRetries = 1, + int $jpegQuality = 80, + string $privacy = 'public', + string $colorSpace = 'default', + string $logLevel = 'info', ?string $frameRange = null, ?string $outName = null, - ?int $timeoutInMilliseconds = 30000, - ?object $chromiumOptions = null, - ?int $scale = 1, - ?int $everyNthFrame = 1, - ?int $numberOfGifLoops = 0, - ?int $concurrencyPerLambda = 1, - ?array $downloadBehavior = null, - ?bool $muted = false, - ?bool $overwrite = false, - ?int $audioBitrate = null, - ?int $videoBitrate = null, - ?string $webhook = null, - ?int $forceHeight = null, - ?int $forceWidth = null, - ?int $offthreadVideoCacheSizeInBytes = null, - ?string $audioCodec = null, - ?int $framesPerLambda = null, - ?string $rendererFunctionName = null, - ?string $proResProfile = null, + ?int $timeoutInMilliseconds = 30000, + ?object $chromiumOptions = null, + ?int $scale = 1, + ?int $everyNthFrame = 1, + ?int $numberOfGifLoops = 0, + ?int $concurrencyPerLambda = 1, + ?array $downloadBehavior = null, + ?bool $muted = false, + ?bool $overwrite = false, + ?int $audioBitrate = null, + ?int $videoBitrate = null, + ?string $webhook = null, + ?int $forceHeight = null, + ?int $forceWidth = null, + ?int $offthreadVideoCacheSizeInBytes = null, + ?string $audioCodec = null, + ?int $framesPerLambda = null, + ?string $rendererFunctionName = null, + ?string $proResProfile = null, ?string $pixelFormat = null, ?string $x264Preset = null, ?string $deleteAfter = null, ?string $encodingBufferSize = null, ?string $maxRate = null, - ?bool $preferLossless = false - ) + ?bool $preferLossless = false + ) { if ($chromiumOptions === null) { $this->chromiumOptions = new stdClass(); @@ -150,6 +140,7 @@ public function __construct( } private array $inputProps = array(); + public function serializeParams() { $parameters = [ @@ -176,7 +167,7 @@ public function serializeParams() 'downloadBehavior' => $this->getDownloadBehavior(), 'muted' => $this->getMuted(), 'preferLossless' => $this->getPreferLossless(), - 'version' => VERSION, + 'version' => Semantic::VERSION, 'overwrite' => $this->getOverwrite(), 'audioBitrate' => $this->getAudioBitrate(), 'videoBitrate' => $this->getVideoBitrate(), @@ -451,7 +442,7 @@ public function setMaxRetries($maxRetries) return $this; } - /** + /** * Get the value of jpegQuality */ public function getJpegQuality() @@ -491,7 +482,7 @@ public function setPrivacy($privacy) return $this; } - /** + /** * Get the value of colorspace */ public function getColorSpace() @@ -530,6 +521,7 @@ public function setLogLevel($logLevel) return $this; } + // Setter methods public function setFrameRange($frameRange) { @@ -627,6 +619,7 @@ public function setMuted($muted) { $this->muted = $muted; } + // Setter methods public function setPreferLossless($preferLossless) { @@ -718,6 +711,7 @@ public function getForceWidth() { return $this->forceWidth; } + public function getOffthreadVideoCacheSizeInBytes() { return $this->offthreadVideoCacheSizeInBytes; @@ -850,8 +844,8 @@ public function getX264Preset() public function setX264Preset($x264Preset) { - $this->x264Preset = $x264Preset; - return $this; + $this->x264Preset = $x264Preset; + return $this; } public function getDeleteAfter() @@ -861,7 +855,7 @@ public function getDeleteAfter() public function setDeleteAfter($deleteAfter) { - $this->$deleteAfter = $deleteAfter; - return $this; + $this->deleteAfter = $deleteAfter; + return $this; } } diff --git a/src/Semantic.php b/src/Semantic.php new file mode 100644 index 0000000..701e8bc --- /dev/null +++ b/src/Semantic.php @@ -0,0 +1,8 @@ +