离子上传视频到服务器

时间:2017-07-12 21:47:06

标签: ionic-framework video-capture

我正在尝试将视频发送到服务器,但我没有得到任何回报。

以下是代码:

var options = new FileUploadOptions()
  options = {
      fileKey:      "avatar",
      fileName:     $scope.video.name,
      mimeType:     $scope.video.type,
      chunkedMode:  false,
  };

 $cordovaFileTransfer.upload(serverURL, $scope.video.fullPath, options).then(function(result) {
            console.log("SUCCESS: " + JSON.stringify(result.response));
        }, function(err) {
            console.log("ERROR: " + JSON.stringify(err));
        }, function (progress) {
            console.log("PROGRESS: " + JSON.stringify(progress));
        });

    }

为了您的信息,我正在使用cordovaCapture.captureVideo插件录制视频,并且返回内容存储在$scope.video

顺便说一句,这是$scope.video

的日志
{"name":"20170712_184203.mp4","localURL":"cdvfile://localhost/sdcard/DCIM/Camera/20170712_184203.mp4","type":"video/mp4","lastModified":null,"lastModifiedDate":1499895726000,"size":3926733,"start":0,"end":0,"fullPath":"file:///storage/emulated/0/DCIM/Camera/20170712_184203.mp4"}

并且返回

ERROR: {"code":null,"source":null,"target":null,"http_status":null,"body":null,"exception":null}

由于

0 个答案:

没有答案