I'm trying to capture a video using cordova-plugin-media-capture and upload it with cordova-plugin-file-transfer.
Heres the media-capture call:
navigator.device.capture.captureVideo(
app.view.controller.success,
app.view.controller.error,
{limit: 1}
);
And the success callback:
app.view.controller.success = function(event)
{
var options = new FileUploadOptions();
options.fileKey = 'data[Request][video]';
options.fileName = event[0].name;
options.mimeType = event[0].type;
options.chunkedMode = false;
var transfer = new FileTransfer();
transfer.upload(
event[0].localURL,
app.view.uploadurl,
app.view.controller.uploaded,
app.view.controller.error,
options,
true
);
};
For now, the uploaded and error callbacks only do a console.log() of the arguments.
The problem is that it runs fine on android 5.1 but gives me a EACESS error (transfer.upload call) on android 6.0. Error code 1, can't read file).
I can confirm that the video has been recorded, it shows in the gallery app. But the file-transfer plugin can't read it.
Does anyone have a clue?
Make sure you have encoded your uri : app.view.uploadurl
like this : encodeURI("http://some.server.com/upload.php")
As per these two github issues there is no way to use capture video to get a video file without also using MANAGE_EXTERNAL_STORAGE and running the risk of getting excluded from the play store
https://github.com/apache/cordova-plugin-file/issues/426
https://github.com/apache/cordova-plugin-media-capture/issues/125
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.