Open flvlef opened 3 years ago
I've tried to help @flvlef solve this issue, but unsuccessfully.
We set the MediaStore container permissive enough that I can use curl to add files to it from my localhost. I can upload all types of files, except .vtt files (for which there's a pattern filtering in the CloudFront distribution to trigger the Lambda@Edge function).
At first, I thought it could be a lack of permission to the role associated with the function, but the error occurred even when a role with AdministratorAccess was given to the function.
This is the error I see when trying to upload a file with curl:
The Lambda function associated with the CloudFront distribution is invalid or doesn't have the required permissions. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
And these are the errors present in the CloudWatch:
ERROR Outer Lambda Exception
[ERROR] UnboundLocalError: local variable 'lang_id' referenced before assignment Traceback (most recent call last): File "/var/task/lambda_function.py", line 308, in lambda_handler put_count_metrics('error_lambda', 1, PIPE_ID, lang_id)
Hi @flvlef
AWS MediaStore will not work as the output of this project. The main limitation is that AWS MediaPackage is putting the correct WebVTT timestamp into the the .vtt files, so that the text shows up during each segment.
AWS MediaPackage takes the VTT files it gets and trims the timestamp so it shows up just when that segment is displaying on the HLS video player the client is using.
This is an example VTT file created in Lambda@Edge
WEBVTT
00:00:00.000 --> 1000000:00:00.000
What was his name again?
AWS MediaPackage will change the timestamps so they match the PTS start and end time of each TS video file.
WEBVTT
_start_PTS_Timestamp_in_Video_TS_File_ --> _end_PTS_Timestamp_in_Video_TS_File_
What was his name again?
For the curl question. When you do a PUT request directly to CloudFront the Lambda@Edge is looking for an underscore then the language code. This is what it is setup as default. _en
So if you PUT a file that looks like english_en.vtt that will cause the error to go away.
Hi, Thanks for this excellent stack. I tried to integrate it with our current workflow (MediaLive > MediaStore > CloudFront) So I basically replaced MediaPackage destination to a MediaStore bucket and removed one of the CF distributions. So now MeidaLive is writing to a CF distribution that trigger Lambda@Edge function for vtt files only. Viewers are getting the stream from the same CF distribution.
I have no issue having MediaLive PUTing m3u8+ts files to CF>MediaStore and viewers GETing m3u8+ts+vtt files from MediaStore>CF.
But when it comes to PUTing VTT files (so basically when the Lambda@Edge function is triggered) I cannot manage to make it work. MediaLive is always returning an error writing VTT files, even being very permissive all the way.
Is there something you could tell me about that idea?