react-native-background-upload
react-native-background-upload copied to clipboard
[Android] When using this package with react-native-camera get {"framesToPop": 1, "code": EUNSPECIFIED}
I get this error on Android only when I try to upload a file using a uri
from react-native-camera
:
{"framesToPop": 1, "code": EUNSPECIFIED}
My upload code:
// Attempt to start file upload
try {
uploadId = await Upload.startUpload(options);
} catch (e) {
console.log("failing here");
dispatch(messageFailed(uploadingMessage, I18n.t("messageFailedUpload"), e));
}
My camera code:
startRecording = () => {
if (this.camera) {
this.camera
.recordAsync({})
.then(data => {
console.log("data", data);
this.props.upload(data.uri);
this.navigateToChat();
})
.catch(err => console.error(err));
this.setState({
isRecording: true
});
}
};
Not sure if this is a problem in this package or with react-native-camera
. Any ideas as to what this error message means?
A workaround I have for now is: I copy the file using RNFS.copyFile(uri,dest)
and use the destination uri
(dest) and feed that to the uploader. But it would be nice if I could get rid of this workaround and just use the uri
provided by react-native-camera
.
Any updates on this? Running into this issue as well
Do you remove the file://
part from the path? For me, this resolved this issue.
Changed this:
const options = {
path: videoFilePath,
...otherOptions,
}
const uploadId = await Upload.startUpload(options);
To this:
const options = {
path: Platform.OS === 'ios' ? videoFilePath : videoFilePath.replace('file://', ''),
...otherOptions,
}
const uploadId = await Upload.startUpload(options);
I've same issue (only on android 8+) and above workaround could not solve mine. Has anybody other suggestion?
react-native-background-upload: 5.1.0
react-native: 0.55.4