I'm trying to upload a video capture to my S3 Bucket, but I can't do it.
Maybe I need to configure my bucket, I already allowed POST / PUT / GET in my CORS configuration. I don't know if my policy need to be the same as the policy of my bucket.
Here my code:
'use strict';
app.controller('VideoCtrl', function($scope, $cordovaCapture, $state, $cordovaFileTransfer) {
$scope.record = function(){
var options = { limit: 1, duration: 8 };
$cordovaCapture.captureVideo(options).then(
function(videoData) {
var i, path, len;
var pathtogo;
var pathtogostring;
for (i = 0, len = videoData.length; i < len; i += 1) {
path = videoData[i].fullPath;
pathtogo = path.toString();
$scope.videos.$add(pathtogo);
};
},
$state.go('tab.photo-detail'),
function(err) {
}
);
var options = new FileUploadOptions();
options.fileKey="file";
var fileName = "capturedvideo.MOV";
options.fileName = fileName;
options.mimeType ="video/mov";
options.chunkedMode = false;
var uri = encodeURI("https://<my bucket>.amazonaws.com/");
var policyDoc = "js/signing-util.js";
var signature = "js/signing-util.js";
var params = {
"key": "file",
"AWSAccessKeyId": "<MY AWS Key>",
"acl": "public-read",
"policy": policyDoc,
"signature": signature,
"Content-Type": "video/mov"
};
options.params = params;
$cordovaFileTransfer.upload(videoData[i].fullPath, uri, options)
.then(function(result) {
console.log("SUCCESS: " + JSON.stringify(result.response));
}, function(err) {
console.log("ERROR: " + JSON.stringify(err));
}, function(progress) {
// constant progress updates
});
};
});
PLUS:
I use the default cordova-platform iOS @3.9.2 but every time I got access to my camera on device (iPhone 6 - iOS 9) I receive this error:
Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.
Is only a warning issue or is not capturing the video?
Hello,
I'm trying to upload a video capture to my S3 Bucket, but I can't do it.
Maybe I need to configure my bucket, I already allowed POST / PUT / GET in my CORS configuration. I don't know if my policy need to be the same as the policy of my bucket.
Here my code:
My signature / policy doc is this:
Is something wrong with my code?
PLUS: I use the default cordova-platform iOS @3.9.2 but every time I got access to my camera on device (iPhone 6 - iOS 9) I receive this error: Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.
Is only a warning issue or is not capturing the video?
Thanks.