I'm developing an app to let people upload short videos (8secs) to show products, the problem is I can't figure out how to upload a captured cordova file to GCS.
I'm using the cordova file transfer plugin and I created the iOS API key with the bundle identified of my app, but I still can't upload the video.
My code
'use strict';
app.controller('VideoCtrl', function($scope, $cordovaCapture, $state, FURL, Videos) {
$scope.videos = Videos;
$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) { }
);
$cordovaFileTransfer.upload("https://www.googleapis.com/upload/storage/v1/b/'mybucket'/o?uploadType=media", videoData[i].fullPath, {mimeType: "video/mov", fileName:"capturedvideo.MOV"}, true)
.then(function(result) {
console.log("SUCCESS: " + JSON.stringify(result.response));
}, function(err) {
console.log("ERROR: " + JSON.stringify(err));
}, function (progress) {
// constant progress updates
});
};});
Thanks.