Reputation: 131
I have a problem accessing videos on AmazonS3.
I get links from a server like
Now i want to show this on a website by using html video but all i got is an error. When i enter the url in chrome it does something and then download the video so the file exists.
How can i display this video in a video tag? or is there any possibility to do this in javascript?
Upvotes: 1
Views: 2209
Reputation: 5665
I recommend setting the ACL to public and converting all the non-HTML5 formats to mp4 because mp4 has the most Browser support.
You may want to try the free Cloudberry Explorer if you do not have a Desktop S3 utility.
Change your ACL Setting to Public and the file can be accessed without access keys.
Make sure the Content Type is video/mp4
Without an actual link to the mp4 I cannot pin point the problem.
If you get the same error as the sample link provided you need to generate new access keys.
If the ACL is not public and the client will generate you a set access keys there is nothing that can be done.
I was able to download the video with the link you provided.
It is an AVI file and not mp4, so it will not work in the HTML5 <video>
.
This is the error without the Access Keys.
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>63085EEB23066C91</RequestId>
<HostId>1bPb9fYkki/LnQIVRVpHfKiSEUGbfX3blBfHLQbwzjZYSzzD8hGBQFp0l9WE=
</HostId>
</Error>
If you are familiar with PHP, there is a simple S3 API.
require_once 'Services/Amazon/S3.php';
require_once 'Services/Amazon/S3/Stream.php';
$key = 'ASJMGERQERMGADMA';
$secret = 'hA9/wrWUMX7A0UADLNGBQEUIROH2cPjx+C';
$s3 = Services_Amazon_S3::getAccount($key, $secret);
$stream = Services_Amazon_S3_Stream::register('s3',array('access_key_id'=> $key,'secret_access_key' => $secret));
foreach ($s3->getBuckets() as $bucket){
$name = $bucket->name ;
$path = "s3://$name/";
}
$cnt = 0;
$ndx = 0;
$bucket = $s3->getBucket($name);
foreach ($bucket->getObjects() as $object){
$key = $object->key;
$url = urldecode($object->getURL());
echo "<p>$key => $url";
}
Upvotes: 1