简体   繁体   English

使用 AWS Javascript SDK 更新 AWS S3 视频/对象元数据

[英]Update AWS S3 Video/Object Metadata With AWS Javascript SDK

My video files in S3 don't have any cache-control header and therefore my users have to reload/download videos on every refesh.我在 S3 中的视频文件没有任何缓存控制 header,因此我的用户必须在每次刷新时重新加载/下载视频。 I can manually update the cache-control metadata on the AWS website, but I need to do it programmatically on my node server.我可以在 AWS 网站上手动更新缓存控制元数据,但我需要在我的节点服务器上以编程方式进行。

Here is link to video landing page example.这是视频登陆页面示例的链接。 Here is screenshot of video with no cache-control.这是没有缓存控制的视频截图。

视频网络请求截图

The challenge is I can't simply set the headers when I create the signedUrl or upload the video, because my final video comes from AWS Elastic Transcoder.挑战是我不能在创建 signedUrl 或上传视频时简单地设置标题,因为我的最终视频来自 AWS Elastic Transcoder。 Users upload a.mov file on my front end to AWS, which starts an Elastic Transcoder job on the backend that converts it to.mp4.用户将我前端的 .mov 文件上传到 AWS,AWS 会在后端启动 Elastic Transcoder 作业,将其转换为 .mp4。 I can't find a way to set a cache-control on Elastic Transcoder outputs, so I'm assuming I need to use a separate function to update the object metadata once the transcoder job is done.我找不到在 Elastic Transcoder 输出上设置缓存控制的方法,所以我假设我需要在转码器作业完成后使用单独的 function 来更新 object 元数据。

Also, I'm not 100% sure I even need to take this step, do I need to manually set cache-control?另外,我不是 100% 确定我什至需要采取这一步,我需要手动设置缓存控制吗?

Found a better solution, use AWS Cloudfront!找到更好的解决方案,使用 AWS Cloudfront!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM