0

In my project, users can upload videos. So, when user uploads a video, the video name is stored in a table with a field "is_processed" is set to false by default.

Then the uploaded video is stored in S3. When video a arrives in S3, a Lambda is triggered and video is given to media convert. After converting the video to HLS format, it is again stored in a separate S3 bucket.

Now I want my "is_processed" field is to be true when video is successfully converted to HLS by mediaconvert.

So, how can I communicate to my Laravel backend from AWS and make the "is_processed" field true, for that particular video.

Grokify
  • 15,092
  • 6
  • 60
  • 81
Debarshi Das
  • 87
  • 1
  • 9

1 Answers1

1

One way you could do this is through a combination of metadata tags, cloudwatch, and another Lambda function.

  1. In MediaConvert a metadata tag can be used with each job to assign a unique ID. For example:

Key= uuid

Value=< video name >

This value would need to be inserted into your DB table along with is_processed=false

For more info on metadata tags see https://docs.aws.amazon.com/mediaconvert/latest/ug/user-metadata-tags.html

  1. The lambda function you have already created kicks off the job in MediaConvert. Next step in the chain would be to create a cloudwatch event to trigger another Lambda function when the job completes. For example:

Cloudwatch --> Events --> Rules --> Create rule

Service name = MediaConvert

Event Type = MediaConvert Job State Change

Specific state = complete

Targets --> Lambda function

For more info on cloudwatch events see https://docs.aws.amazon.com/mediaconvert/latest/ug/cloudwatch_events.html

  1. Once the MediaConvert job completes this will send a CloudWatch event, which will trigger your Lambda function to show the job has been completed. You can use the uuid key pair defined in User Metadata to find the DB entry, update from is_processed=false to is_processed=true.
jjohn
  • 233
  • 1
  • 3
MicheleM
  • 11
  • 1