Norman Perrin Norman Perrin - 9 days ago 4
Javascript Question

How to transform Uint8Array to .mp4 from AWS response

Hello fellow programmers.
I'm having a problem with transforming a response from AWS S3 to a .mp4 and then loading the content to a video tag.

The script:


var s3 = new AWS.S3({
endpoint: '...',
accessKeyId: "...",
secretAccessKey: "...",
region: '...',
});

s3.getObject(
{
Bucket: "...",
Key: "video.mp4"
},
function (err, data) {
if (err) {
console.log("[VideoPlay | ERROR | fallo del get]: " + err);
} else {
var video = document.getElementById('video');
var source = document.createElement('source');
var content = new Blob([new Uint8Array(data)], { type: "video/mp4" });
var url = (window.URL || window.webkitURL).createObjectURL(content);
source.setAttribute('src', url);
video.appendChild(source);
video.play();
}
}
);


The error: 416 (Requested Range Not Satisfiable)

Thanks

Answer

Finally I was uploading the file incorrectly. Here is the "get": get link

And here is the upload: upload link

Comments