从aws s3访问视频

时间:2013-08-16 19:58:30

标签: c# .net asp.net-mvc-4 amazon-s3

我之前访问过本地的视频文件。现在我正在尝试访问位于aws s3上的视频文件。

我的旧HTML元素是

<source class="video-source" type="video/mp4" src="~/Content/videos/MyVideo.mp4" />

我应该可以做像

这样的事情
<source class="video-source" type="video/mp4" src="AwsInfo" />

我的控制器中还有以下方法

using (AmazonS3Client client = new AmazonS3Client())
{
    var bucketObject = new GetObjectRequest
    {
         BucketName = "MyBucketName",
         Key = "MyKey"
    };

    var v = client.GetObject(bucketObject); //I believe this would give me any information I need
}

1 个答案:

答案 0 :(得分:0)

我设置了Amazon CloudFront,它为您提供了一个域,然后您可以通过url + key

访问该域
<source class="video-source" type="video/mp4" src="https://myUrl.cloudfront.net/myKey" />