Skip to content

Commit

Permalink
fix: too few arguments in MediaConvert::createJob() (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
glennmichael123 authored Jul 24, 2021
1 parent 56072ff commit 8bf9aea
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/Converters/MediaConvert.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,12 @@ public function cancelJob(string $id)
* @param int $priority
* @return \Aws\Result
*/
public function createJob(array $settings, array $metaData = [], array $tags = [], int $priority = 0)
public function createJob(array $settings = [], array $metaData = [], array $tags = [], int $priority = 0)
{
if (empty($settings)) {
$settings = $this->jobSettings;
}

return $this->client->createJob([
'Role' => config('media-converter.iam_arn'),
'Settings' => $settings,
Expand Down
1 change: 0 additions & 1 deletion src/Support/DefaultMediaConvertJobSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public static function get(): array
'ColorMetadata' => 'INSERT',
'Width' => null, // to be set dynamically
],
'NameModifier' => null, // to be set dynamically
],
],
'OutputGroupSettings' => [
Expand Down
18 changes: 16 additions & 2 deletions tests/MediaConverterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,23 @@
$this->assertEquals($response['@metadata']['statusCode'], 201);
});

it('can successfully get a job', function () {
it('can successfully create a job chained', function () {
$inputName = 'my-video.mkv';
$outputName = 'my-video.mp4';
$bucket = 'test-bucket';

$response = MediaConvert::path($inputName, 'test-bucket')
->optimizeForWeb()
->withThumbnails(1, 2, 3, 100)
->saveTo($outputName, $bucket)
->createJob();

$this->assertEquals($response['@metadata']['statusCode'], 201);
});

it('can successfully get a jobs', function () {
// just a hardcoded job ID retrieved from one of the AWS MediaConvert jobs
$jobId = '1615614565083-g1cgjm';
$jobId = '1627096589458-nqj4pr';

$response = MediaConvert::getJob($jobId);

Expand Down

0 comments on commit 8bf9aea

Please sign in to comment.