also looking at this
meemalabs/laravel-media-converter
feat: add support for tagging
#17
4 files
+20
-5
| @@ -13,19 +13,32 @@ class CreateVideoConversion implements ShouldQueue | ||
| 13 | 13 | { |
| 14 | 14 | use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; |
| 15 | 15 | |
| 16 | /** | |
| 17 | * @var array | |
| 18 | */ | |
| 16 | 19 | private array $jobSettings; |
| 17 | 20 | |
| 21 | /** | |
| 22 | * @var int | |
| 23 | */ | |
| 18 | 24 | private int $mediaId; |
| 19 | 25 | |
| 26 | /** | |
| 27 | * @var array | |
| 28 | */ | |
| 29 | private array $tags; | |
| 30 | ||
| 20 | 31 | /** |
| 21 | 32 | * Create a new job instance. |
| 22 | 33 | * |
| 23 | 34 | * @param $jobSettings |
| 35 | * @param $tags | |
| 24 | 36 | * @param $mediaId |
| 25 | 37 | */ |
| 26 | public function __construct($jobSettings, $mediaId = null) | |
| 38 | public function __construct($jobSettings, $tags, $mediaId = null) | |
| 27 | 39 | { |
| 28 | 40 | $this->jobSettings = $jobSettings; |
| 41 | $this->tags = $tags; | |
| 29 | 42 | |
| 30 | 43 | if ($mediaId) { |
| 31 | 44 | $this->mediaId = $mediaId; |
| @@ -40,11 +53,12 @@ class CreateVideoConversion implements ShouldQueue | ||
| 40 | 53 | public function handle() |
| 41 | 54 | { |
| 42 | 55 | $metaData = []; |
| 56 | $tags = $this->tags; | |
| 43 | 57 | |
| 44 | 58 | if ($this->mediaId) { |
| 45 | 59 | $metaData = ['model_id' => $this->mediaId]; |
| 46 | 60 | } |
| 47 | 61 | |
| 48 | MediaConvert::createJob($this->jobSettings, $metaData); | |
| 62 | MediaConvert::createJob($this->jobSettings, $metaData, $tags); | |
| 49 | 63 | } |
| 50 | 64 | } |